{"record":{"id":"73570aed18acd98f","repo":"go-delve/delve","slug":"malformed-response-for-vcont-s","errorCode":null,"errorMessage":"malformed response for vCont %s","messagePattern":"malformed response for vCont (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/gdbserial/gdbserver_conn.go","lineNumber":763,"sourceCode":"// Mach exception codes used to decode metype/medata keys in stop packets (necessary to support watchpoints with debugserver).\n// See:\n//\n//\thttps://opensource.apple.com/source/xnu/xnu-4570.1.46/osfmk/mach/exception_types.h.auto.html\n//\thttps://opensource.apple.com/source/xnu/xnu-4570.1.46/osfmk/mach/i386/exception.h.auto.html\n//\thttps://opensource.apple.com/source/xnu/xnu-4570.1.46/osfmk/mach/arm/exception.h.auto.html\nconst (\n\t_EXC_BREAKPOINT     = 6     // mach exception type for hardware breakpoints\n\t_EXC_I386_SGL       = 1     // mach exception code for single step on x86, for some reason this is also used for watchpoints\n\t_EXC_ARM_DA_DEBUG   = 0x102 // mach exception code for debug fault on arm/arm64\n\t_EXC_ARM_BREAKPOINT = 1     // mach exception code for breakpoint on arm/arm64\n)\n\n// executes 'vCont' (continue/step) command\nfunc (conn *gdbConn) parseStopPacket(resp []byte, threadID string, tu *threadUpdater) (repeat bool, sp stopPacket, err error) {\n\tswitch resp[0] {\n\tcase 'T':\n\t\tif len(resp) < 3 {\n\t\t\treturn false, stopPacket{}, fmt.Errorf(\"malformed response for vCont %s\", string(resp))\n\t\t}\n\n\t\tsig, err := strconv.ParseUint(string(resp[1:3]), 16, 8)\n\t\tif err != nil {\n\t\t\treturn false, stopPacket{}, fmt.Errorf(\"malformed stop packet: %s\", string(resp))\n\t\t}\n\t\tsp.sig = uint8(sig)\n\t\tsp.watchReg = -1\n\t\tsp.regs = make(map[uint64]uint64)\n\n\t\tif logflags.GdbWire() && gdbWireFullStopPacket {\n\t\t\tconn.log.Debugf(\"full stop packet: %s\", string(resp))\n\t\t}\n\n\t\tvar metype int\n\t\tmedata := make([]uint64, 0, 10)\n\n\t\tparseMachException := func(sp *stopPacket, metype int, medata []uint64) {","sourceCodeStart":745,"sourceCodeEnd":781,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/gdbserial/gdbserver_conn.go#L745-L781","documentation":"Thrown by gdbConn.parseStopPacket when the reply to a vCont (continue/step) command starts with 'T' (a stop packet) but has fewer than 3 bytes, so the two hex signal digits cannot be parsed. A valid T stop packet must look like 'T05thread:...' — anything shorter is truncated garbage. Delve treats this as a corrupt response from the remote stub.","triggerScenarios":"conn.exec of a vCont;c/vCont;s command returns a reply of exactly 'T', 'T' plus one char, or an empty 'T'-prefixed response — i.e. the stub sent a truncated stop packet.","commonSituations":"Flaky serial/network connection dropping bytes mid-packet; buggy or half-implemented stubs that emit bare 'T'; race where the connection is closed while the stop reply is in flight.","solutions":["Check the physical/serial/network link for truncation and reconnect to the target","Restart the debug session; the stub's protocol state may be corrupted","Verify the stub fully implements the GDB remote stop-packet format","Capture wire logs (dlv --log --log-output=gdbwire) and inspect the raw packet"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Verify stub health before continuing:\nresp, err := conn.exec([]byte(\"?\"), \"halt reason\")\nif err != nil || len(resp) < 3 || resp[0] != 'T' && resp[0] != 'S' {\n    return fmt.Errorf(\"stub not producing valid stop packets\")\n}","typeGuard":null,"tryCatchPattern":"repeat, sp, err := conn.parseStopPacket(resp, tid, tu)\nif err != nil && strings.Contains(err.Error(), \"malformed response for vCont\") {\n    // reconnect once and retry the continue\n    conn.close()\n    return reconnectAndContinue()\n}","preventionTips":["Use a reliable transport (TCP instead of lossy serial) where possible","Check cabling/serial baud rate when debugging over UART","Run with --log-output=gdbwire to catch truncation early","Restart the session after any malformed-packet error; state may be desynced"],"tags":["gdb-serial-protocol","go","stop-packet","truncated-response"],"backgroundTag":"malformed-gdb-stop-packet","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}