go-delve/delve · error

malformed stop packet: %s (wrong watch address)

Error message

malformed stop packet: %s (wrong watch address)

What it means

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.

Source

Thrown at pkg/proc/gdbserial/gdbserver_conn.go:833

					return false, stopPacket{}, fmt.Errorf("malformed stop packet: %s", string(resp))
				}
				sp.regs[reg] = v
			}

			switch string(key) {
			case "thread":
				sp.threadID = string(value)
			case "threads":
				if tu != nil {
					tu.Add(strings.Split(string(value), ","))
					tu.Finish()
				}
			case "reason":
				sp.reason = string(value)
			case "watch", "awatch", "rwatch":
				sp.watchAddr, err = strconv.ParseUint(string(value), 16, 64)
				if err != nil {
					return false, stopPacket{}, fmt.Errorf("malformed stop packet: %s (wrong watch address)", string(resp))
				}
			case "metype":
				// mach exception type (debugserver extension)
				metype, _ = strconv.Atoi(string(value))
			case "medata":
				// mach exception data (debugserver extension)
				d, _ := strconv.ParseUint(string(value), 16, 64)
				medata = append(medata, d)
			case "jstopinfo":
				jstopinfo, err := hex.DecodeString(string(value))
				if err != nil {
					return false, stopPacket{}, fmt.Errorf("malformed stop packet: %s (wrong jstopinfo)", string(resp))
				}
				parsedJstopInfo := []jsonStopPacket{}
				if err := json.Unmarshal(jstopinfo, &parsedJstopInfo); err != nil {
					return false, stopPacket{}, fmt.Errorf("malformed stop packet: %s (wrong jstopinfo)", string(resp))
				}
				sp.jstopInfo = make(map[int]stopPacket)

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Check the raw packet with gdbwire logging to see the malformed watch value
  2. Update the target stub firmware/driver to a version with correct watchpoint reporting
  3. Remove or avoid watchpoints on this target, or stop at breakpoints instead
  4. Reconnect and retry the watch operation
Defensive patterns

Strategy: validation

Validate before calling

// Before relying on watchpoints over gdbserial, verify the stub reports
// watch hits with a hex address by setting a test watchpoint and hitting it once.

Try / catch

if err != nil && strings.Contains(err.Error(), "wrong watch address") {
    // disable watchpoints on this stub and use breakpoint-based inspection
    return debugWithoutWatchpoints()
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/33dae2b4146e15f0. Report an issue: GitHub.