go-delve/delve · error
could not get argument location of %s: %v
Error message
could not get argument location of %s: %v
What it means
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.
Source
Thrown at pkg/proc/fncall.go:689
// TODO: Make this generic for other platforms.
argFrameSize = alignAddr(argFrameSize, 8)
argFrameSize += int64(bi.Arch.maxRegArgBytes)
}
sort.Slice(formalArgs, func(i, j int) bool {
return formalArgs[i].off < formalArgs[j].off
})
return argFrameSize, formalArgs, nil
}
func funcCallArgOldABI(fn *Function, bi *BinaryInfo, entry reader.Variable, argname string, typ godwarf.Type, pargFrameSize *int64) (*funcCallArg, error) {
const CFA = 0x1000
var off int64
locprog, _, err := bi.locationExpr(entry, dwarf.AttrLocation, fn.Entry)
if err != nil {
err = fmt.Errorf("could not get argument location of %s: %v", argname, err)
} else {
var pieces []op.Piece
off, pieces, err = op.ExecuteStackProgram(op.DwarfRegisters{CFA: CFA, FrameBase: CFA}, locprog, bi.Arch.PtrSize(), nil)
if err != nil {
err = fmt.Errorf("unsupported location expression for argument %s: %v", argname, err)
}
if pieces != nil {
err = fmt.Errorf("unsupported location expression for argument %s (uses DW_OP_piece)", argname)
}
off -= CFA
}
if err != nil {
// With Go version 1.12 or later we can trust that the arguments appear
// in the same order as declared, which means we can calculate their
// address automatically.
// With this we can call optimized functions (which sometimes do not have
// an argument address, due to a compiler bug) as well as runtime
// functions (which are always optimized).View on GitHub (pinned to a23773e6c3)
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
Defensive patterns
Strategy: fallback
Try / catch
if err != nil && strings.Contains(err.Error(), "argument location") {
// fall back to inspecting the function result via breakpoints
} Prevention
- Build unoptimized so arguments get simple stack locations
- Prefer recent Go/Delve versions with complete DWARF argument info
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- unsupported location expression for argument %s: %v
- could not find DIE for function %q
- DWARF read error: %v
- unsupported location expression for argument %s (uses DW_OP_
- unable to find function context
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/2e525031f7194cf7.
Report an issue: GitHub.