go-delve/delve · error
unsupported location expression for argument %s: %v
Error message
unsupported location expression for argument %s: %v
What it means
After successfully fetching the location program, Delve executes the DWARF stack program to compute the argument's CFA-relative offset. If ExecuteStackProgram itself errors (e.g. uses opcodes the evaluator doesn't implement), this error wraps the evaluation failure.
Source
Thrown at pkg/proc/fncall.go:694
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).
off = *pargFrameSize
off = alignAddr(off, typ.Align())
}
if e := off + typ.Size(); e > *pargFrameSize {View on GitHub (pinned to a23773e6c3)
Solutions
- Rebuild unoptimized so the compiler emits simple FB-relative argument locations
- Use a newer Delve version with broader DWARF expression support
- Avoid call injection on that function; use print/inspect instead
Defensive patterns
Strategy: fallback
Try / catch
if err != nil && strings.Contains(err.Error(), "unsupported location expression") {
// disable call injection for this target, use print instead
} Prevention
- Unoptimized builds emit simple FB-relative argument locations Delve can evaluate
- Keep Delve updated for wider DWARF opcode support
When it happens
Trigger: Old-ABI call injection where an argument's DW_AT_location expression contains unsupported DWARF opcodes or references registers/values unavailable in the synthetic DwarfRegisters context.
Common situations: Toolchain-generated complex location expressions (TLS-relative, indexed) that op.ExecuteStackProgram cannot evaluate with the synthetic CFA context used for argument layout.
Related errors
- could not get argument location of %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/f27309e660e30cc7.
Report an issue: GitHub.