go-delve/delve · error
CFA becomes undefined at PC %#x: %v
Error message
CFA becomes undefined at PC %#x: %v
What it means
While unwinding via DWARF CFI, Delve evaluates the CFA (Canonical Frame Address) rule at the current PC. If the rule evaluates to nil/undefined (and err carries the reason), the caller's frame address cannot be computed and unwinding aborts. This means the binary's DWARF frame information is missing or inapplicable at that PC.
Source
Thrown at pkg/proc/stack.go:724
logger := logflags.StackLogger()
fde, err := it.bi.frameEntries.FDEForPC(it.pc)
var framectx *frame.FrameContext
if _, nofde := err.(*frame.ErrNoFDEForPC); nofde {
framectx = it.bi.Arch.fixFrameUnwindContext(nil, it.pc, it.bi)
} else {
fctxt, err := fde.EstablishFrame(it.pc)
if err != nil {
logger.Errorf("Error executing Frame Debug Entry for PC %x: %v", it.pc, err)
}
framectx = it.bi.Arch.fixFrameUnwindContext(fctxt, it.pc, it.bi)
}
logger.Debugf("advanceRegs (DWARF) at %#x", it.pc)
cfareg, err := it.executeFrameRegRule(0, framectx.CFA, 0)
if cfareg == nil {
it.err = fmt.Errorf("CFA becomes undefined at PC %#x: %v", it.pc, err)
return op.DwarfRegisters{}, 0, 0
}
if logflags.Stack() {
logger.Debugf("\tCFA rule %s -> %#x", ruleString(&framectx.CFA, it.bi.Arch.RegnumToString), cfareg.Uint64Val)
}
it.regs.CFA = int64(cfareg.Uint64Val)
callimage := it.bi.PCToImage(it.pc)
callFrameRegs = op.DwarfRegisters{
StaticBase: callimage.StaticBase,
ByteOrder: it.regs.ByteOrder,
PCRegNum: it.regs.PCRegNum,
SPRegNum: it.regs.SPRegNum,
BPRegNum: it.regs.BPRegNum,
LRRegNum: it.regs.LRRegNum,
}
View on GitHub (pinned to a23773e6c3)
Solutions
- Rebuild the target ensuring debug info is present (default `go build`, no -s -w)
- Update Delve; it ships fallback heuristics for Go runtime assembly frames
- Use the fallback stack unwinding (check frame-architecture assumptions) or stop the walk before foreign frames
- Verify you attached to the exact binary matching the loaded image addresses
Example fix
// before go build -ldflags="-s -w" -o app . // after go build -o app .
Defensive patterns
Strategy: fallback
Validate before calling
if _, ok := bi.frameDescriptionForPC(pc); !ok { /* no FDE at pc: expect undefined CFA */ } Try / catch
_, err := iterateFrames(); if err != nil && strings.Contains(err.Error(), "CFA becomes undefined") { /* stop the walk and present frames collected so far */ } Prevention
- Build with full DWARF (no -s -w, no objcopy --strip-debug)
- Expect unwinding to terminate when crossing into assembly/foreign code
- Match the loaded binary to the executed image exactly
- Keep Delve updated for improved Go runtime assembly CFI fallbacks
When it happens
Trigger: advanceRegs (DWARF path) executed at a PC where no FDE/rule covers the CFA — e.g. unwinding into code without DWARF frame info (assembly runtime functions, JIT, or foreign code) or truncated .debug_frame/.eh_frame.
Common situations: Stacks crossing from Go code into hand-written assembly or system libraries without DWARF; binaries built with frame info stripped; mixing a binary and a debug-info mismatch (wrong binary loaded at address).
Related errors
- Undefined return address at %#x
- could not retrieve CFA for current PC
- unexpected CFA rule %d at uprobe PC %#x
- ErrStackUnderflow
- ErrStackIndexOutOfBounds
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/7a5ccdc0d8a30ac9.
Report an issue: GitHub.