{"record":{"id":"f27309e660e30cc7","repo":"go-delve/delve","slug":"unsupported-location-expression-for-argument-s","errorCode":null,"errorMessage":"unsupported location expression for argument %s: %v","messagePattern":"unsupported location expression for argument (.+?): (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/fncall.go","lineNumber":694,"sourceCode":"\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).\n\t\toff = *pargFrameSize\n\t\toff = alignAddr(off, typ.Align())\n\t}\n\n\tif e := off + typ.Size(); e > *pargFrameSize {","sourceCodeStart":676,"sourceCodeEnd":712,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/fncall.go#L676-L712","documentation":"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.","triggerScenarios":"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.","commonSituations":"Toolchain-generated complex location expressions (TLS-relative, indexed) that op.ExecuteStackProgram cannot evaluate with the synthetic CFA context used for argument layout.","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"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"unsupported location expression\") {\n    // disable call injection for this target, use print instead\n}","preventionTips":["Unoptimized builds emit simple FB-relative argument locations Delve can evaluate","Keep Delve updated for wider DWARF opcode support"],"tags":["go","debugger","dwarf","location-expression","call-injection"],"backgroundTag":"unsupported-location-expression","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}