{"record":{"id":"2e525031f7194cf7","repo":"go-delve/delve","slug":"could-not-get-argument-location-of-s-v","errorCode":null,"errorMessage":"could not get argument location of %s: %v","messagePattern":"could not get argument location of (.+?): (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/fncall.go","lineNumber":689,"sourceCode":"\t\t// TODO: Make this generic for other platforms.\n\t\targFrameSize = alignAddr(argFrameSize, 8)\n\t\targFrameSize += int64(bi.Arch.maxRegArgBytes)\n\t}\n\n\tsort.Slice(formalArgs, func(i, j int) bool {\n\t\treturn formalArgs[i].off < formalArgs[j].off\n\t})\n\n\treturn argFrameSize, formalArgs, nil\n}\n\nfunc funcCallArgOldABI(fn *Function, bi *BinaryInfo, entry reader.Variable, argname string, typ godwarf.Type, pargFrameSize *int64) (*funcCallArg, error) {\n\tconst CFA = 0x1000\n\tvar off int64\n\n\tlocprog, _, err := bi.locationExpr(entry, dwarf.AttrLocation, fn.Entry)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"could not get argument location of %s: %v\", argname, err)\n\t} else {\n\t\tvar pieces []op.Piece\n\t\toff, pieces, err = op.ExecuteStackProgram(op.DwarfRegisters{CFA: CFA, FrameBase: CFA}, locprog, bi.Arch.PtrSize(), nil)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"unsupported location expression for argument %s: %v\", argname, err)\n\t\t}\n\t\tif pieces != nil {\n\t\t\terr = fmt.Errorf(\"unsupported location expression for argument %s (uses DW_OP_piece)\", argname)\n\t\t}\n\t\toff -= CFA\n\t}\n\tif err != nil {\n\t\t// With Go version 1.12 or later we can trust that the arguments appear\n\t\t// in the same order as declared, which means we can calculate their\n\t\t// address automatically.\n\t\t// With this we can call optimized functions (which sometimes do not have\n\t\t// an argument address, due to a compiler bug) as well as runtime\n\t\t// functions (which are always optimized).","sourceCodeStart":671,"sourceCodeEnd":707,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/fncall.go#L671-L707","documentation":"For the old stack-based ABI, funcCallArgOldABI retrieves each argument's location expression from DWARF via bi.locationExpr. If that lookup fails (no location attribute, unreadable location program), the argument's stack offset cannot be determined and this wrapped error is returned.","triggerScenarios":"Injecting a call (old ABI, pre-regabi Go or non-regabi build) to a function whose formal parameter lacks a valid DW_AT_location expression in its DIE.","commonSituations":"Debugging binaries produced by toolchains with incomplete DWARF argument locations; optimized functions where arguments were register-allocated and have no stack location; cgo-generated code.","solutions":["Rebuild with optimizations disabled (-gcflags=all=\"-N -l\") so arguments have stack locations","Ensure the Go toolchain version produces complete DWARF for the target function","Fall back to inspecting instead of calling the function"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"argument location\") {\n    // fall back to inspecting the function result via breakpoints\n}","preventionTips":["Build unoptimized so arguments get simple stack locations","Prefer recent Go/Delve versions with complete DWARF argument info"],"tags":["go","debugger","dwarf","location-expression","call-injection"],"backgroundTag":"argument-location-unresolved","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}