go-delve/delve · error
could not set register %s: not found
Error message
could not set register %s: not found
What it means
SetReg looks up the register name in the thread's register map (t.regs.regs, populated from target.xml/qRegisterInfo at handshake). If the name is absent, the register cannot be written and this error is returned.
Source
Thrown at pkg/proc/gdbserial/gdbserver.go:2099
gdbreg, ok = t.regs.regs["y"+regName[1:]]
if !ok {
gdbreg, ok = t.regs.regs["z"+regName[1:]]
}
}
if !ok && t.p.bi.Arch.Name == "arm64" && regName == "x30" {
gdbreg, ok = t.regs.regs["lr"]
}
if !ok && regName == "rflags" {
// rr has eflags instead of rflags
regName = "eflags"
gdbreg, ok = t.regs.regs[regName]
if ok {
reg.FillBytes()
reg.Bytes = reg.Bytes[:4]
}
}
if !ok {
return fmt.Errorf("could not set register %s: not found", regName)
}
reg.FillBytes()
wrongSizeErr := func(n int) error {
return fmt.Errorf("could not set register %s: wrong size, expected %d got %d", regName, n, len(reg.Bytes))
}
if len(reg.Bytes) == len(gdbreg.value) {
copy(gdbreg.value, reg.Bytes)
err := t.p.conn.writeRegister(t.strID, gdbreg.regnum, gdbreg.value)
if err != nil {
return err
}
if t.p.conn.workaroundReg != nil && len(gdbreg.value) > 16 {
// This is a workaround for a bug in debugserver where register writes (P
// packet) on AVX-2 and AVX-512 registers are ignored unless they are
// followed by a write to an AVX register.
// See:View on GitHub (pinned to a23773e6c3)
Solutions
- Verify the register name against the stub's target.xml (fetch qXfer:features:read) or qRegisterInfo output
- Use a stub with a complete target.xml for your architecture (recent gdbserver)
- Do not attempt to write registers unsupported by the stub; guard code by checking availability first
- Update Delve if the register-name mapping for your architecture is outdated
Defensive patterns
Strategy: validation
Validate before calling
// check the register exists before writing:
_, err := thread.Registers()
hasReg := func(regs proc.Registers, name string) bool {
for _, r := range regs.Slice(false) { if r.Name == name { return true } }
return false
} Try / catch
err := thread.SetReg(reg)
if err != nil && strings.Contains(err.Error(), "not found") {
return fmt.Errorf("stub does not expose register %q: %w", reg.Name, err)
} Prevention
- Fetch and inspect the stub's target.xml to know the writable register set
- Match stub architecture to the inferior architecture
- Skip writes for registers absent from the stub's register list
- Use current gdbserver/lldb-server builds with full register descriptions
When it happens
Trigger: Writing a register whose name is not exposed by the stub's target.xml or qRegisterInfo — e.g. writing an architecture-specific register (x87/SSE/debug regs) on a stub that does not list it, or a typo'd/renamed register between architectures.
Common situations: Using a stub that exposes a reduced register set (minimal target.xml); mixed-architecture remote debugging where the register name differs (e.g. rip vs pc); stubs built without FPU/debug-register descriptions.
Related errors
- could not set register %s: wrong size, expected %d got %d
- can not parse checkpoint response %q
- can not parse "info checkpoints" output line %q
- can not parse "info checkpoints" output line %q: %v
- could not find %s register
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/ad2b2a80a7e68aae.
Report an issue: GitHub.