[PATCH] D147270: [DebugInfo] Support more than 2 operands in DWARF operations

Scott Linder via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 16 08:43:44 PDT 2023


scott.linder added a comment.

In D147270#4337447 <https://reviews.llvm.org/D147270#4337447>, @CarlosAlbertoEnciso wrote:

> In D147270#4327735 <https://reviews.llvm.org/D147270#4327735>, @scott.linder wrote:
>
>> Is there a good target you have in mind for the benchmark? I seem to hit an assertion when dogfooding RelWithDebInfo binaries:
>>
>>   $ build/bin/llvm-debuginfo-analyzer --print=symbols build-relwithdebinfo/bin/llvm-tblgen
>>   llvm-debuginfo-analyzer: /home/slinder1/llvm-project/main/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSymbol.h:102: virtual v
>>   oid llvm::logicalview::LVSymbol::setReference(llvm::logicalview::LVElement *): Assertion `(!Element || isa<LVSymbol>(Element)) &
>>   & "Invalid element"' failed.
>>   
>>   I've also tried `llc`, `clang`, and `llvm-debuginfo-analyzer` itself, all hit the same assert. Is there something I might be doing wrong on my end?
>
> Sorry for my delay in answering but I was at the LLVM Euro 2023. Your command line is correct.
>
> At Sony, we have managed to reproduce the same issue with a debug/checking build on a private project.

Thank you for confirming!

I did a little digging and it seems like there is a faulty assumption in `LVELFReader`:

  // We are assuming that DW_AT_specification, DW_AT_abstract_origin,
  // DW_AT_type and DW_AT_extension do not appear at the same time
  // in the same DIE.

This seems true for GCC, but not for Clang, at least for the simplest reproducer I could create:

  $ cat a.cpp
  struct S {
      static const int Arr[];
  };
  const int S::Arr[] = {
      0, 1, 2
  };
  $ gcc -g -c a.cpp -o a.o
  $ build/bin/llvm-dwarfdump --debug-info a.o | grep -B1 -A2 DW_AT_specification
  0x00000053:   DW_TAG_variable
                  DW_AT_specification     (0x00000028 "Arr")
                  DW_AT_decl_line (4)
                  DW_AT_decl_column       (0x0b)
  $ clang++ -g -c a.cpp -o a.o
  $ build/bin/llvm-dwarfdump --debug-info a.o | grep -B1 -A2 DW_AT_specification
  0x0000001e:   DW_TAG_variable
                  DW_AT_specification     (0x0000003e "Arr")
                  DW_AT_type      (0x00000068 "const int[3]")
                  DW_AT_location  (DW_OP_addr 0x0)

It seems like the code could be adapted to track these independently, rather than assume only one is present? I can prepare a patch if that sounds reasonable to you!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147270/new/

https://reviews.llvm.org/D147270



More information about the llvm-commits mailing list