{"record":{"id":"7a5ccdc0d8a30ac9","repo":"go-delve/delve","slug":"cfa-becomes-undefined-at-pc-x-v","errorCode":null,"errorMessage":"CFA becomes undefined at PC %#x: %v","messagePattern":"CFA becomes undefined at PC %#x: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/stack.go","lineNumber":724,"sourceCode":"\tlogger := logflags.StackLogger()\n\n\tfde, err := it.bi.frameEntries.FDEForPC(it.pc)\n\tvar framectx *frame.FrameContext\n\tif _, nofde := err.(*frame.ErrNoFDEForPC); nofde {\n\t\tframectx = it.bi.Arch.fixFrameUnwindContext(nil, it.pc, it.bi)\n\t} else {\n\t\tfctxt, err := fde.EstablishFrame(it.pc)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"Error executing Frame Debug Entry for PC %x: %v\", it.pc, err)\n\t\t}\n\t\tframectx = it.bi.Arch.fixFrameUnwindContext(fctxt, it.pc, it.bi)\n\t}\n\n\tlogger.Debugf(\"advanceRegs (DWARF) at %#x\", it.pc)\n\n\tcfareg, err := it.executeFrameRegRule(0, framectx.CFA, 0)\n\tif cfareg == nil {\n\t\tit.err = fmt.Errorf(\"CFA becomes undefined at PC %#x: %v\", it.pc, err)\n\t\treturn op.DwarfRegisters{}, 0, 0\n\t}\n\tif logflags.Stack() {\n\t\tlogger.Debugf(\"\\tCFA rule %s -> %#x\", ruleString(&framectx.CFA, it.bi.Arch.RegnumToString), cfareg.Uint64Val)\n\t}\n\tit.regs.CFA = int64(cfareg.Uint64Val)\n\n\tcallimage := it.bi.PCToImage(it.pc)\n\n\tcallFrameRegs = op.DwarfRegisters{\n\t\tStaticBase: callimage.StaticBase,\n\t\tByteOrder:  it.regs.ByteOrder,\n\t\tPCRegNum:   it.regs.PCRegNum,\n\t\tSPRegNum:   it.regs.SPRegNum,\n\t\tBPRegNum:   it.regs.BPRegNum,\n\t\tLRRegNum:   it.regs.LRRegNum,\n\t}\n","sourceCodeStart":706,"sourceCodeEnd":742,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/stack.go#L706-L742","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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"],"exampleFix":"// before\ngo build -ldflags=\"-s -w\" -o app .\n// after\ngo build -o app .","handlingStrategy":"fallback","validationCode":"if _, ok := bi.frameDescriptionForPC(pc); !ok { /* no FDE at pc: expect undefined CFA */ }","typeGuard":null,"tryCatchPattern":"_, err := iterateFrames(); if err != nil && strings.Contains(err.Error(), \"CFA becomes undefined\") { /* stop the walk and present frames collected so far */ }","preventionTips":["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"],"tags":["dwarf","stack","cfa","unwinding"],"backgroundTag":"undefined-cfa-dwarf-unwind","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}