{"record":{"id":"0242ce96a5f29312","repo":"go-delve/delve","slug":"malformed-stop-packet-s","errorCode":null,"errorMessage":"malformed stop packet: %s","messagePattern":"malformed stop packet: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/gdbserial/gdbserver_conn.go","lineNumber":768,"sourceCode":"//\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) {\n\t\t\t// Debugserver does not report watchpoint stops in the standard way preferring\n\t\t\t// instead the semi-undocumented metype/medata keys.\n\t\t\t// These values also have different meanings depending on the CPU architecture.\n\t\t\tswitch conn.goarch {\n\t\t\tcase \"amd64\":","sourceCodeStart":750,"sourceCodeEnd":786,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/gdbserial/gdbserver_conn.go#L750-L786","documentation":"Thrown by parseStopPacket when the two characters after 'T' in a stop reply are not valid hexadecimal, so the signal number cannot be decoded. A stop packet must carry a 2-digit hex signal, e.g. 'T02'. This means the stub sent a structurally invalid stop packet.","triggerScenarios":"A vCont reply starting with 'T' whose resp[1:3] bytes are non-hex (e.g. 'T??' or ASCII text where the signal digits should be).","commonSituations":"Connecting to stubs that emit error text or non-standard replies to continue commands; protocol desync where Delve reads a fragment of a different packet as the stop reply; debugserver/gdbserver version incompatibilities.","solutions":["Inspect the raw wire with gdbwire logging to find what the stub actually sent","Resync or restart the debug session (the packet stream may be desynchronized)","Update the stub/gdbserver to one that emits standard T-packets","Check for a version mismatch between Delve and the target's debug server"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"repeat, sp, err := conn.parseStopPacket(resp, tid, tu)\nif err != nil {\n    if strings.Contains(err.Error(), \"malformed stop packet\") {\n        log.Warnf(\"bad stop packet from stub: %v — resyncing\", err)\n        return conn.resyncAndRecover()\n    }\n    return err\n}","preventionTips":["Verify stub versions against Delve's supported targets list","Enable gdbwire logging when integrating a new stub","Avoid stubs that inject text/errors into the stop stream","Resynchronize or reconnect after any protocol desync"],"tags":["gdb-serial-protocol","go","stop-packet","protocol-mismatch"],"backgroundTag":"malformed-gdb-stop-packet","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}