[llvm-bugs] [Bug 44118] New: Incorrect DW_AT_location attribute for call site parameter entry
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Nov 22 07:35:39 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=44118
Bug ID: 44118
Summary: Incorrect DW_AT_location attribute for call site
parameter entry
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: DebugInfo
Assignee: unassignedbugs at nondot.org
Reporter: david.stenberg at ericsson.com
CC: jdevlieghere at apple.com, keith.walker at arm.com,
llvm-bugs at lists.llvm.org,
paul_robinson at playstation.sony.com
Reproduced on 3889ff82bf4057ead22dad91a89384ac20ebd557.
Compiling the following file:
extern void callee(int, int);
extern int a;
int caller(int e, long c) {
callee(c, a);
return e;
}
using:
clang --target=aarch64 -O1 -g -Xclang -femit-debug-entry-values -c location.c
yields the following call site parameter entry:
0x00000087: DW_TAG_GNU_call_site_parameter
DW_AT_location (DW_OP_reg8 W8)
DW_AT_GNU_call_site_value
(DW_OP_GNU_entry_value(DW_OP_reg1 W1))
As seen, the DW_AT_location attribute specifies W8, but as this is a call site
entry for the first parameter, it should be W0.
In this case the value is described by a chain of instructions:
bb.0.entry:
liveins: $w0, $x1, $lr, $x19
[...]
$x8 = ORRXrs $xzr, killed $x1, 0
[...]
$w0 = ORRWrs $wzr, killed $w8, 0, implicit $x8, debug-location !26
BL @callee, csr_aarch64_aapcs
At a quick glance, it seems that this code in collectCallSiteParameters() only
resolves one step of the chain, resulting in the location becoming incorrect:
// Emit the call site parameter's value as an entry value.
if (ShouldTryEmitEntryVals) {
// Create an expression where the register's entry value is used.
DIExpression *EntryExpr = DIExpression::get(
MF->getFunction().getContext(), {dwarf::DW_OP_LLVM_entry_value, 1});
for (auto RegEntry : ForwardedRegWorklist) {
unsigned FwdReg = RegEntry;
auto EntryValReg = RegsForEntryValues.find(RegEntry);
if (EntryValReg != RegsForEntryValues.end())
FwdReg = EntryValReg->second;
DbgValueLoc DbgLocVal(EntryExpr, MachineLocation(RegEntry));
DbgCallSiteParam CSParm(FwdReg, DbgLocVal);
Params.push_back(CSParm);
++NumCSParams;
}
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191122/03602c37/attachment-0001.html>
More information about the llvm-bugs
mailing list