go-delve/delve · error
malformed qMemoryRegionInfo response packet (start): %v in %
Error message
malformed qMemoryRegionInfo response packet (start): %v in %s
What it means
This error is returned by memoryRegionInfo in Delve's gdbserial backend when the 'start' field of a qMemoryRegionInfo response packet cannot be parsed as a 64-bit hex integer. The GDB Remote Serial Protocol stub replied to the qMemoryRegionInfo query, but its 'start:<hex>' value was not valid hexadecimal. Delve treats any unparseable field as a malformed packet and aborts rather than returning a partially-filled memory region.
Source
Thrown at pkg/proc/gdbserial/gdbserver_conn.go:1289
func (conn *gdbConn) memoryRegionInfo(addr uint64) (*memoryRegionInfo, error) {
conn.outbuf.Reset()
fmt.Fprintf(&conn.outbuf, "$qMemoryRegionInfo:%x", addr)
resp, err := conn.exec(conn.outbuf.Bytes(), "qMemoryRegionInfo")
if err != nil {
return nil, err
}
mri := &memoryRegionInfo{}
csp := colonSemicolonParser{buf: resp}
for csp.next() {
key, value := csp.key, csp.value
switch string(key) {
case "start":
start, err := strconv.ParseUint(string(value), 16, 64)
if err != nil {
return nil, fmt.Errorf("malformed qMemoryRegionInfo response packet (start): %v in %s", err, string(resp))
}
mri.start = start
case "size":
size, err := strconv.ParseUint(string(value), 16, 64)
if err != nil {
return nil, fmt.Errorf("malformed qMemoryRegionInfo response packet (size): %v in %s", err, string(resp))
}
mri.size = size
case "permissions":
mri.permissions = string(value)
case "name":
namestr, ok := decodeHexString(value)
if !ok {
return nil, fmt.Errorf("malformed qMemoryRegionInfo response packet (name): %s", string(resp))
}
mri.name = namestr
case "error":
errstr, ok := decodeHexString(value)View on GitHub (pinned to a23773e6c3)
Solutions
- Update or fix the remote gdbserial stub so 'start' is emitted as bare lowercase hex without 0x prefix (e.g. start:7fff0000)
- Check the raw packet in the error message (%s holds the full response) to see exactly what the stub sent
- Verify you are connecting to a supported target; try the native backend instead of gdbserial where possible
- Report the issue to the stub vendor/upstream if the response violates the GDB RSP specification
Example fix
// stub before (malformed) start:0x7fff0000 // stub after (valid GDB RSP hex) start:7fff0000
Defensive patterns
Strategy: validation
Validate before calling
// Validate that the stub's qMemoryRegionInfo reply uses bare hex before relying on it.
func validHex(s string) bool {
if s == "" || len(s)%2 != 0 { return false }
for _, r := range s {
if !((r >= '0' && r <= '9') || (r >= 'a' && r <= 'f') || (r >= 'A' && r <= 'F')) { return false }
}
return true
}
// use: if !validHex(startField) { /* stub is non-conforming; avoid region queries */ } Type guard
func isMemoryRegionInfoPacket(resp []byte) bool {
for _, kv := range bytes.Split(resp, []byte(",")) {
parts := bytes.SplitN(kv, []byte(":"), 2)
if len(parts) == 2 && string(parts[0]) == "start" {
_, err := strconv.ParseUint(string(parts[1]), 16, 64)
return err == nil
}
}
return false
} Try / catch
mri, err := conn.memoryRegionInfo(addr)
if err != nil {
if strings.Contains(err.Error(), "malformed qMemoryRegionInfo response packet (start)") {
log.Printf("stub sent invalid start field: %v", err)
// fall back to assuming full-address-space or skipping the feature
return nil
}
return err
} Prevention
- Use supported gdbserver/stub versions with conforming qMemoryRegionInfo responses
- Log raw RSP traffic (Delve's --log output) when integrating a new stub
- Test stub responses against the GDB Remote Serial Protocol spec before production use
- Prefer the native backend when local debugging removes the stub from the picture
When it happens
Trigger: Calling any Delve API that queries memory region info (e.g. breakpoints/memory validation paths that call c.memoryRegionInfo) against a gdbserial target when the remote stub sends a qMemoryRegionInfo response whose 'start' value fails strconv.ParseUint(value, 16, 64).
Common situations: Connecting to a non-standard or buggy GDB RSP stub, a custom/lite debugger server that formats addresses with a 0x prefix or decimal instead of bare hex, a stub emitting an empty or truncated start field, or a protocol-incompatible firmware monitor stub.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- malformed qMemoryRegionInfo response packet (size): %v in %s
- qMemoryRegionInfo response wrapped around the address space
- too many transmit attempts
- malformed qfThreadInfo response
- could not determine executable path: %v
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/48a33102555e7c54.
Report an issue: GitHub.