{"record":{"id":"dc7425c2699c6dba","repo":"go-delve/delve","slug":"could-not-dereference-s-v","errorCode":null,"errorMessage":"could not dereference %s: %v","messagePattern":"could not dereference (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/proc/stack_sigtramp.go","lineNumber":33,"sourceCode":"func (it *stackIterator) readSigtrampgoContext() (*op.DwarfRegisters, error) {\n\tlogger := logflags.DebuggerLogger()\n\tscope := FrameToScope(it.target, it.mem, it.g, 0, it.frame)\n\tbi := it.bi\n\n\tfindvar := func(name string) *Variable {\n\t\tvars, _ := scope.Locals(0, name)\n\t\tfor i := range vars {\n\t\t\tif vars[i].Name == name {\n\t\t\t\treturn vars[i]\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\tderef := func(v *Variable) (uint64, error) {\n\t\tv.loadValue(loadSingleValue)\n\t\tif v.Unreadable != nil {\n\t\t\treturn 0, fmt.Errorf(\"could not dereference %s: %v\", v.Name, v.Unreadable)\n\t\t}\n\t\tif len(v.Children) < 1 {\n\t\t\treturn 0, fmt.Errorf(\"could not dereference %s (no children?)\", v.Name)\n\t\t}\n\t\tlogger.Debugf(\"%s address is %#x\", v.Name, v.Children[0].Addr)\n\t\treturn v.Children[0].Addr, nil\n\t}\n\n\tgetctxaddr := func() (uint64, error) {\n\t\tctxvar := findvar(\"ctx\")\n\t\tif ctxvar == nil {\n\t\t\treturn 0, errors.New(\"ctx variable not found\")\n\t\t}\n\t\taddr, err := deref(ctxvar)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\treturn addr, nil","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/stack_sigtramp.go#L15-L51","documentation":"Delve fails to dereference the 'ctx' (or Windows 'ep') variable while unwinding a stack frame inside runtime.sigtrampgo (the signal handler trampoline). The variable's value could not be loaded from the target process memory (v.Unreadable was set), so the signal context address cannot be recovered and the frame cannot be described.","triggerScenarios":"Raised by the deref closure in readSigtrampgoContext when v.loadValue(loadSingleValue) sets Variable.Unreadable — i.e. reading the pointer variable's memory from the debuggee failed while unwinding a signal frame via sigtrampgo.","commonSituations":"Debugging a process that received/received-and-handled a signal; the stack contains a sigtrampgo frame and the ctx pointer's memory is unreadable (unmapped address, core dump missing that memory region, corrupt DWARF info for the Go runtime, or mismatched Go version producing wrong variable layout).","solutions":["Upgrade or downgrade Delve to a version matching the debugged Go runtime version (runtime variable layout changes break sigtrampgo unwinding)","If debugging a core dump, verify the core includes the memory region holding the signal context (full core, not truncated)","Retry the stack operation; transient memory-read failures (process briefly gone on Linux) may resolve","Check `dlv version` and the Go version used to build the target; report a mismatch as a Delve issue with the Go version and GOOS/GOARCH"],"exampleFix":"// before\n// unwinding fails: could not dereference ctx: <unreadable>\n// after\n// install a delve build that supports the target's Go version\ngo install github.com/go-delve/delve/cmd/dlv@latest","handlingStrategy":"try-catch","validationCode":"// Delve internal: before deref, confirm variable loaded cleanly\nv.loadValue(loadSingleValue)\nif v.Unreadable != nil {\n    // skip sigtrampgo unwinding for this frame\n}","typeGuard":"func derefable(v *Variable) bool {\n    v.loadValue(loadSingleValue)\n    return v.Unreadable == nil && len(v.Children) >= 1\n}","tryCatchPattern":"regs, err := it.readSigtrampgoContext()\nif err != nil {\n    // degrade gracefully: fall back to generic frame description\n    return it.frame, nil // or log and continue unwinding\n}","preventionTips":["Keep Delve version in sync with the Go version of the debuggee","Do not strip DWARF info (-w/-s) from binaries you intend to debug","When using core dumps, capture full cores (ulimit -c unlimited)","Log and continue instead of failing the whole stack unwind on signal frames"],"tags":["delve","debugger","signal-handling","stack-unwinding","memory-read"],"backgroundTag":"sigtrampgo-context-unreadable","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}