go-delve/delve · error
malformed qfThreadInfo response
Error message
malformed qfThreadInfo response
What it means
When enumerating target threads via the GDB RSP qfThreadInfo packet, the first character of the reply must be 'l' (end of list) or 'm' (more thread ids follow). Any other first byte means the stub's response cannot be parsed, so the connection returns this error.
Source
Thrown at pkg/proc/gdbserial/gdbserver_conn.go:962
conn.outbuf.Reset()
if first {
conn.outbuf.WriteString("$qfThreadInfo")
} else {
conn.outbuf.WriteString("$qsThreadInfo")
}
resp, err := conn.exec(conn.outbuf.Bytes(), "thread info")
if err != nil {
return nil, err
}
switch resp[0] {
case 'l':
return nil, nil
case 'm':
// parse list...
default:
return nil, errors.New("malformed qfThreadInfo response")
}
var pid int
resp = resp[1:]
for {
tidbuf := resp
comma := bytes.Index(tidbuf, []byte{','})
if comma >= 0 {
tidbuf = tidbuf[:comma]
}
if conn.multiprocess && pid == 0 {
dot := bytes.Index(tidbuf, []byte{'.'})
if dot >= 0 {
pid, _ = strconv.Atoi(string(tidbuf[1:dot]))
}
}
threads = append(threads, string(tidbuf))
if comma < 0 {View on GitHub (pinned to a23773e6c3)
Solutions
- Verify the remote stub supports qfThreadInfo/q s ThreadInfo (test with the stub directly or GDB)
- Update the stub/qemu/embedded target firmware to a protocol-conforming version
- Capture the raw packet exchange (Delve log flags, e.g. --log --log-output=rpc) to see what the stub actually returned
- Use a stub configuration that provides a thread list, or connect with a backend suited to the target
Defensive patterns
Strategy: validation
Validate before calling
// confirm the stub answers qfThreadInfo before connecting delve: // $ echo $qfThreadInfo#b6 | nc host 1234 -> expect 'm<tid hex>' or 'l'
Try / catch
if err := connect(target); err != nil {
if strings.Contains(err.Error(), "malformed qfThreadInfo") {
log.Printf("stub does not implement qfThreadInfo: %v", err)
// fall back to a different backend or updated stub
}
} Prevention
- Verify stub protocol conformance (qfThreadInfo support) before integrating
- Use recent qemu/gdbserver/lldb-server versions
- Enable delve logging (--log --log-output=rpc) when evaluating new stubs
When it happens
Trigger: Thrown at pkg/proc/gdbserial/gdbserver_conn.go:962 when the library encounters an invalid state.
Common situations: Connecting to non-conforming GDB stubs (embedded RTOS, custom stubs, old qemu versions) that do not implement qfThreadInfo; stubs that answer with an empty packet meaning 'unsupported'; protocol proxies/relays mangling packets.
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
- qMemoryRegionInfo response wrapped around the address space
- too many transmit attempts
- could not determine executable path: %v
- malformed qMemoryRegionInfo response packet (start): %v in %
- malformed qMemoryRegionInfo response packet (size): %v in %s
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/c2868c5e1ddc8963.
Report an issue: GitHub.