[lldb] [llvm] [lldb][dwarf] Compute fully qualified names on simplified template names with DWARFTypePrinter (PR #112811)

Zequan Wu via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 7 11:56:30 PST 2024


================
@@ -0,0 +1,31 @@
+// Test lldb is able to compute the fully qualified names on templates with
+// -gsimple-template-names and -fdebug-types-section.
+
+// REQUIRES: lld
+
+// Test against logging to see if we print the fully qualified names correctly.
+// RUN: %clangxx --target=x86_64-pc-linux -g -gsimple-template-names %s -o %t
+// RUN: %lldb %t -o "log enable dwarf comp" -o "target variable v1 v2" -o exit | FileCheck %s --check-prefix=LOG
+
+// 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 -o %t
+// RUN: %lldb %t -o "target variable v1 v2" -o exit | FileCheck %s --check-prefix=TYPE
+
+// LOG: unique name: ::t2<outer_struct1::t1<int> >
+// LOG: unique name: ::t2<outer_struct2::t1<int> >
----------------
ZequanWu wrote:

I recalled why I added this extra logging. It's to test this [change](https://github.com/llvm/llvm-project/pull/112811/files#diff-5dd6736e4d6c38623630df16c4494c1a8b099716ee0f05c9af54b4bafb1d864eR1619-R1625) in `DWARFASTParserClang::GetUniqueTypeNameAndDeclaration`, which is outside the `DWARFTypePrinter`. Though the change shouldn't change the lldb's behaviour at all (as long as the names generated by this function is consistent and unambiguous, the unique dwarf ast type map will work properly), it will be good the internally used names are correctly generated. 

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


More information about the llvm-commits mailing list