{"record":{"id":"456efff36c06a580","repo":"go-delve/delve","slug":"could-not-find-function-for-v","errorCode":null,"errorMessage":"could not find function for %#v","messagePattern":"could not find function for %#v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/variables.go","lineNumber":1989,"sourceCode":"\tif v.Unreadable != nil {\n\t\treturn\n\t}\n\tif v.closureAddr == 0 {\n\t\tv.Base = 0\n\t\tv.Value = constant.MakeString(\"\")\n\t\treturn\n\t}\n\n\tval, err := readUintRaw(v.mem, v.closureAddr, int64(v.bi.Arch.PtrSize()))\n\tif err != nil {\n\t\tv.Unreadable = err\n\t\treturn\n\t}\n\n\tv.Base = val\n\tfn := v.bi.PCToFunc(v.Base)\n\tif fn == nil {\n\t\tv.Unreadable = fmt.Errorf(\"could not find function for %#v\", v.Base)\n\t\treturn\n\t}\n\n\tv.Value = constant.MakeString(fn.Name)\n\tcst := fn.extra(v.bi).closureStructType\n\tv.Len = int64(len(cst.Field))\n\n\tif recurseLevel <= cfg.MaxVariableRecurse {\n\t\tv2 := v.newVariable(\"\", v.closureAddr, cst, v.mem)\n\t\tv2.loadValueInternal(recurseLevel, cfg)\n\t\tv.Children = v2.Children\n\t}\n}\n\n// funcvalAddr reads the address of the funcval contained in a function variable.\nfunc (v *Variable) funcvalAddr() uint64 {\n\tval, err := readUintRaw(v.mem, v.Addr, int64(v.bi.Arch.PtrSize()))\n\tif err != nil {","sourceCodeStart":1971,"sourceCodeEnd":2007,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/variables.go#L1971-L2007","documentation":"When loading a function-pointer/func value, Delve converts the target address to a function name via the binary info's PC-to-function map. If no function covers that address (fn == nil), the func value is marked unreadable.","triggerScenarios":"Printing a func variable or interface containing a func whose code address has no DWARF function entry: pointers into cgo code, assembly stubs without symbols, trampolines, or garbage/corrupted function pointers.","commonSituations":"Inspecting func values wrapping C function pointers in cgo programs; debugging binaries stripped of symbol/DWARF function tables; corrupted func values from type confusion bugs.","solutions":["Check whether the address belongs to C/assembly code: use 'disassemble' around the address or check with nm/objdump","If cgo, note Delve can only name Go functions; inspect the raw address and resolve the C symbol externally","Rebuild ensuring DWARF is emitted for all packages (no -w/-s flags)","If the pointer should be a Go func, investigate corruption (print surrounding memory / use watchpoints)"],"exampleFix":"// before\nprint myFuncVar   // could not find function for 0x7f3a00102040 (C code addr)\n// after: inspect address and resolve outside Delve\nprint *(*uintptr)(...)  // raw address\n// then: nm mybinary | grep <addr>\n","handlingStrategy":"validation","validationCode":"// Check the func target resolves before relying on the value\nfn := bi.PCToFunc(addr)\nif fn == nil { /* address is C/asm/invalid — resolve externally */ }","typeGuard":null,"tryCatchPattern":"v, err := dbg.EvalVariable(scope, \"fnVar\", cfg)\nif err == nil && v.Unreadable != nil && strings.Contains(v.Unreadable.Error(), \"could not find function\") {\n    // fall back to raw address inspection\n}","preventionTips":["Don't strip symbols/DWARF from debug binaries","Treat cgo function pointers as raw addresses, not Go funcs","Verify pointer integrity when func values look corrupted"],"tags":["delve","func","symbols","dwarf"],"backgroundTag":"symbol-not-found","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}