David Blaikie via llvm-dev
2019-Sep-27 18:13 UTC
[llvm-dev] debug locations that extend beyond their enclosing scope
Anyone seen these/have interest in fixing them - maybe even making the
DWARF verifier diagnose them?
Example:
$ cat scope.cpp
__attribute__((const)) int f1(int);
__attribute__((always_inline)) int f2(int a) {
return f1(a);
}
int func(bool b, int a){
if (b)
return f2(a);
return f2(a);
}
$ clang++-tot scope.cpp -g -O3 -c && llvm-dwarfdump-tot scope.o
...
DW_TAG_inlined_subroutine
DW_AT_abstract_origin (0x00000047 "_Z2f2i")
DW_AT_low_pc (0x0000000000000012)
DW_AT_high_pc (0x0000000000000017)
...
DW_TAG_formal_parameter
DW_AT_location (0x0000007c
[0x0000000000000010, 0x0000000000000012): DW_OP_reg4 RSI
[0x0000000000000012, 0x0000000000000017): DW_OP_reg5 RDI)
That first part of the location description looks like it's completely
unnecessary/unusable & once that's removed, then the second location
covers
the entire range of the enclosing scope and could use a direct location
description rather than indirecting through debug_loc/loclists.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20190927/2efe0d0e/attachment.html>
Alexey Lapshin via llvm-dev
2019-Sep-30 19:30 UTC
[llvm-dev] debug locations that extend beyond their enclosing scope
It looks like in this case not only extended range is the problem. That line : [0x0000000000000012, 0x0000000000000017): DW_OP_reg5 RDI) looks wrong since "a" is in the %rsi in fact. 27.09.2019 21:13, David Blaikie пишет:> Anyone seen these/have interest in fixing them - maybe even making the > DWARF verifier diagnose them? > > Example: > > $ cat scope.cpp > __attribute__((const)) int f1(int); > > __attribute__((always_inline)) int f2(int a) { > return f1(a); > } > > int func(bool b, int a){ > if (b) > return f2(a); > return f2(a); > } > $ clang++-tot scope.cpp -g -O3 -c && llvm-dwarfdump-tot scope.o > ... > DW_TAG_inlined_subroutine > DW_AT_abstract_origin (0x00000047 "_Z2f2i") > DW_AT_low_pc (0x0000000000000012) > DW_AT_high_pc (0x0000000000000017) > ... > > DW_TAG_formal_parameter > DW_AT_location (0x0000007c > [0x0000000000000010, 0x0000000000000012): DW_OP_reg4 RSI > [0x0000000000000012, 0x0000000000000017): DW_OP_reg5 RDI) > > That first part of the location description looks like it's completely > unnecessary/unusable & once that's removed, then the second location > covers the entire range of the enclosing scope and could use a direct > location description rather than indirecting through debug_loc/loclists.