[Lldb-commits] [lldb] [lldb] Recurse through DW_AT_signature when looking for attributes (PR #107241)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 5 03:57:31 PDT 2024


================
@@ -377,11 +378,6 @@ static void GetDeclContextImpl(DWARFDIE die,
       die = spec;
       continue;
     }
-    // To find the name of a type in a type unit, we must follow the signature.
-    if (DWARFDIE spec = die.GetReferencedDIE(DW_AT_signature)) {
----------------
labath wrote:

Because die.GetName() will now find the correct name on its own. And (unlike with DW_AT_specification) the correct context can be reconstructed by following the parent chain in the original dwarf unit. For nested structs like `Outer::Middle::Inner` we get something like this in the main dwarf unit:
```
0x00000029:   DW_TAG_structure_type
                DW_AT_declaration	(true)
                DW_AT_signature	(0xd351fbfc6a4cee7c) => points to Outer

0x00000032:     DW_TAG_structure_type
                  DW_AT_declaration	(true)
                  DW_AT_signature	(0x5f726fb54ccb6c95) => points to Outer::Middle

0x0000003b:       DW_TAG_structure_type
                    DW_AT_declaration	(true)
                    DW_AT_signature	(0xd3cee531644665ec) => points to Outer::Middle::Inner
```

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


More information about the lldb-commits mailing list