[llvm-dev] debug locations that extend beyond their enclosing scope

Alexey Lapshin via llvm-dev llvm-dev at lists.llvm.org
Mon Sep 30 12:30:39 PDT 2019


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.


More information about the llvm-dev mailing list