[Lldb-commits] [lldb] Improve performance of .debug_names lookups when DW_IDX_parent attributes are used (PR #91808)

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Tue May 21 08:29:38 PDT 2024


felipepiovezan wrote:

> I think #77696 is justification enough to add this check, but I don't think we should be implicating DW_IDX_parent_entries until we know how those came about. 

This is pretty much my point, the workaround is fine, but I don't think the source-code comment in this PR is. The suggestion provided LGTM.

My guess is that the examples Greg is encountering are just hitting the slowness of DWARF parsing through other code paths (anything that causes too many calls to "ProcessEntries", and IDX_parent addressed _one_ of those, @Michael137  was just asking me the other day if we can address some of the other queries as well).

> I believe we could add a debug_names entry for std::ios_base (and refer to it from the entry for std::ios_base::seekdir), as long as the ios_base entry was not present in any of the name tables.

Yup, this is very doable!

> I was not able to produce a DW_IDX_parent_entries referring to any kind of class type

When I compile the following with `clang++ test.cpp -c -gdwarf-5 -O0 -o - | dwarfdump --debug-names -`, I get the right parent chain. Is this not true when you try it?

```
namespace A { namespace B { struct State { class InnerState{}; }; } }
A::B::State::InnerState get_state() { return A::B::State::InnerState(); }
```

```
      String: 0x000000c4 "InnerState"
      Entry @ 0xbe {
        Abbrev: 0x138
        Tag: DW_TAG_class_type
        DW_IDX_die_offset: 0x0000003f
        DW_IDX_parent: Entry @ 0xde
      }
      String: 0x000000be "State"
      Entry @ 0xde {
        Abbrev: 0x9b8
        Tag: DW_TAG_structure_type
        DW_IDX_die_offset: 0x00000039
        DW_IDX_parent: Entry @ 0xe9
      }
      String: 0x000000bc "B"
      Entry @ 0xe9 {
        Abbrev: 0x1cb8
        Tag: DW_TAG_namespace
        DW_IDX_die_offset: 0x00000037
        DW_IDX_parent: Entry @ 0xd7
      }
      String: 0x000000ba "A"
      Entry @ 0xd7 {
        Abbrev: 0x1c98
        Tag: DW_TAG_namespace
        DW_IDX_die_offset: 0x00000035
        DW_IDX_parent: <parent not indexed>
      }
```

https://github.com/llvm/llvm-project/pull/91808


More information about the lldb-commits mailing list