Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand All @@ -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 {};
};
Expand Down