https://bugs.llvm.org/show_bug.cgi?id=39710
Bug ID: 39710
Summary: Emission of DW_TAG_formal_parameter location is
inaccurate on Linux (with -O3)
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: DebugInfo
Assignee: unassignedb...@nondot.org
Reporter: dav...@freebsd.org
CC: apra...@apple.com, fr...@apple.com,
jdevliegh...@apple.com, keith.wal...@arm.com,
llvm-bugs@lists.llvm.org, r...@google.com,
v...@apple.com
There has been a lot of talking about about unrecoverable function arguments
for optimized builds, so I decided to give it a try to see if there's something
that could be done to improve.
Take the following test case:
__attribute__((noinline))
int fn1 (long int x, long int y, long int z) {
int l = x * 2;
int q = y * z;
return l + q;
}
__attribute__((noinline)) long int
fn2 (long int a, long int b, long int c)
{
long int q = 2 * a;
return fn1 (5, 6, 7);
}
int main(void) {
return fn2(14, 23, 34);
}
Build with -O3 -g. Set a breakpoint on fn1, and try to print the arguments
(e.g. through `frame var`).
You'll realize that you can recover them on a recent MacOS (Mojave), but you
can't on ubuntu 18.10.
I started looking a little bit into why this was the case, to immediately find
out the DWARF emission for the formal parameter differs on the two platforms.
Namely:
MacOS:
0x00000043: DW_TAG_formal_parameter
DW_AT_location (0x00000000
[0x0000000100000f70, 0x0000000100000f74): DW_OP_reg5 RDI
[0x0000000100000f74, 0x0000000100000f7c): DW_OP_reg5 RDI)
DW_AT_name ("x")
DW_AT_decl_file
("/Users/davide/llvm-monorepo/llvm-mono/build/bin/optout.c")
DW_AT_decl_line (2)
DW_AT_type (0x00000104 "long int")
Linux:
0x00000043: DW_TAG_formal_parameter
DW_AT_location (0x00000000)
DW_AT_name ("x")
DW_AT_decl_file ("/home/davide/optimized_code/./opt.c")
DW_AT_decl_line (2)
DW_AT_type (0x000000f1 "long int")
While the former contains a location list pointing at the register where the
debugger should retrieve the argument, the second one contains an empty
location list.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs