{"record":{"id":"f4f0dff7c4d16206","repo":"go-delve/delve","slug":"could-not-read-dwarf-function-entry-v","errorCode":null,"errorMessage":"could not read DWARF function entry: %v","messagePattern":"could not read DWARF function entry: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/stack.go","lineNumber":1083,"sourceCode":"\t\t// argument, that's what we use for the value of CFA.\n\t\t// For SP we use CFA minus the size of one pointer because that would be\n\t\t// the space occupied by pushing the return address on the stack during the\n\t\t// CALL.\n\t\tscope.Regs.CFA = (int64(d.variable.Addr) + d.variable.RealType.Common().ByteSize)\n\t\tscope.Regs.Reg(scope.Regs.SPRegNum).Uint64Val = uint64(scope.Regs.CFA - int64(bi.Arch.PtrSize()))\n\t} else {\n\t\t// On architectures that have a link register CFA and SP have the same\n\t\t// value but the address of the first argument is at CFA+ptrSize so we set\n\t\t// CFA to the start of the argument frame minus one pointer size.\n\t\tscope.Regs.CFA = int64(d.variable.Addr) + d.variable.RealType.Common().ByteSize - int64(bi.Arch.PtrSize())\n\t\tscope.Regs.Reg(scope.Regs.SPRegNum).Uint64Val = uint64(scope.Regs.CFA)\n\t}\n\n\trdr := scope.Fn.cu.image.dwarfReader\n\trdr.Seek(scope.Fn.offset)\n\te, err := rdr.Next()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not read DWARF function entry: %v\", err)\n\t}\n\tscope.Regs.FrameBase, _, _, _ = bi.Location(e, dwarf.AttrFrameBase, scope.PC, scope.Regs, scope.Mem)\n\tscope.Mem = cacheMemory(scope.Mem, uint64(scope.Regs.CFA), int(d.argSz))\n\n\treturn scope, nil\n}\n\n// DeferredFunc returns the deferred function, on Go 1.17 and later unwraps\n// any defer wrapper.\nfunc (d *Defer) DeferredFunc(p *Target) (file string, line int, fn *Function) {\n\tbi := p.BinInfo()\n\tfn = bi.PCToFunc(d.DwrapPC)\n\tfn = p.dwrapUnwrap(fn)\n\tif fn == nil {\n\t\treturn \"\", 0, nil\n\t}\n\tfile, line = bi.EntryLineForFunc(fn)\n\treturn file, line, fn","sourceCodeStart":1065,"sourceCodeEnd":1101,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/stack.go#L1065-L1101","documentation":"Defer.EvalScope reads the DWARF DIE of the wrapper function (scope.Fn) to evaluate AttrFrameBase. The dwarf reader's Seek+Next failed, meaning the DWARF info for that function entry is unreadable — either malformed DWARF, wrong offsets in BinaryInfo, or a truncated .debug_info section.","triggerScenarios":"Calling Defer.EvalScope when rdr.Next() at scope.Fn.offset errors — corrupted/mismatched DWARF sections, or image whose dwarf reader got invalidated (e.g. binary changed on disk after launch).","commonSituations":"Binary rebuilt while the debugger was attached (offsets stale); DWARF produced by an unsupported compiler/flags; truncated or corrupted executables; debugging with wrong-arch DWARF.","solutions":["Restart the debug session against the exact current binary (don't rebuild while attached)","Rebuild the target with standard `go build` so DWARF is well-formed","Check disk integrity / re-transfer the binary","Update Delve if the DWARF version is newer than supported"],"exampleFix":"// before\n# rebuild while dlv attached\ngo build -o app . && ./app\n// after\n# stop dlv, rebuild, then relaunch under dlv\ndlv exec ./app","handlingStrategy":"try-catch","validationCode":"rdr := fn.cu.image.dwarfReader; rdr.Seek(fn.offset); if _, err := rdr.Next(); err != nil { return errors.New(\"DWARF entry unreadable: reload binary info\") }","typeGuard":null,"tryCatchPattern":"scope, err := d.EvalScope(t, thread); if err != nil && strings.Contains(err.Error(), \"could not read DWARF function entry\") { /* restart the debug session against the current binary */ }","preventionTips":["Never rebuild or overwrite the binary while the debugger is attached","Verify DWARF integrity with readelf --debug-dump on suspicious builds","Use standard go build flags so .debug_info is well-formed","Restart the session rather than continuing after DWARF read errors"],"tags":["dwarf","defer","evalscope","debug-info"],"backgroundTag":"dwarf-entry-read-failed","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}