{"record":{"id":"8e30218bf90ba12d","repo":"go-delve/delve","slug":"dwarf-read-error-v","errorCode":null,"errorMessage":"DWARF read error: %v","messagePattern":"DWARF read error: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/fncall.go","lineNumber":613,"sourceCode":"\t\tvar err error\n\t\tformalArgVar, err = extractVarInfoFromEntry(scope.target, formalScope.BinInfo, formalScope.image(), formalScope.Regs, formalScope.Mem, formalArg.dwarfEntry, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tformalArgVar = newVariable(formalArg.name, uint64(formalArg.off+formalScope.Regs.CFA), formalArg.typ, scope.BinInfo, scope.Mem)\n\t}\n\tif err := scope.setValue(formalArgVar, actualArg, actualArg.Name); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc funcCallArgs(fn *Function, bi *BinaryInfo, includeRet bool) (argFrameSize int64, formalArgs []funcCallArg, err error) {\n\tdwarfTree, err := fn.cu.image.getDwarfTree(fn.offset)\n\tif err != nil {\n\t\treturn 0, nil, fmt.Errorf(\"DWARF read error: %v\", err)\n\t}\n\n\tif bi.regabi && fn.Optimized() {\n\t\tif runtimeWhitelist[fn.Name] {\n\t\t\truntimeOptimizedWorkaround(bi, fn.cu.image, dwarfTree)\n\t\t} else {\n\t\t\t// Debug info for function arguments on optimized functions is currently\n\t\t\t// too incomplete to attempt injecting calls to arbitrary optimized\n\t\t\t// functions.\n\t\t\t// Prior to regabi we could do this because the ABI was simple enough to\n\t\t\t// manually encode it in Delve.\n\t\t\t// Runtime.mallocgc is an exception, we specifically patch it's DIE to be\n\t\t\t// correct for call injection purposes.\n\t\t\treturn 0, nil, fmt.Errorf(\"can not call optimized function %s when regabi is in use\", fn.Name)\n\t\t}\n\t}\n\n\tvarEntries := reader.Variables(dwarfTree, fn.Entry, int(^uint(0)>>1), reader.VariablesSkipInlinedSubroutines)","sourceCodeStart":595,"sourceCodeEnd":631,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/fncall.go#L595-L631","documentation":"funcCallArgs needs the function's DWARF DIE tree to enumerate formal arguments and compute the argument frame size. If getDwarfTree(fn.offset) fails to read or parse the DIE, the underlying DWARF error is wrapped as 'DWARF read error'.","triggerScenarios":"Injecting a call to a function whose compile unit's DWARF data is missing, truncated, or unreadable at fn.offset — e.g. stripped binary sections, malformed DWARF, or a partially loaded image.","commonSituations":"Binaries stripped after linking (strip/objcopy), split/incremental builds with corrupted debug info, or reading a core/executable whose .debug_info section was removed.","solutions":["Rebuild the binary keeping DWARF sections (do not strip; use -gcflags=all=\"-N -l\" for debugging)","Verify .debug_info is present (readelf -S / objdump -h)","Reload the correct unstripped binary in the debug session"],"exampleFix":"// before\nstrip ./app && dlv exec ./app\ncall app.Foo() // DWARF read error\n// after\ndlv exec ./app  # keep unstripped binary\ncall app.Foo()","handlingStrategy":"fallback","validationCode":"// check the binary keeps DWARF\n// readelf -S ./app | grep debug_info","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"DWARF read error\") {\n    // fall back to manual inspection (breakpoints, print) instead of calling\n}","preventionTips":["Never strip binaries used for debugging","Verify .debug_info sections exist before attaching"],"tags":["go","debugger","dwarf","call-injection"],"backgroundTag":"dwarf-read-error","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}