{"record":{"id":"33dae2b4146e15f0","repo":"go-delve/delve","slug":"malformed-stop-packet-s-wrong-watch-address","errorCode":null,"errorMessage":"malformed stop packet: %s (wrong watch address)","messagePattern":"malformed stop packet: (.+?) \\(wrong watch address\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/gdbserial/gdbserver_conn.go","lineNumber":833,"sourceCode":"\t\t\t\t\treturn false, stopPacket{}, fmt.Errorf(\"malformed stop packet: %s\", string(resp))\n\t\t\t\t}\n\t\t\t\tsp.regs[reg] = v\n\t\t\t}\n\n\t\t\tswitch string(key) {\n\t\t\tcase \"thread\":\n\t\t\t\tsp.threadID = string(value)\n\t\t\tcase \"threads\":\n\t\t\t\tif tu != nil {\n\t\t\t\t\ttu.Add(strings.Split(string(value), \",\"))\n\t\t\t\t\ttu.Finish()\n\t\t\t\t}\n\t\t\tcase \"reason\":\n\t\t\t\tsp.reason = string(value)\n\t\t\tcase \"watch\", \"awatch\", \"rwatch\":\n\t\t\t\tsp.watchAddr, err = strconv.ParseUint(string(value), 16, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn false, stopPacket{}, fmt.Errorf(\"malformed stop packet: %s (wrong watch address)\", string(resp))\n\t\t\t\t}\n\t\t\tcase \"metype\":\n\t\t\t\t// mach exception type (debugserver extension)\n\t\t\t\tmetype, _ = strconv.Atoi(string(value))\n\t\t\tcase \"medata\":\n\t\t\t\t// mach exception data (debugserver extension)\n\t\t\t\td, _ := strconv.ParseUint(string(value), 16, 64)\n\t\t\t\tmedata = append(medata, d)\n\t\t\tcase \"jstopinfo\":\n\t\t\t\tjstopinfo, err := hex.DecodeString(string(value))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn false, stopPacket{}, fmt.Errorf(\"malformed stop packet: %s (wrong jstopinfo)\", string(resp))\n\t\t\t\t}\n\t\t\t\tparsedJstopInfo := []jsonStopPacket{}\n\t\t\t\tif err := json.Unmarshal(jstopinfo, &parsedJstopInfo); err != nil {\n\t\t\t\t\treturn false, stopPacket{}, fmt.Errorf(\"malformed stop packet: %s (wrong jstopinfo)\", string(resp))\n\t\t\t\t}\n\t\t\t\tsp.jstopInfo = make(map[int]stopPacket)","sourceCodeStart":815,"sourceCodeEnd":851,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/gdbserial/gdbserver_conn.go#L815-L851","documentation":"Thrown by parseStopPacket when a stop packet contains a 'watch', 'awatch', or 'rwatch' key-value pair whose value — the watchpoint address — is not valid hexadecimal. Delve uses this field to identify which watchpoint fired; a non-hex address makes the packet unusable.","triggerScenarios":"Execution stops on a data watchpoint and the stub sends 'watch:<value>' where value fails strconv.ParseUint(..., 16) — e.g. truncated or garbage address bytes.","commonSituations":"Using hardware watchpoints against buggy third-party stubs (openocd/JLink/custom) that mis-encode the watch address; packet truncation on flaky serial links; stubs where watchpoint reporting is experimental.","solutions":["Check the raw packet with gdbwire logging to see the malformed watch value","Update the target stub firmware/driver to a version with correct watchpoint reporting","Remove or avoid watchpoints on this target, or stop at breakpoints instead","Reconnect and retry the watch operation"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before relying on watchpoints over gdbserial, verify the stub reports\n// watch hits with a hex address by setting a test watchpoint and hitting it once.","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"wrong watch address\") {\n    // disable watchpoints on this stub and use breakpoint-based inspection\n    return debugWithoutWatchpoints()\n}","preventionTips":["Test watchpoint reporting on your stub before relying on it","Update openocd/JLink/debugserver to versions with fixed watch reporting","Prefer hardware breakpoints over watchpoints on flaky stubs","Log raw packets when adding watchpoint support to a custom stub"],"tags":["gdb-serial-protocol","go","watchpoint","hex-decode"],"backgroundTag":"malformed-gdb-stop-packet","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}