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

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 27 11:13:11 PDT 2019


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>


More information about the llvm-dev mailing list