Skip to content

Commit 3a58168

Browse files
labathflovent
authored andcommitted
[lldb/DWARF] Resolve type unit references in llvm DWARFDIE compatibility wrappers (llvm#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.
1 parent 7a356c9 commit 3a58168

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -622,12 +622,12 @@ std::optional<uint64_t> DWARFDIE::getLanguage() const {
622622
}
623623

624624
DWARFDIE DWARFDIE::resolveReferencedType(dw_attr_t attr) const {
625-
return GetReferencedDIE(attr);
625+
return GetReferencedDIE(attr).resolveTypeUnitReference();
626626
}
627627

628628
DWARFDIE DWARFDIE::resolveReferencedType(DWARFFormValue v) const {
629629
if (IsValid())
630-
return v.Reference();
630+
return v.Reference().resolveTypeUnitReference();
631631
return {};
632632
}
633633

lldb/test/Shell/SymbolFile/DWARF/x86/simplified-template-names.cpp

+17-3
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,23 @@
1111
// Test that we following DW_AT_signature correctly. If not, lldb might confuse the types of v1 and v2.
1212
// RUN: %clangxx --target=x86_64-pc-linux -g -gsimple-template-names -fdebug-types-section %s -c -o %t2.o
1313
// RUN: ld.lld %t2.o -o %t2
14-
// RUN: %lldb %t2 -o "target variable v1 v2" -o exit | FileCheck %s --check-prefix=TYPE
14+
// RUN: %lldb %t2 -o "target variable v1 v2" \
15+
// RUN: -o "type lookup t2<outer_struct1>" -o "type lookup t2<outer_struct2>" \
16+
// RUN: -o exit | FileCheck %s --check-prefix=TYPE
1517

1618
// LOG: unique name: t3<t2<int> >::t4
1719

18-
// TYPE: (t2<outer_struct1::t1<int> >) v1 = {}
19-
// TYPE-NEXT: (t2<outer_struct2::t1<int> >) v2 = {}
20+
// TYPE-LABEL: target variable v1 v2
21+
// TYPE: (t2<outer_struct1::t1<int> >) v1 = {}
22+
// TYPE: (t2<outer_struct2::t1<int> >) v2 = {}
23+
24+
// TYPE-LABEL: type lookup t2<outer_struct1>
25+
// TYPE: template<> struct t2<outer_struct1> {
26+
// TYPE-NEXT: }
27+
28+
// TYPE-LABEL: type lookup t2<outer_struct2>
29+
// TYPE: template<> struct t2<outer_struct2> {
30+
// TYPE-NEXT: }
2031

2132
struct outer_struct1 {
2233
template <typename> struct t1 {};
@@ -30,6 +41,9 @@ template <typename> struct t2 {};
3041
t2<outer_struct1::t1<int>> v1;
3142
t2<outer_struct2::t1<int>> v2;
3243

44+
t2<outer_struct1> v1_1;
45+
t2<outer_struct2> v1_2;
46+
3347
template <typename> struct t3 {
3448
struct t4 {};
3549
};

0 commit comments

Comments
 (0)