[Lldb-commits] [lldb] 70b994b - [lldb/DWARF] Resolve type unit references in llvm DWARFDIE compatibility wrappers (#126902)

via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 13 00:05:22 PST 2025


Author: Pavel Labath
Date: 2025-02-13T09:05:19+01:00
New Revision: 70b994bcfaafadd649818d2a7f90f8f5989ec6c1

URL: https://github.com/llvm/llvm-project/commit/70b994bcfaafadd649818d2a7f90f8f5989ec6c1
DIFF: https://github.com/llvm/llvm-project/commit/70b994bcfaafadd649818d2a7f90f8f5989ec6c1.diff

LOG: [lldb/DWARF] Resolve type unit references in llvm DWARFDIE compatibility wrappers (#126902)

The llvm versions of these functions do that, so we must to so as well.
Practically this meant that were were unable to correctly un-simplify
the names of some types when using type units, which resulted in type
lookup errors.

Added: 
    

Modified: 
    lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
    lldb/test/Shell/SymbolFile/DWARF/x86/simplified-template-names.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
index 1e2564cb22f25..0db230d0a8b56 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -622,12 +622,12 @@ std::optional<uint64_t> DWARFDIE::getLanguage() const {
 }
 
 DWARFDIE DWARFDIE::resolveReferencedType(dw_attr_t attr) const {
-  return GetReferencedDIE(attr);
+  return GetReferencedDIE(attr).resolveTypeUnitReference();
 }
 
 DWARFDIE DWARFDIE::resolveReferencedType(DWARFFormValue v) const {
   if (IsValid())
-    return v.Reference();
+    return v.Reference().resolveTypeUnitReference();
   return {};
 }
 

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/x86/simplified-template-names.cpp b/lldb/test/Shell/SymbolFile/DWARF/x86/simplified-template-names.cpp
index 328d6d2e16d59..ad5dfb6a6dded 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/simplified-template-names.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/simplified-template-names.cpp
@@ -11,12 +11,23 @@
 // Test that we following DW_AT_signature correctly. If not, lldb might confuse the types of v1 and v2.
 // RUN: %clangxx --target=x86_64-pc-linux -g -gsimple-template-names -fdebug-types-section %s -c -o %t2.o
 // RUN: ld.lld %t2.o -o %t2
-// RUN: %lldb %t2 -o "target variable v1 v2" -o exit | FileCheck %s --check-prefix=TYPE
+// RUN: %lldb %t2 -o "target variable v1 v2" \
+// RUN:   -o "type lookup t2<outer_struct1>" -o "type lookup t2<outer_struct2>" \
+// RUN:   -o exit | FileCheck %s --check-prefix=TYPE
 
 // LOG: unique name: t3<t2<int> >::t4
 
-// TYPE:      (t2<outer_struct1::t1<int> >) v1 = {}
-// TYPE-NEXT: (t2<outer_struct2::t1<int> >) v2 = {}
+// TYPE-LABEL: target variable v1 v2
+// TYPE:       (t2<outer_struct1::t1<int> >) v1 = {}
+// TYPE:       (t2<outer_struct2::t1<int> >) v2 = {}
+
+// TYPE-LABEL: type lookup t2<outer_struct1>
+// TYPE:       template<> struct t2<outer_struct1> {
+// TYPE-NEXT:  }
+
+// TYPE-LABEL: type lookup t2<outer_struct2>
+// TYPE:       template<> struct t2<outer_struct2> {
+// TYPE-NEXT:  }
 
 struct outer_struct1 {
   template <typename> struct t1 {};
@@ -30,6 +41,9 @@ template <typename> struct t2 {};
 t2<outer_struct1::t1<int>> v1;
 t2<outer_struct2::t1<int>> v2;
 
+t2<outer_struct1> v1_1;
+t2<outer_struct2> v1_2;
+
 template <typename> struct t3 {
   struct t4 {};
 };


        


More information about the lldb-commits mailing list