[llvm] [DWARF] Teach getAttributeValueAsReferencedDie to resolve DW_FORM_ref… (PR #101197)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 08:01:04 PDT 2024


================
@@ -1,403 +1,269 @@
 # RUN: llvm-mc < %s -filetype obj -triple x86_64 -o - \
 # RUN:   | llvm-dwarfdump - | FileCheck %s
 
-# Significantly modified assembly generated from this source:
+# Hand-written assembly roughly equivalent to this source code:
 #
 # struct t1 { };
 # struct t2 { };
 # template<typename ...T>
-# void f1() { }
-# int main() {
-#   f1<t1, t2>();
-# }
+# struct S {};
+# S<t1, t2, t1> s;
 #
-# $ 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.
+# To various scenarios, the test uses a mixture of DWARF v4 and v5 type units,
+# and of llvm and gcc styles of referring to them.
+
 
+# CHECK:      DW_TAG_variable
+# CHECK-NEXT:   DW_AT_name ("s")
+# CHECK-NEXT:   DW_AT_type ({{.*}} "S<t1, t2, t1>")
+# CHECK:      DW_TAG_template_type_parameter
+# CHECK-NEXT:   DW_AT_type ({{.*}} "t1")
+# CHECK:      DW_TAG_template_type_parameter
+# CHECK-NEXT:   DW_AT_type ({{.*}} "t2")
+# CHECK:      DW_TAG_template_type_parameter
+# CHECK-NEXT:   DW_AT_type (0xdeadbeef00000001 "t1")
 
-# CHECK: DW_TAG_template_type_parameter
-# CHECK:   DW_AT_type ({{.*}} "t1")
-# CHECK: DW_TAG_template_type_parameter
-# CHECK:   DW_AT_type ({{.*}} "t2")
+.set S_sig,  0xdeadbeef00000000
+.set t1_sig, 0xdeadbeef00000001
+.set t2_sig, 0xdeadbeef00000002
 
-	.text
-	.file	"test.cpp"
-	.globl	main                            # -- Begin function main
-	.p2align	4, 0x90
-	.type	main, at 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", at progbits,_Z2f1IJ2t12t2EEvv,comdat
-	.weak	_Z2f1IJ2t12t2EEvv               # -- Begin function _Z2f1IJ2t12t2EEvv
-	.p2align	4, 0x90
-	.type	_Z2f1IJ2t12t2EEvv, at 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", at progbits,14297044602779165170,comdat
-	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+        .section        .debug_types,"G", at progbits,t1_sig,comdat
+.Ltu_begin0:
+        .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
+        .short  4                               # DWARF version number
+        .long   .debug_abbrev                   # Offset Into Abbrev. Section
+        .byte   8                               # Address Size (in bytes)
+        .quad   t1_sig                          # Type Signature
+        .long   .Lt1_def-.Ltu_begin0            # Type DIE Offset
+        .byte   10                              # Abbrev [10] DW_TAG_type_unit
+        .short  33                              # DW_AT_language
+.Lt1_def:
+        .byte   11                              # Abbrev [11] DW_TAG_structure_type
+        .long   .Linfo_string6                  # DW_AT_name
+        .byte   1                               # DW_AT_byte_size
+        .byte   0                               # End Of Children Mark
 .Ldebug_info_end0:
-	.section	.debug_info,"G", at progbits,5649318945901130368,comdat
-	.long	.Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit
+        .section        .debug_info,"G", at progbits,t2_sig,comdat
+.Ltu_begin1:
+        .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
+        .short  5                               # DWARF version number
+        .byte   2                               # DWARF Unit Type
+        .byte   8                               # Address Size (in bytes)
+        .long   .debug_abbrev                   # Offset Into Abbrev. Section
+        .quad   t2_sig                          # Type Signature
+        .long   .Lt2_def-.Ltu_begin1            # Type DIE Offset
+        .byte   1                               # Abbrev [1] 0x18:0x12 DW_TAG_type_unit
+        .short  33                              # DW_AT_language
+        .long   .Lstr_offsets_base0             # DW_AT_str_offsets_base
+.Lt2_def:
+        .byte   2                               # Abbrev [2] 0x23:0x6 DW_TAG_structure_type
+        .byte   7                               # DW_AT_name
+        .byte   1                               # DW_AT_byte_size
+        .byte   0                               # End Of Children Mark
 .Ldebug_info_end1:
-	.section	.debug_abbrev,"", at 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,"", at progbits
+        .section        .debug_abbrev,"", at 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   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   3                               # DW_AT_name
+        .byte   37                              # DW_FORM_strx1
+        .byte   11                              # DW_AT_byte_size
+        .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   27                              # DW_AT_comp_dir
+        .byte   37                              # DW_FORM_strx1
+        .byte   0                               # EOM(1)
+        .byte   0                               # EOM(2)
+        .byte   4                               # Abbreviation Code
+        .byte   52                              # DW_TAG_variable
+        .byte   0                               # DW_CHILDREN_no
+        .byte   3                               # DW_AT_name
+        .byte   8                               # DW_FORM_string
+        .byte   73                              # DW_AT_type
+        .byte   19                              # DW_FORM_ref4
+        .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   0                               # EOM(1)
+        .byte   0                               # EOM(2)
+        .byte   11                              # Abbreviation Code
+        .byte   19                              # DW_TAG_structure_type
+        .byte   0                               # DW_CHILDREN_no
+        .byte   3                               # DW_AT_name
+        .byte   14                              # DW_FORM_strp
+        .byte   11                              # DW_AT_byte_size
+        .byte   11                              # DW_FORM_data1
+        .byte   0                               # EOM(1)
+        .byte   0                               # EOM(2)
+        .byte   12                              # Abbreviation Code
+        .byte   47                              # DW_TAG_template_type_parameter
+        .byte   0                               # DW_CHILDREN_no
+        .byte   73                              # DW_AT_type
+        .byte   32                              # DW_FORM_ref_sig8
+        .byte   0                               # EOM(1)
+        .byte   0                               # EOM(2)
+        .byte   13                              # Abbreviation Code
+        .byte   19                              # DW_TAG_structure_type
+        .byte   1                               # DW_CHILDREN_yes
+        .byte   3                               # DW_AT_name
+        .byte   8                               # DW_FORM_string
+        .byte   0                               # EOM(1)
+        .byte   0                               # EOM(2)
+        .byte   0                               # EOM(3)
+        .section        .debug_info,"", at progbits
 .Lcu_begin0:
-	.long	.Ldebug_info_end2-.Ldebug_info_start2 # Length of Unit
+        .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
+        .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
+        .byte   2                               # DW_AT_comp_dir
+        .byte   4                               # Abbrev [4] DW_TAG_variable
+        .asciz  "s"                             # DW_AT_name
+        .long   .LS_decl-.Lcu_begin0            # DW_AT_type
+.LS_decl:
+        .byte   9                               # Abbrev [9] DW_TAG_structure_type
+        .quad   S_sig                           # DW_AT_signature
+        .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   0                               # End Of Children Mark
+.Ldebug_info_end2:
+        .section        .debug_info,"G", at progbits,S_sig,comdat
+.Ltu_begin2:
+        .long   .Ldebug_info_end3-.Ldebug_info_start3 # Length of Unit
+.Ldebug_info_start3:
+        .short  5                               # DWARF version number
+        .byte   2                               # DWARF Unit Type
+        .byte   8                               # Address Size (in bytes)
+        .long   .debug_abbrev                   # Offset Into Abbrev. Section
+        .quad   S_sig                           # Type Signature
+        .long   .LS_def-.Ltu_begin2             # Type DIE Offset
+        .byte   1                               # Abbrev [1] DW_TAG_type_unit
+        .short  33                              # DW_AT_language
+        .long   .Lstr_offsets_base0             # DW_AT_str_offsets_base
+.LS_def:
+        .byte   13                              # Abbrev [13] DW_TAG_structure_type
+        .asciz  "S"                             # DW_AT_name (simplified template name)
+        .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   .Lt1_decl-.Ltu_begin2           # DW_AT_type
+        .byte   7                               # Abbrev [7] 0x4d:0x5 DW_TAG_template_type_parameter
+        # Simulate DWARF emitted by GCC where the signature is directly in the type attribute.
----------------
dwblaikie wrote:

Is this comment in the right place? I'd expect it to be a line or two lower? (in the third template type parameter, that has `.quad t1_sig`?)

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


More information about the llvm-commits mailing list