go-delve/delve · error

not valid

Error message

not valid

What it means

The i386 (32-bit x86) ABI likewise has no dedicated link register, so I386Registers.LR() always panics. LR exists in the proc.Registers interface only for architectures that actually implement one (e.g. ARM64).

Source

Thrown at pkg/proc/linutil/regs_i386_arch.go:110

}

func (r *I386Registers) BP() uint64 {
	return uint64(uint32(r.Regs.Ebp))
}

// CX returns the value of ECX register.
func (r *I386Registers) CX() uint64 {
	return uint64(uint32(r.Regs.Ecx))
}

// TLS returns the address of the thread local storage memory segment.
func (r *I386Registers) TLS() uint64 {
	return r.Tls
}

// LR returns the link register.
func (r *I386Registers) LR() uint64 {
	panic("not valid")
}

// GAddr returns the address of the G variable if it is known, 0 and false
// otherwise.
func (r *I386Registers) GAddr() (uint64, bool) {
	return 0, false
}

// Copy returns a copy of these registers that is guaranteed not to change.
func (r *I386Registers) Copy() (proc.Registers, error) {
	if r.loadFpRegs != nil {
		err := r.loadFpRegs(r)
		r.loadFpRegs = nil
		if err != nil {
			return nil, err
		}
	}
	var rr I386Registers

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Avoid LR() on i386; derive return addresses from the stack (CFA) instead
  2. Branch on runtime.GOARCH before querying the link register
  3. Use delve's existing frame/unwind helpers, which are architecture-aware

Example fix

// before
ret := regs.LR()
// after
if runtime.GOARCH == "386" {
    ret = readReturnAddrFromStack(...)
} else if hasLinkRegister {
    ret = regs.LR()
}
Defensive patterns

Strategy: type-guard

Validate before calling

if runtime.GOARCH == "386" { /* no LR: do not call */ }

Type guard

func hasLinkRegister() bool {
    switch runtime.GOARCH {
    case "arm64", "riscv64", "loong64", "ppc64le":
        return true
    }
    return false
}

Try / catch

defer func() {
    if r := recover(); r != nil { err = fmt.Errorf("LR unavailable: %v", r) }
}()

Prevention

When it happens

Trigger: Calling registers.LR() on an I386Registers value from stack-walking or frame-inspection code that does not account for GOARCH=386.

Common situations: Cross-architecture debugging tools assuming RISC semantics; generic code over pkg/proc registers interfaces; testing delve on 32-bit x86 Linux.

Related errors


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