338 lines · plain
1# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o2# RUN: llvm-dwarfdump -v %t.o | FileCheck %s3 4# Test object to verify that dwarfdump handles dwp files with DWARF v5 string5# offset tables. We have 3 CUs and 2 TUs, where it is assumed that 6# CU1 and TU1 came from one object file, CU2 and TU2 from a second object7# file, and CU3 from a third object file that was compiled with 8# -gdwarf-4.9#10 .section .debug_str.dwo,"MSe",@progbits,111str_producer:12 .asciz "Handmade DWARF producer"13str_CU1:14 .asciz "Compile_Unit_1"15str_CU1_dir:16 .asciz "/home/test/CU1"17str_CU2:18 .asciz "Compile_Unit_2"19str_CU2_dir:20 .asciz "/home/test/CU2"21str_TU1:22 .asciz "Type_Unit_1"23str_TU1_type:24 .asciz "MyStruct_1"25str_TU2:26 .asciz "Type_Unit_2"27str_TU2_type:28 .asciz "MyStruct_2"29str_CU3:30 .asciz "Compile_Unit_3"31str_CU3_dir:32 .asciz "/home/test/CU3"33 34 .section .debug_str_offsets.dwo,"e",@progbits35# Object files 1's portion of the .debug_str_offsets.dwo section.36# CU1 and TU1 share a contribution to the string offsets table.37.debug_str_offsets_object_file1_start:38 .long .debug_str_offsets_object_file1_end-.debug_str_offsets_base_139 .short 5 # DWARF version40 .short 0 # Padding41.debug_str_offsets_base_1:42 .long str_producer-.debug_str.dwo43 .long str_CU1-.debug_str.dwo44 .long str_CU1_dir-.debug_str.dwo45 .long str_TU1-.debug_str.dwo46 .long str_TU1_type-.debug_str.dwo47.debug_str_offsets_object_file1_end:48 49# Object files 2's portion of the .debug_str_offsets.dwo section.50# CU2 and TU2 share a contribution to the string offsets table.51.debug_str_offsets_object_file2_start:52 .long .debug_str_offsets_object_file2_end-.debug_str_offsets_base_253 .short 5 # DWARF version54 .short 0 # Padding55.debug_str_offsets_base_2:56 .long str_producer-.debug_str.dwo57 .long str_CU2-.debug_str.dwo58 .long str_CU2_dir-.debug_str.dwo59 .long str_TU2-.debug_str.dwo60 .long str_TU2_type-.debug_str.dwo61.debug_str_offsets_object_file2_end:62 63# Object files 3's portion of the .debug_str_offsets.dwo section.64# This file is assumed to have been compiled with -gdwarf-4 and65# therefore contains a version 4 CU and a GNU format contribution66# to the .debug_str_offsets section.67.debug_str_offsets_object_file3_start:68.debug_str_offsets_base_3:69 .long str_producer-.debug_str.dwo70 .long str_CU3-.debug_str.dwo71 .long str_CU3_dir-.debug_str.dwo72.debug_str_offsets_object_file3_end:73 74# Abbrevs are shared for all compile and type units75 .section .debug_abbrev.dwo,"e",@progbits76 .byte 0x01 # Abbrev code77 .byte 0x11 # DW_TAG_compile_unit78 .byte 0x00 # DW_CHILDREN_no79 .byte 0x25 # DW_AT_producer80 .byte 0x1a # DW_FORM_strx81 .byte 0x03 # DW_AT_name82 .byte 0x1a # DW_FORM_strx83 .byte 0x03 # DW_AT_name84 .byte 0x1a # DW_FORM_strx85 .byte 0x00 # EOM(1)86 .byte 0x00 # EOM(2)87 .byte 0x02 # Abbrev code88 .byte 0x41 # DW_TAG_type_unit89 .byte 0x01 # DW_CHILDREN_yes90 .byte 0x03 # DW_AT_name91 .byte 0x1a # DW_FORM_strx92 .byte 0x00 # EOM(1)93 .byte 0x00 # EOM(2)94 .byte 0x03 # Abbrev code95 .byte 0x13 # DW_TAG_structure_type96 .byte 0x00 # DW_CHILDREN_no (no members)97 .byte 0x03 # DW_AT_name98 .byte 0x1a # DW_FORM_strx99 .byte 0x00 # EOM(1)100 .byte 0x00 # EOM(2)101 .byte 0x04 # Abbrev code102 .byte 0x11 # DW_TAG_compile_unit103 .byte 0x00 # DW_CHILDREN_no104 .byte 0x25 # DW_AT_producer105 .short 0x3e82 # DW_FORM_GNU_str_index106 .byte 0x03 # DW_AT_name107 .short 0x3e82 # DW_FORM_GNU_str_index108 .byte 0x03 # DW_AT_name109 .short 0x3e82 # DW_FORM_GNU_str_index110 .byte 0x00 # EOM(1)111 .byte 0x00 # EOM(2)112 .byte 0x00 # EOM(3)113abbrev_end:114 115 .section .debug_info.dwo,"e",@progbits116 117# DWARF v5 CU header.118CU1_5_start:119 .long CU1_5_end-CU1_5_version # Length of Unit120CU1_5_version:121 .short 5 # DWARF version number122 .byte 1 # DWARF Unit Type123 .byte 8 # Address Size (in bytes)124 .long .debug_abbrev.dwo # Offset Into Abbrev. Section125# The compile-unit DIE, which has a DW_AT_producer, DW_AT_name126# and DW_AT_compdir.127 .byte 1 # Abbreviation code128 .byte 0 # The index of the producer string129 .byte 1 # The index of the CU name string130 .byte 2 # The index of the comp dir string131 .byte 0 # NULL132CU1_5_end:133 134CU2_5_start:135 .long CU2_5_end-CU2_5_version # Length of Unit136CU2_5_version:137 .short 5 # DWARF version number138 .byte 1 # DWARF Unit Type139 .byte 8 # Address Size (in bytes)140 .long .debug_abbrev.dwo # Offset Into Abbrev. Section141# The compile-unit DIE, which has a DW_AT_producer, DW_AT_name142# and DW_AT_compdir.143 .byte 1 # Abbreviation code144 .byte 0 # The index of the producer string145 .byte 1 # The index of the CU name string146 .byte 2 # The index of the comp dir string147 .byte 0 # NULL148CU2_5_end:149 150CU3_4_start:151 .long CU3_4_end-CU3_4_version # Length of Unit152CU3_4_version:153 .short 4 # DWARF version number154 .long .debug_abbrev.dwo # Offset Into Abbrev. Section155 .byte 8 # Address Size (in bytes)156# The compile-unit DIE, which has a DW_AT_producer, DW_AT_name157# and DW_AT_compdir.158 .byte 4 # Abbreviation code159 .byte 0 # The index of the producer string160 .byte 1 # The index of the CU name string161 .byte 2 # The index of the comp dir string162 .byte 0 # NULL163CU3_4_end:164 165 .section .debug_types.dwo,"e",@progbits166# DWARF v5 Type unit header.167TU1_5_start:168 .long TU1_5_end-TU1_5_version # Length of Unit169TU1_5_version:170 .short 5 # DWARF version number171 .byte 2 # DWARF Unit Type172 .byte 8 # Address Size (in bytes)173 .long .debug_abbrev.dwo # Offset Into Abbrev. Section174 .quad 0xeeaaddbbaabbeedd # Type Signature175 .long TU1_5_type-TU1_5_start # Type offset176# The type-unit DIE, which has a name.177 .byte 2 # Abbreviation code178 .byte 3 # Index of the unit type name string179# The type DIE, which has a name.180TU1_5_type:181 .byte 3 # Abbreviation code182 .byte 4 # Index of the type name string183 .byte 0 # NULL184 .byte 0 # NULL185TU1_5_end:186 187TU2_5_start:188 .long TU2_5_end-TU2_5_version # Length of Unit189TU2_5_version:190 .short 5 # DWARF version number191 .byte 2 # DWARF Unit Type192 .byte 8 # Address Size (in bytes)193 .long .debug_abbrev.dwo # Offset Into Abbrev. Section194 .quad 0x00ffeeffaaff00ff # Type Signature195 .long TU2_5_type-TU2_5_start # Type offset196# The type-unit DIE, which has a name.197 .byte 2 # Abbreviation code198 .byte 3 # Index of the unit type name string199# The type DIE, which has a name.200TU2_5_type:201 .byte 3 # Abbreviation code202 .byte 4 # Index of the type name string203 .byte 0 # NULL204 .byte 0 # NULL205TU2_5_end:206 207 .section .debug_cu_index,"",@progbits208 # The index header209 .long 2 # Version 210 .long 3 # Columns of contribution matrix211 .long 3 # number of units212 .long 3 # number of hash buckets in table213 214 # The signatures for all CUs.215 .quad 0xddeeaaddbbaabbee # signature 1216 .quad 0xff00ffeeffaaff00 # signature 2217 .quad 0xf00df00df00df00d # signature 2218 # The indexes for both CUs.219 .long 1 # index 1220 .long 2 # index 2221 .long 3 # index 3222 # The sections to which all CUs contribute.223 .long 1 # DW_SECT_INFO224 .long 3 # DW_SECT_ABBREV225 .long 6 # DW_SECT_STR_OFFSETS226 227 # The starting offsets of all CU's contributions to info,228 # abbrev and string offsets table.229 .long CU1_5_start-.debug_info.dwo 230 .long 0231 .long .debug_str_offsets_object_file1_start-.debug_str_offsets.dwo232 .long CU2_5_start-.debug_info.dwo233 .long 0234 .long .debug_str_offsets_object_file2_start-.debug_str_offsets.dwo235 .long CU3_4_start-.debug_info.dwo236 .long 0237 .long .debug_str_offsets_object_file3_start-.debug_str_offsets.dwo238 239 # The lengths of all CU's contributions to info, abbrev and240 # string offsets table.241 .long CU1_5_end-CU1_5_start242 .long abbrev_end-.debug_abbrev.dwo243 .long .debug_str_offsets_object_file1_end-.debug_str_offsets_object_file1_start244 .long CU2_5_end-CU2_5_start245 .long abbrev_end-.debug_abbrev.dwo246 .long .debug_str_offsets_object_file2_end-.debug_str_offsets_object_file2_start247 .long CU3_4_end-CU3_4_start248 .long abbrev_end-.debug_abbrev.dwo249 .long .debug_str_offsets_object_file3_end-.debug_str_offsets_object_file3_start250 251 .section .debug_tu_index,"",@progbits252 # The index header253 .long 2 # Version 254 .long 3 # Columns of contribution matrix255 .long 2 # number of units256 .long 2 # number of hash buckets in table257 258 # The signatures for both TUs.259 .quad 0xeeaaddbbaabbeedd # signature 1260 .quad 0x00ffeeffaaff00ff # signature 2261 # The indexes for both TUs.262 .long 1 # index 1263 .long 2 # index 2264 # The sections to which both TUs contribute.265 .long 2 # DW_SECT_TYPES266 .long 3 # DW_SECT_ABBREV267 .long 6 # DW_SECT_STR_OFFSETS268 269 # The starting offsets of both TU's contributions to info,270 # abbrev and string offsets table.271 .long TU1_5_start-.debug_types.dwo272 .long 0273 .long .debug_str_offsets_object_file1_start-.debug_str_offsets.dwo274 .long TU2_5_start-.debug_types.dwo275 .long 0276 .long .debug_str_offsets_object_file2_start-.debug_str_offsets.dwo277 278 # The lengths of both TU's contributions to info, abbrev and279 # string offsets table.280 .long TU1_5_end-TU1_5_start281 .long abbrev_end-.debug_abbrev.dwo282 .long .debug_str_offsets_object_file1_end-.debug_str_offsets_object_file1_start283 .long TU2_5_end-TU2_5_start284 .long abbrev_end-.debug_abbrev.dwo285 .long .debug_str_offsets_object_file2_end-.debug_str_offsets_object_file2_start286 287 288# Verify that the correct strings from each unit are displayed and that the289# index for the .debug_str_offsets section has the right values.290 291# CHECK: Compile Unit292# CHECK-NOT: NULL293# CHECK: DW_TAG_compile_unit294# CHECK-NEXT: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Handmade DWARF producer")295# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "Compile_Unit_1")296# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000002) string = "/home/test/CU1")297# CHECK-NOT: NULL298 299# CHECK: Compile Unit300# CHECK-NOT: NULL301# CHECK: DW_TAG_compile_unit302# CHECK-NEXT: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Handmade DWARF producer")303# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "Compile_Unit_2")304# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000002) string = "/home/test/CU2")305# 306# CHECK: Type Unit307# CHECK-NOT: NULL308# CHECK: DW_TAG_type_unit309# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000003) string = "Type_Unit_1")310# CHECK-NOT: NULL311# CHECK: DW_TAG_structure_type312# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000004) string = "MyStruct_1")313#314# CHECK: Type Unit315# CHECK-NOT: NULL316# CHECK: DW_TAG_type_unit317# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000003) string = "Type_Unit_2")318# CHECK-NOT: NULL319# CHECK: DW_TAG_structure_type320# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000004) string = "MyStruct_2")321 322# Verify the correct offets of the compile and type units contributions in the323# index tables.324 325# CHECK: .debug_cu_index contents:326# CHECK-NOT: contents:327# CHECK: 1 0xddeeaaddbbaabbee [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})328# CHECK-SAME: [0x00000000329# CHECK-NEXT: 2 0xff00ffeeffaaff00 [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})330# CHECK-SAME: [0x0000001c331 332# CHECK: .debug_tu_index contents:333# CHECK-NOT: contents:334# CHECK: 1 0xeeaaddbbaabbeedd [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})335# CHECK-SAME: [0x00000000336# CHECK-NEXT: 2 0x00ffeeffaaff00ff [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})337# CHECK: [0x0000001c338