llvm-dwarfdump: Lookup type units when prettyprinting types
authorDavid Blaikie <dblaikie@gmail.com>
Wed, 10 Nov 2021 00:47:30 +0000 (16:47 -0800)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 10 Nov 2021 00:58:22 +0000 (16:58 -0800)
This handles DWARFv4 and DWARFv5 type units, but not Split DWARF type
units. That'll come in a follow-up patch.

cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp
llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
llvm/test/tools/llvm-dwarfdump/X86/prettyprint_type_units.s [new file with mode: 0644]

index 97b09d0..312229f 100644 (file)
@@ -1,4 +1,8 @@
-// RUN: %clang %target_itanium_abi_host_triple %s -c -o - -g -Xclang -gsimple-template-names=mangled -Xclang -debug-forward-template-params -std=c++20 \
+// RUN: %clang %target_itanium_abi_host_triple %s -c -o - -gdwarf-4 -Xclang -gsimple-template-names=mangled -Xclang -debug-forward-template-params -std=c++20 \
+// RUN:   | llvm-dwarfdump --verify -
+// RUN: %clang %target_itanium_abi_host_triple %s -c -o - -gdwarf-4 -Xclang -gsimple-template-names=mangled -Xclang -debug-forward-template-params -std=c++20 -fdebug-types-section \
+// RUN:   | llvm-dwarfdump --verify -
+// RUN: %clang %target_itanium_abi_host_triple %s -c -o - -gdwarf-5 -Xclang -gsimple-template-names=mangled -Xclang -debug-forward-template-params -std=c++20 -fdebug-types-section \
 // RUN:   | llvm-dwarfdump --verify -
 #include <cstdint>
 template<typename ...Ts>
index 353fbef..3ece8a1 100644 (file)
@@ -243,6 +243,7 @@ public:
   }
 
   DWARFCompileUnit *getDWOCompileUnitForHash(uint64_t Hash);
+  DWARFTypeUnit *getTypeUnitForHash(uint16_t Version, uint64_t Hash);
 
   /// Return the compile unit that includes an offset (relative to .debug_info).
   DWARFCompileUnit *getCompileUnitForOffset(uint64_t Offset);
index 290571b..8f93ebc 100644 (file)
@@ -182,6 +182,8 @@ public:
   DWARFDie getAttributeValueAsReferencedDie(dwarf::Attribute Attr) const;
   DWARFDie getAttributeValueAsReferencedDie(const DWARFFormValue &V) const;
 
+  DWARFDie resolveTypeUnitReference() const;
+
   /// Extract the range base attribute from this DIE as absolute section offset.
   ///
   /// This is a utility function that checks for either the DW_AT_rnglists_base
index b51e47b..188bc6b 100644 (file)
@@ -693,6 +693,27 @@ void DWARFContext::dump(
     getDebugNames().dump(OS);
 }
 
+DWARFTypeUnit *DWARFContext::getTypeUnitForHash(uint16_t Version,
+                                                uint64_t Hash) {
+  // FIXME: Include support for Split DWARF here
+  parseNormalUnits();
+
+  auto IsTypeWithHash = [&](const std::unique_ptr<DWARFUnit> &Unit) {
+    DWARFTypeUnit *TU = dyn_cast<DWARFTypeUnit>(Unit.get());
+    if (!TU)
+      return false;
+    return TU->getTypeHash() == Hash;
+  };
+  auto I = llvm::find_if(types_section_units(), IsTypeWithHash);
+  if (I != types_section_units().end())
+    return cast<DWARFTypeUnit>(I->get());
+  // Search normal .debug_info units in case it's a DWARFv5 type unit.
+  I = llvm::find_if(normal_units(), IsTypeWithHash);
+  if (I != types_section_units().end())
+    return cast<DWARFTypeUnit>(I->get());
+  return nullptr;
+}
+
 DWARFCompileUnit *DWARFContext::getDWOCompileUnitForHash(uint64_t Hash) {
   parseDWOUnits(LazyParse);
 
index 525a308..8be8f6a 100644 (file)
@@ -108,6 +108,14 @@ static void dumpLocationExpr(raw_ostream &OS, const DWARFFormValue &FormValue,
   return;
 }
 
+static DWARFDie resolveReferencedType(DWARFDie D,
+                                      dwarf::Attribute Attr = DW_AT_type) {
+  return D.getAttributeValueAsReferencedDie(Attr).resolveTypeUnitReference();
+}
+static DWARFDie resolveReferencedType(DWARFDie D, DWARFFormValue F) {
+  return D.getAttributeValueAsReferencedDie(F).resolveTypeUnitReference();
+}
+
 namespace {
 
 // FIXME: We should have pretty printers per language. Currently we print
@@ -181,7 +189,7 @@ struct DWARFTypePrinter {
   DWARFDie skipQualifiers(DWARFDie D) {
     while (D && (D.getTag() == DW_TAG_const_type ||
                  D.getTag() == DW_TAG_volatile_type))
-      D = D.getAttributeValueAsReferencedDie(DW_AT_type);
+      D = resolveReferencedType(D);
     return D;
   }
 
@@ -209,7 +217,7 @@ struct DWARFTypePrinter {
       OS << "void";
       return DWARFDie();
     }
-    DWARFDie Inner = D.getAttributeValueAsReferencedDie(DW_AT_type);
+    DWARFDie Inner = resolveReferencedType(D);
     const dwarf::Tag T = D.getTag();
     switch (T) {
     case DW_TAG_pointer_type: {
@@ -240,8 +248,7 @@ struct DWARFTypePrinter {
         OS << '(';
       else if (Word)
         OS << ' ';
-      if (DWARFDie Cont =
-              D.getAttributeValueAsReferencedDie(DW_AT_containing_type)) {
+      if (DWARFDie Cont = resolveReferencedType(D, DW_AT_containing_type)) {
         appendQualifiedName(Cont);
         OS << "::";
       }
@@ -339,10 +346,9 @@ struct DWARFTypePrinter {
     case DW_TAG_pointer_type: {
       if (needsParens(Inner))
         OS << ')';
-      appendUnqualifiedNameAfter(
-          Inner, Inner.getAttributeValueAsReferencedDie(DW_AT_type),
-          /*SkipFirstParamIfArtificial=*/D.getTag() ==
-              DW_TAG_ptr_to_member_type);
+      appendUnqualifiedNameAfter(Inner, resolveReferencedType(Inner),
+                                 /*SkipFirstParamIfArtificial=*/D.getTag() ==
+                                     DW_TAG_ptr_to_member_type);
       break;
     }
       /*
@@ -387,7 +393,7 @@ struct DWARFTypePrinter {
         appendTemplateParameters(C, FirstParameter);
       }
       if (C.getTag() == dwarf::DW_TAG_template_value_parameter) {
-        DWARFDie T = C.getAttributeValueAsReferencedDie(DW_AT_type);
+        DWARFDie T = resolveReferencedType(C);
         Sep();
         if (T.getTag() == DW_TAG_enumeration_type) {
           auto V = C.find(DW_AT_const_value);
@@ -523,9 +529,8 @@ struct DWARFTypePrinter {
         continue;
       auto TypeAttr = C.find(DW_AT_type);
       Sep();
-      appendQualifiedName(TypeAttr
-                              ? C.getAttributeValueAsReferencedDie(*TypeAttr)
-                              : DWARFDie());
+      appendQualifiedName(TypeAttr ? resolveReferencedType(C, *TypeAttr)
+                                   : DWARFDie());
     }
     if (IsTemplate && *FirstParameter && FirstParameter == &FirstParameterValue)
       OS << '<';
@@ -534,15 +539,15 @@ struct DWARFTypePrinter {
   void decomposeConstVolatile(DWARFDie &N, DWARFDie &T, DWARFDie &C,
                               DWARFDie &V) {
     (N.getTag() == DW_TAG_const_type ? C : V) = N;
-    T = N.getAttributeValueAsReferencedDie(DW_AT_type);
+    T = resolveReferencedType(N);
     if (T) {
       auto Tag = T.getTag();
       if (Tag == DW_TAG_const_type) {
         C = T;
-        T = T.getAttributeValueAsReferencedDie(DW_AT_type);
+        T = resolveReferencedType(T);
       } else if (Tag == DW_TAG_volatile_type) {
         V = T;
-        T = T.getAttributeValueAsReferencedDie(DW_AT_type);
+        T = resolveReferencedType(T);
       }
     }
   }
@@ -552,12 +557,10 @@ struct DWARFTypePrinter {
     DWARFDie T;
     decomposeConstVolatile(N, T, C, V);
     if (T && T.getTag() == DW_TAG_subroutine_type)
-      appendSubroutineNameAfter(T,
-                                T.getAttributeValueAsReferencedDie(DW_AT_type),
-                                false, C.isValid(), V.isValid());
+      appendSubroutineNameAfter(T, resolveReferencedType(T), false, C.isValid(),
+                                V.isValid());
     else
-      appendUnqualifiedNameAfter(
-          T, T.getAttributeValueAsReferencedDie(DW_AT_type));
+      appendUnqualifiedNameAfter(T, resolveReferencedType(T));
   }
   void appendConstVolatileQualifierBefore(DWARFDie N) {
     DWARFDie C;
@@ -567,7 +570,7 @@ struct DWARFTypePrinter {
     bool Subroutine = T && T.getTag() == DW_TAG_subroutine_type;
     DWARFDie A = T;
     while (A && A.getTag() == DW_TAG_array_type)
-      A = A.getAttributeValueAsReferencedDie(DW_AT_type);
+      A = resolveReferencedType(A);
     bool Leading =
         (!A || (A.getTag() != DW_TAG_pointer_type &&
                 A.getTag() != llvm::dwarf::DW_TAG_ptr_to_member_type)) &&
@@ -611,7 +614,7 @@ struct DWARFTypePrinter {
     for (DWARFDie P : D) {
       if (P.getTag() != DW_TAG_formal_parameter)
         return;
-      DWARFDie T = P.getAttributeValueAsReferencedDie(DW_AT_type);
+      DWARFDie T = resolveReferencedType(P);
       if (SkipFirstParamIfArtificial && RealFirst && P.find(DW_AT_artificial)) {
         FirstParamIfArtificial = T;
         RealFirst = false;
@@ -631,7 +634,7 @@ struct DWARFTypePrinter {
           DWARFDie C;
           DWARFDie V;
           auto CVStep = [&](DWARFDie CV) {
-            if (DWARFDie U = CV.getAttributeValueAsReferencedDie(DW_AT_type)) {
+            if (DWARFDie U = resolveReferencedType(CV)) {
               if (U.getTag() == DW_TAG_const_type)
                 return C = U;
               if (U.getTag() == DW_TAG_volatile_type)
@@ -658,8 +661,7 @@ struct DWARFTypePrinter {
       OS << " &";
     if (D.find(DW_AT_rvalue_reference))
       OS << " &&";
-    appendUnqualifiedNameAfter(
-        Inner, Inner.getAttributeValueAsReferencedDie(DW_AT_type));
+    appendUnqualifiedNameAfter(Inner, resolveReferencedType(Inner));
   }
   void appendScopes(DWARFDie D) {
     if (D.getTag() == DW_TAG_compile_unit)
@@ -670,6 +672,7 @@ struct DWARFTypePrinter {
       return;
     if (D.getTag() == DW_TAG_subprogram)
       return;
+    D = D.resolveTypeUnitReference();
     if (DWARFDie P = D.getParent())
       appendScopes(P);
     appendUnqualifiedName(D);
@@ -761,7 +764,7 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
                 DINameKind::LinkageName))
       OS << Space << "\"" << Name << '\"';
   } else if (Attr == DW_AT_type) {
-    DWARFDie D = Die.getAttributeValueAsReferencedDie(FormValue);
+    DWARFDie D = resolveReferencedType(Die, FormValue);
     if (D && !D.isNULL()) {
       OS << Space << "\"";
       DWARFTypePrinter(OS).appendQualifiedName(D);
@@ -873,13 +876,27 @@ DWARFDie::getAttributeValueAsReferencedDie(dwarf::Attribute Attr) const {
 
 DWARFDie
 DWARFDie::getAttributeValueAsReferencedDie(const DWARFFormValue &V) const {
+  DWARFDie Result;
   if (auto SpecRef = V.getAsRelativeReference()) {
     if (SpecRef->Unit)
-      return SpecRef->Unit->getDIEForOffset(SpecRef->Unit->getOffset() + SpecRef->Offset);
-    if (auto SpecUnit = U->getUnitVector().getUnitForOffset(SpecRef->Offset))
-      return SpecUnit->getDIEForOffset(SpecRef->Offset);
+      Result = SpecRef->Unit->getDIEForOffset(SpecRef->Unit->getOffset() +
+                                              SpecRef->Offset);
+    else if (auto SpecUnit =
+                 U->getUnitVector().getUnitForOffset(SpecRef->Offset))
+      Result = SpecUnit->getDIEForOffset(SpecRef->Offset);
   }
-  return DWARFDie();
+  return Result;
+}
+
+DWARFDie DWARFDie::resolveTypeUnitReference() const {
+  if (auto Attr = find(DW_AT_signature)) {
+    if (Optional<uint64_t> Sig = Attr->getAsReferenceUVal()) {
+      if (DWARFTypeUnit *TU =
+              U->getContext().getTypeUnitForHash(U->getVersion(), *Sig))
+        return TU->getDIEForOffset(TU->getTypeOffset() + TU->getOffset());
+    }
+  }
+  return *this;
 }
 
 Optional<uint64_t> DWARFDie::getRangesBaseAttribute() const {
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/prettyprint_type_units.s b/llvm/test/tools/llvm-dwarfdump/X86/prettyprint_type_units.s
new file mode 100644 (file)
index 0000000..3b19fda
--- /dev/null
@@ -0,0 +1,403 @@
+# RUN: llvm-mc < %s -filetype obj -triple x86_64 -o - \
+# RUN:   | llvm-dwarfdump - | FileCheck %s
+
+# Significantly modified assembly generated from this source:
+#
+# struct t1 { };
+# struct t2 { };
+# template<typename ...T>
+# void f1() { }
+# int main() {
+#   f1<t1, t2>();
+# }
+#
+# $ clang++-tot test.cpp -g -S -fdebug-types-section -gdwarf-5 -o test.5.s -fstandalone-debug
+#
+# I inserted a DWARFv4 copy of the first type unit ("t1") to replace the
+# DWARFv5 type unit - to test both v4 and v5 type unit support.  This test
+# doesn't really need templates - two local variables would've sufficed
+# (anything that references the type units) but I was working on something else
+# and this seemed minimal enough.
+
+
+# CHECK: DW_TAG_template_type_parameter
+# CHECK:   DW_AT_type (0x00000058 "t1")
+# CHECK: DW_TAG_template_type_parameter
+# CHECK:   DW_AT_type (0x00000061 "t2")
+
+       .text
+       .file   "test.cpp"
+       .globl  main                            # -- Begin function main
+       .p2align        4, 0x90
+       .type   main,@function
+main:                                   # @main
+.Lfunc_begin0:
+       .file   0 "/usr/local/google/home/blaikie/dev/scratch" "test.cpp" md5 0xafee1e55f64a0b86063fa85c8c456dba
+       .loc    0 5 0                           # test.cpp:5:0
+       .cfi_startproc
+# %bb.0:                                # %entry
+       pushq   %rbp
+       .cfi_def_cfa_offset 16
+       .cfi_offset %rbp, -16
+       movq    %rsp, %rbp
+       .cfi_def_cfa_register %rbp
+.Ltmp0:
+       .loc    0 6 3 prologue_end              # test.cpp:6:3
+       callq   _Z2f1IJ2t12t2EEvv
+       .loc    0 7 1                           # test.cpp:7:1
+       xorl    %eax, %eax
+       popq    %rbp
+       .cfi_def_cfa %rsp, 8
+       retq
+.Ltmp1:
+.Lfunc_end0:
+       .size   main, .Lfunc_end0-main
+       .cfi_endproc
+                                        # -- End function
+       .section        .text._Z2f1IJ2t12t2EEvv,"axG",@progbits,_Z2f1IJ2t12t2EEvv,comdat
+       .weak   _Z2f1IJ2t12t2EEvv               # -- Begin function _Z2f1IJ2t12t2EEvv
+       .p2align        4, 0x90
+       .type   _Z2f1IJ2t12t2EEvv,@function
+_Z2f1IJ2t12t2EEvv:                      # @_Z2f1IJ2t12t2EEvv
+.Lfunc_begin1:
+       .loc    0 4 0                           # test.cpp:4:0
+       .cfi_startproc
+# %bb.0:                                # %entry
+       pushq   %rbp
+       .cfi_def_cfa_offset 16
+       .cfi_offset %rbp, -16
+       movq    %rsp, %rbp
+       .cfi_def_cfa_register %rbp
+.Ltmp2:
+       .loc    0 4 13 prologue_end             # test.cpp:4:13
+       popq    %rbp
+       .cfi_def_cfa %rsp, 8
+       retq
+.Ltmp3:
+.Lfunc_end1:
+       .size   _Z2f1IJ2t12t2EEvv, .Lfunc_end1-_Z2f1IJ2t12t2EEvv
+       .cfi_endproc
+                                        # -- End function
+       .section        .debug_types,"G",@progbits,14297044602779165170,comdat
+       .long   .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+.Ldebug_info_start0:
+       .short  4                               # DWARF version number
+       .long   .debug_abbrev                   # Offset Into Abbrev. Section
+       .byte   8                               # Address Size (in bytes)
+       .quad   -4149699470930386446            # Type Signature
+       .long   30                              # Type DIE Offset
+       .byte   10                              # Abbrev [1] 0x17:0x11 DW_TAG_type_unit
+       .short  33                              # DW_AT_language
+       .long   .Lline_table_start0             # DW_AT_stmt_list
+       .byte   11                              # Abbrev [2] 0x1e:0x9 DW_TAG_structure_type
+       .byte   5                               # DW_AT_calling_convention
+       .long   .Linfo_string6                  # DW_AT_name
+       .byte   1                               # DW_AT_byte_size
+       .byte   1                               # DW_AT_decl_file
+       .byte   1                               # DW_AT_decl_line
+       .byte   0                               # End Of Children Mark
+.Ldebug_info_end0:
+       .section        .debug_info,"G",@progbits,5649318945901130368,comdat
+       .long   .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit
+.Ldebug_info_start1:
+       .short  5                               # DWARF version number
+       .byte   2                               # DWARF Unit Type
+       .byte   8                               # Address Size (in bytes)
+       .long   .debug_abbrev                   # Offset Into Abbrev. Section
+       .quad   5649318945901130368             # Type Signature
+       .long   35                              # Type DIE Offset
+       .byte   1                               # Abbrev [1] 0x18:0x12 DW_TAG_type_unit
+       .short  33                              # DW_AT_language
+       .long   .Lline_table_start0             # DW_AT_stmt_list
+       .long   .Lstr_offsets_base0             # DW_AT_str_offsets_base
+       .byte   2                               # Abbrev [2] 0x23:0x6 DW_TAG_structure_type
+       .byte   5                               # DW_AT_calling_convention
+       .byte   7                               # DW_AT_name
+       .byte   1                               # DW_AT_byte_size
+       .byte   0                               # DW_AT_decl_file
+       .byte   2                               # DW_AT_decl_line
+       .byte   0                               # End Of Children Mark
+.Ldebug_info_end1:
+       .section        .debug_abbrev,"",@progbits
+       .byte   1                               # Abbreviation Code
+       .byte   65                              # DW_TAG_type_unit
+       .byte   1                               # DW_CHILDREN_yes
+       .byte   19                              # DW_AT_language
+       .byte   5                               # DW_FORM_data2
+       .byte   16                              # DW_AT_stmt_list
+       .byte   23                              # DW_FORM_sec_offset
+       .byte   114                             # DW_AT_str_offsets_base
+       .byte   23                              # DW_FORM_sec_offset
+       .byte   0                               # EOM(1)
+       .byte   0                               # EOM(2)
+       .byte   2                               # Abbreviation Code
+       .byte   19                              # DW_TAG_structure_type
+       .byte   0                               # DW_CHILDREN_no
+       .byte   54                              # DW_AT_calling_convention
+       .byte   11                              # DW_FORM_data1
+       .byte   3                               # DW_AT_name
+       .byte   37                              # DW_FORM_strx1
+       .byte   11                              # DW_AT_byte_size
+       .byte   11                              # DW_FORM_data1
+       .byte   58                              # DW_AT_decl_file
+       .byte   11                              # DW_FORM_data1
+       .byte   59                              # DW_AT_decl_line
+       .byte   11                              # DW_FORM_data1
+       .byte   0                               # EOM(1)
+       .byte   0                               # EOM(2)
+       .byte   3                               # Abbreviation Code
+       .byte   17                              # DW_TAG_compile_unit
+       .byte   1                               # DW_CHILDREN_yes
+       .byte   37                              # DW_AT_producer
+       .byte   37                              # DW_FORM_strx1
+       .byte   19                              # DW_AT_language
+       .byte   5                               # DW_FORM_data2
+       .byte   3                               # DW_AT_name
+       .byte   37                              # DW_FORM_strx1
+       .byte   114                             # DW_AT_str_offsets_base
+       .byte   23                              # DW_FORM_sec_offset
+       .byte   16                              # DW_AT_stmt_list
+       .byte   23                              # DW_FORM_sec_offset
+       .byte   27                              # DW_AT_comp_dir
+       .byte   37                              # DW_FORM_strx1
+       .byte   17                              # DW_AT_low_pc
+       .byte   1                               # DW_FORM_addr
+       .byte   85                              # DW_AT_ranges
+       .byte   35                              # DW_FORM_rnglistx
+       .byte   115                             # DW_AT_addr_base
+       .byte   23                              # DW_FORM_sec_offset
+       .byte   116                             # DW_AT_rnglists_base
+       .byte   23                              # DW_FORM_sec_offset
+       .byte   0                               # EOM(1)
+       .byte   0                               # EOM(2)
+       .byte   4                               # Abbreviation Code
+       .byte   46                              # DW_TAG_subprogram
+       .byte   0                               # DW_CHILDREN_no
+       .byte   17                              # DW_AT_low_pc
+       .byte   27                              # DW_FORM_addrx
+       .byte   18                              # DW_AT_high_pc
+       .byte   6                               # DW_FORM_data4
+       .byte   64                              # DW_AT_frame_base
+       .byte   24                              # DW_FORM_exprloc
+       .byte   3                               # DW_AT_name
+       .byte   37                              # DW_FORM_strx1
+       .byte   58                              # DW_AT_decl_file
+       .byte   11                              # DW_FORM_data1
+       .byte   59                              # DW_AT_decl_line
+       .byte   11                              # DW_FORM_data1
+       .byte   73                              # DW_AT_type
+       .byte   19                              # DW_FORM_ref4
+       .byte   63                              # DW_AT_external
+       .byte   25                              # DW_FORM_flag_present
+       .byte   0                               # EOM(1)
+       .byte   0                               # EOM(2)
+       .byte   5                               # Abbreviation Code
+       .byte   46                              # DW_TAG_subprogram
+       .byte   1                               # DW_CHILDREN_yes
+       .byte   17                              # DW_AT_low_pc
+       .byte   27                              # DW_FORM_addrx
+       .byte   18                              # DW_AT_high_pc
+       .byte   6                               # DW_FORM_data4
+       .byte   64                              # DW_AT_frame_base
+       .byte   24                              # DW_FORM_exprloc
+       .byte   110                             # DW_AT_linkage_name
+       .byte   37                              # DW_FORM_strx1
+       .byte   3                               # DW_AT_name
+       .byte   37                              # DW_FORM_strx1
+       .byte   58                              # DW_AT_decl_file
+       .byte   11                              # DW_FORM_data1
+       .byte   59                              # DW_AT_decl_line
+       .byte   11                              # DW_FORM_data1
+       .byte   63                              # DW_AT_external
+       .byte   25                              # DW_FORM_flag_present
+       .byte   0                               # EOM(1)
+       .byte   0                               # EOM(2)
+       .byte   6                               # Abbreviation Code
+       .ascii  "\207\202\001"                  # DW_TAG_GNU_template_parameter_pack
+       .byte   1                               # DW_CHILDREN_yes
+       .byte   3                               # DW_AT_name
+       .byte   37                              # DW_FORM_strx1
+       .byte   0                               # EOM(1)
+       .byte   0                               # EOM(2)
+       .byte   7                               # Abbreviation Code
+       .byte   47                              # DW_TAG_template_type_parameter
+       .byte   0                               # DW_CHILDREN_no
+       .byte   73                              # DW_AT_type
+       .byte   19                              # DW_FORM_ref4
+       .byte   0                               # EOM(1)
+       .byte   0                               # EOM(2)
+       .byte   8                               # Abbreviation Code
+       .byte   36                              # DW_TAG_base_type
+       .byte   0                               # DW_CHILDREN_no
+       .byte   3                               # DW_AT_name
+       .byte   37                              # DW_FORM_strx1
+       .byte   62                              # DW_AT_encoding
+       .byte   11                              # DW_FORM_data1
+       .byte   11                              # DW_AT_byte_size
+       .byte   11                              # DW_FORM_data1
+       .byte   0                               # EOM(1)
+       .byte   0                               # EOM(2)
+       .byte   9                               # Abbreviation Code
+       .byte   19                              # DW_TAG_structure_type
+       .byte   0                               # DW_CHILDREN_no
+       .byte   60                              # DW_AT_declaration
+       .byte   25                              # DW_FORM_flag_present
+       .byte   105                             # DW_AT_signature
+       .byte   32                              # DW_FORM_ref_sig8
+       .byte   0                               # EOM(1)
+       .byte   0                               # EOM(2)
+       .byte   10                              # Abbreviation Code
+       .byte   65                              # DW_TAG_type_unit
+       .byte   1                               # DW_CHILDREN_yes
+       .byte   19                              # DW_AT_language
+       .byte   5                               # DW_FORM_data2
+       .byte   16                              # DW_AT_stmt_list
+       .byte   23                              # DW_FORM_sec_offset
+       .byte   0                               # EOM(1)
+       .byte   0                               # EOM(2)
+       .byte   11                              # Abbreviation Code
+       .byte   19                              # DW_TAG_structure_type
+       .byte   0                               # DW_CHILDREN_no
+       .byte   54                              # DW_AT_calling_convention
+       .byte   11                              # DW_FORM_data1
+       .byte   3                               # DW_AT_name
+       .byte   14                              # DW_FORM_strp
+       .byte   11                              # DW_AT_byte_size
+       .byte   11                              # DW_FORM_data1
+       .byte   58                              # DW_AT_decl_file
+       .byte   11                              # DW_FORM_data1
+       .byte   59                              # DW_AT_decl_line
+       .byte   11                              # DW_FORM_data1
+       .byte   0                               # EOM(1)
+       .byte   0                               # EOM(2)
+       .byte   0                               # EOM(3)
+       .section        .debug_info,"",@progbits
+.Lcu_begin0:
+       .long   .Ldebug_info_end2-.Ldebug_info_start2 # Length of Unit
+.Ldebug_info_start2:
+       .short  5                               # DWARF version number
+       .byte   1                               # DWARF Unit Type
+       .byte   8                               # Address Size (in bytes)
+       .long   .debug_abbrev                   # Offset Into Abbrev. Section
+       .byte   3                               # Abbrev [3] 0xc:0x5f DW_TAG_compile_unit
+       .byte   0                               # DW_AT_producer
+       .short  33                              # DW_AT_language
+       .byte   1                               # DW_AT_name
+       .long   .Lstr_offsets_base0             # DW_AT_str_offsets_base
+       .long   .Lline_table_start0             # DW_AT_stmt_list
+       .byte   2                               # DW_AT_comp_dir
+       .quad   0                               # DW_AT_low_pc
+       .byte   0                               # DW_AT_ranges
+       .long   .Laddr_table_base0              # DW_AT_addr_base
+       .long   .Lrnglists_table_base0          # DW_AT_rnglists_base
+       .byte   4                               # Abbrev [4] 0x2b:0xf DW_TAG_subprogram
+       .byte   0                               # DW_AT_low_pc
+       .long   .Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc
+       .byte   1                               # DW_AT_frame_base
+       .byte   86
+       .byte   3                               # DW_AT_name
+       .byte   0                               # DW_AT_decl_file
+       .byte   5                               # DW_AT_decl_line
+       .long   84                              # DW_AT_type
+                                        # DW_AT_external
+       .byte   5                               # Abbrev [5] 0x3a:0x1a DW_TAG_subprogram
+       .byte   1                               # DW_AT_low_pc
+       .long   .Lfunc_end1-.Lfunc_begin1       # DW_AT_high_pc
+       .byte   1                               # DW_AT_frame_base
+       .byte   86
+       .byte   8                               # DW_AT_linkage_name
+       .byte   9                               # DW_AT_name
+       .byte   0                               # DW_AT_decl_file
+       .byte   4                               # DW_AT_decl_line
+                                        # DW_AT_external
+       .byte   6                               # Abbrev [6] 0x46:0xd DW_TAG_GNU_template_parameter_pack
+       .byte   5                               # DW_AT_name
+       .byte   7                               # Abbrev [7] 0x48:0x5 DW_TAG_template_type_parameter
+       .long   88                              # DW_AT_type
+       .byte   7                               # Abbrev [7] 0x4d:0x5 DW_TAG_template_type_parameter
+       .long   97                              # DW_AT_type
+       .byte   0                               # End Of Children Mark
+       .byte   0                               # End Of Children Mark
+       .byte   8                               # Abbrev [8] 0x54:0x4 DW_TAG_base_type
+       .byte   4                               # DW_AT_name
+       .byte   5                               # DW_AT_encoding
+       .byte   4                               # DW_AT_byte_size
+       .byte   9                               # Abbrev [9] 0x58:0x9 DW_TAG_structure_type
+                                        # DW_AT_declaration
+       .quad   -4149699470930386446            # DW_AT_signature
+       .byte   9                               # Abbrev [9] 0x61:0x9 DW_TAG_structure_type
+                                        # DW_AT_declaration
+       .quad   5649318945901130368             # DW_AT_signature
+       .byte   0                               # End Of Children Mark
+.Ldebug_info_end2:
+       .section        .debug_rnglists,"",@progbits
+       .long   .Ldebug_list_header_end0-.Ldebug_list_header_start0 # Length
+.Ldebug_list_header_start0:
+       .short  5                               # Version
+       .byte   8                               # Address size
+       .byte   0                               # Segment selector size
+       .long   1                               # Offset entry count
+.Lrnglists_table_base0:
+       .long   .Ldebug_ranges0-.Lrnglists_table_base0
+.Ldebug_ranges0:
+       .byte   3                               # DW_RLE_startx_length
+       .byte   0                               #   start index
+       .uleb128 .Lfunc_end0-.Lfunc_begin0      #   length
+       .byte   3                               # DW_RLE_startx_length
+       .byte   1                               #   start index
+       .uleb128 .Lfunc_end1-.Lfunc_begin1      #   length
+       .byte   0                               # DW_RLE_end_of_list
+.Ldebug_list_header_end0:
+       .section        .debug_str_offsets,"",@progbits
+       .long   44                              # Length of String Offsets Set
+       .short  5
+       .short  0
+.Lstr_offsets_base0:
+       .section        .debug_str,"MS",@progbits,1
+.Linfo_string0:
+       .asciz  "clang version 14.0.0 (git@github.com:llvm/llvm-project.git 22a1aa5a43cbdaf9dde014ba1f120e0f7ca1788b)" # string offset=0
+.Linfo_string1:
+       .asciz  "test.cpp"                      # string offset=101
+.Linfo_string2:
+       .asciz  "/usr/local/google/home/blaikie/dev/scratch" # string offset=110
+.Linfo_string3:
+       .asciz  "main"                          # string offset=153
+.Linfo_string4:
+       .asciz  "int"                           # string offset=158
+.Linfo_string5:
+       .asciz  "T"                             # string offset=162
+.Linfo_string6:
+       .asciz  "t1"                            # string offset=164
+.Linfo_string7:
+       .asciz  "t2"                            # string offset=167
+.Linfo_string8:
+       .asciz  "_Z2f1IJ2t12t2EEvv"             # string offset=170
+.Linfo_string9:
+       .asciz  "f1<t1, t2>"                    # string offset=188
+       .section        .debug_str_offsets,"",@progbits
+       .long   .Linfo_string0
+       .long   .Linfo_string1
+       .long   .Linfo_string2
+       .long   .Linfo_string3
+       .long   .Linfo_string4
+       .long   .Linfo_string5
+       .long   .Linfo_string6
+       .long   .Linfo_string7
+       .long   .Linfo_string8
+       .long   .Linfo_string9
+       .section        .debug_addr,"",@progbits
+       .long   .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
+.Ldebug_addr_start0:
+       .short  5                               # DWARF version number
+       .byte   8                               # Address size
+       .byte   0                               # Segment selector size
+.Laddr_table_base0:
+       .quad   .Lfunc_begin0
+       .quad   .Lfunc_begin1
+.Ldebug_addr_end0:
+       .ident  "clang version 14.0.0 (git@github.com:llvm/llvm-project.git 22a1aa5a43cbdaf9dde014ba1f120e0f7ca1788b)"
+       .section        ".note.GNU-stack","",@progbits
+       .addrsig
+       .addrsig_sym _Z2f1IJ2t12t2EEvv
+       .section        .debug_line,"",@progbits
+.Lline_table_start0: