{"record":{"id":"c2868c5e1ddc8963","repo":"go-delve/delve","slug":"malformed-qfthreadinfo-response","errorCode":null,"errorMessage":"malformed qfThreadInfo response","messagePattern":"malformed qfThreadInfo response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/gdbserial/gdbserver_conn.go","lineNumber":962,"sourceCode":"\tconn.outbuf.Reset()\n\tif first {\n\t\tconn.outbuf.WriteString(\"$qfThreadInfo\")\n\t} else {\n\t\tconn.outbuf.WriteString(\"$qsThreadInfo\")\n\t}\n\n\tresp, err := conn.exec(conn.outbuf.Bytes(), \"thread info\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch resp[0] {\n\tcase 'l':\n\t\treturn nil, nil\n\tcase 'm':\n\t\t// parse list...\n\tdefault:\n\t\treturn nil, errors.New(\"malformed qfThreadInfo response\")\n\t}\n\n\tvar pid int\n\tresp = resp[1:]\n\tfor {\n\t\ttidbuf := resp\n\t\tcomma := bytes.Index(tidbuf, []byte{','})\n\t\tif comma >= 0 {\n\t\t\ttidbuf = tidbuf[:comma]\n\t\t}\n\t\tif conn.multiprocess && pid == 0 {\n\t\t\tdot := bytes.Index(tidbuf, []byte{'.'})\n\t\t\tif dot >= 0 {\n\t\t\t\tpid, _ = strconv.Atoi(string(tidbuf[1:dot]))\n\t\t\t}\n\t\t}\n\t\tthreads = append(threads, string(tidbuf))\n\t\tif comma < 0 {","sourceCodeStart":944,"sourceCodeEnd":980,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/gdbserial/gdbserver_conn.go#L944-L980","documentation":"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.","triggerScenarios":"Thrown at pkg/proc/gdbserial/gdbserver_conn.go:962 when the library encounters an invalid state.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// confirm the stub answers qfThreadInfo before connecting delve:\n// $ echo $qfThreadInfo#b6 | nc host 1234   -> expect 'm<tid hex>' or 'l'","typeGuard":null,"tryCatchPattern":"if err := connect(target); err != nil {\n    if strings.Contains(err.Error(), \"malformed qfThreadInfo\") {\n        log.Printf(\"stub does not implement qfThreadInfo: %v\", err)\n        // fall back to a different backend or updated stub\n    }\n}","preventionTips":["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"],"tags":["gdbserial","protocol","thread-info","compatibility"],"backgroundTag":"malformed-protocol-response","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}