481 lines · plain
1# Test object to verify dwarfdump handles v4 and v5 CU/TU/line headers.2# We have a representative set of units: v4 CU, v5 CU, v4 TU, v5 split TU.3# We have v4 and v5 line-table headers.4#5# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o6# RUN: llvm-dwarfdump -v %t.o | FileCheck %s7# RUN: llvm-dwarfdump -verify %t.o | FileCheck %s --check-prefix=VERIFY8 9 .section .debug_str,"MS",@progbits,110str_producer:11 .asciz "Handmade DWARF producer"12str_CU_4:13 .asciz "V4_compile_unit"14str_CU_5:15 .asciz "V5_compile_unit"16str_TU_4:17 .asciz "V4_type_unit"18str_LT_5a:19 .asciz "Directory5a"20str_LT_5b:21 .asciz "Directory5b"22 23 .section .debug_str.dwo,"MSe",@progbits,124dwo_TU_5:25 .asciz "V5_split_type_unit"26dwo_producer:27 .asciz "Handmade DWO producer"28dwo_CU_5:29 .asciz "V5_dwo_compile_unit"30dwo_LT_5a:31 .asciz "DWODirectory5a"32dwo_LT_5b:33 .asciz "DWODirectory5b"34 35 .section .debug_str_offsets.dwo,"e",@progbits36 .long Lstr_offsets_end-Lstr_offsets_start # Length of String Offsets Set37 Lstr_offsets_start:38 .short 539 .short 040 .long dwo_TU_5-.debug_str.dwo41 .long dwo_producer-.debug_str.dwo42 .long dwo_CU_5-.debug_str.dwo43 .long dwo_LT_5a-.debug_str.dwo44 .long dwo_LT_5b-.debug_str.dwo45 Lstr_offsets_end:46 47# All CUs/TUs use the same abbrev section for simplicity.48 .section .debug_abbrev,"",@progbits49 .byte 0x01 # Abbrev code50 .byte 0x11 # DW_TAG_compile_unit51 .byte 0x00 # DW_CHILDREN_no52 .byte 0x25 # DW_AT_producer53 .byte 0x0e # DW_FORM_strp54 .byte 0x03 # DW_AT_name55 .byte 0x0e # DW_FORM_strp56 .byte 0x10 # DW_AT_stmt_list57 .byte 0x17 # DW_FORM_sec_offset58 .byte 0x00 # EOM(1)59 .byte 0x00 # EOM(2)60 .byte 0x02 # Abbrev code61 .byte 0x41 # DW_TAG_type_unit62 .byte 0x01 # DW_CHILDREN_yes63 .byte 0x03 # DW_AT_name64 .byte 0x0e # DW_FORM_strp65 .byte 0x00 # EOM(1)66 .byte 0x00 # EOM(2)67 .byte 0x03 # Abbrev code68 .byte 0x13 # DW_TAG_structure_type69 .byte 0x00 # DW_CHILDREN_no (no members)70 .byte 0x03 # DW_AT_name71 .byte 0x0e # DW_FORM_strp72 .byte 0x00 # EOM(1)73 .byte 0x00 # EOM(2)74 .byte 0x04 # Abbrev code75 .byte 0x3c # DW_TAG_partial_unit76 .byte 0x00 # DW_CHILDREN_no77 .byte 0x03 # DW_AT_name78 .byte 0x0e # DW_FORM_strp79 .byte 0x00 # EOM(1)80 .byte 0x00 # EOM(2)81 .byte 0x00 # EOM(3)82 83# And a .dwo copy for the .dwo sections.84 .section .debug_abbrev.dwo,"e",@progbits85 .byte 0x01 # Abbrev code86 .byte 0x11 # DW_TAG_compile_unit87 .byte 0x00 # DW_CHILDREN_no88 .byte 0x25 # DW_AT_producer89 .byte 0x25 # DW_FORM_strx190 .byte 0x03 # DW_AT_name91 .byte 0x25 # DW_FORM_strx192 .byte 0x10 # DW_AT_stmt_list93 .byte 0x17 # DW_FORM_sec_offset94 .byte 0x00 # EOM(1)95 .byte 0x00 # EOM(2)96 .byte 0x02 # Abbrev code97 .byte 0x41 # DW_TAG_type_unit98 .byte 0x01 # DW_CHILDREN_yes99 .byte 0x03 # DW_AT_name100 .byte 0x25 # DW_FORM_strx1101 .byte 0x00 # EOM(1)102 .byte 0x00 # EOM(2)103 .byte 0x03 # Abbrev code104 .byte 0x13 # DW_TAG_structure_type105 .byte 0x00 # DW_CHILDREN_no (no members)106 .byte 0x03 # DW_AT_name107 .byte 0x25 # DW_FORM_strx1108 .byte 0x00 # EOM(1)109 .byte 0x00 # EOM(2)110 .byte 0x00 # EOM(3)111 112 .section .debug_info,"",@progbits113# CHECK-LABEL: .debug_info contents:114 115# DWARF v4 CU header. V4 CU headers all look the same so we do only one.116 .long CU_4_end-CU_4_version # Length of Unit117CU_4_version:118 .short 4 # DWARF version number119 .long .debug_abbrev # Offset Into Abbrev. Section120 .byte 8 # Address Size (in bytes)121# The compile-unit DIE, with DW_AT_producer, DW_AT_name, DW_AT_stmt_list.122 .byte 1123 .long str_producer124 .long str_CU_4125 .long LH_4_start126 .byte 0 # NULL127CU_4_end:128 129# CHECK: 0x00000000: Compile Unit: length = 0x00000015, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000019)130# CHECK: 0x0000000b: DW_TAG_compile_unit131 132# DWARF v5 normal CU header.133 .long CU_5_end-CU_5_version # Length of Unit134CU_5_version:135 .short 5 # DWARF version number136 .byte 1 # DWARF Unit Type137 .byte 8 # Address Size (in bytes)138 .long .debug_abbrev # Offset Into Abbrev. Section139# The compile-unit DIE, with DW_AT_producer, DW_AT_name, DW_AT_stmt_list.140 .byte 1141 .long str_producer142 .long str_CU_5143 .long LH_5_start144 .byte 0 # NULL145CU_5_end:146 147# CHECK: 0x00000019: Compile Unit: length = 0x00000016, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000033)148# CHECK: 0x00000025: DW_TAG_compile_unit149 150# DWARF v5 CU header (Unit Type = DW_UT_partial).151 .long CU_5_partial_end-CU_5_partial_version # Length of Unit152CU_5_partial_version:153 .short 5 # DWARF version number154 .byte 3 # DWARF Unit Type155 .byte 8 # Address Size (in bytes)156 .long .debug_abbrev # Offset Into Abbrev. Section157# The partial-unit DIE, with DW_AT_name158 .byte 4159 .long str_CU_5160 .byte 0 # NULL161CU_5_partial_end:162 163# CHECK: 0x00000033: Compile Unit: length = 0x0000000e, format = DWARF32, version = 0x0005, unit_type = DW_UT_partial, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000045)164# CHECK: 0x0000003f: DW_TAG_partial_unit165 166 .section .debug_info.dwo,"e",@progbits167# CHECK-LABEL: .debug_info.dwo168 169# DWARF v5 split CU header.170 .long CU_split_5_end-CU_split_5_version # Length of Unit171CU_split_5_version:172 .short 5 # DWARF version number173 .byte 5 # DWARF Unit Type174 .byte 8 # Address Size (in bytes)175 .long 0 # Offset Into Abbrev. Section176 .quad 0x5a # DWO ID177# The split compile-unit DIE, with DW_AT_producer, DW_AT_name, DW_AT_stmt_list.178 .byte 1179 .byte 1180 .byte 2181 .long 0182 .byte 0 # NULL183CU_split_5_end:184 185# CHECK: 0x00000000: Compile Unit: length = 0x00000018, format = DWARF32, version = 0x0005, unit_type = DW_UT_split_compile, abbr_offset = 0x0000, addr_size = 0x08, DWO_id = 0x000000000000005a (next unit at 0x0000001c)186# CHECK: 0x00000014: DW_TAG_compile_unit187# CHECK-NEXT: DW_AT_producer {{.*}} "Handmade DWO producer"188# CHECK-NEXT: DW_AT_name {{.*}} "V5_dwo_compile_unit"189 190# Now a DWARF v5 type unit, which goes in a .debug_info.dwo comdat.191# Note there will not be another ".debug_info.dwo contents:" line, even though192# there is a separate ELF section header; it's dumped along with the previous193# unit as if they were in a single section.194 195 .section .debug_info.dwo,"Ge",@progbits,5555,comdat196# CHECK-NOT: .debug_info.dwo197 198# DWARF v5 split type unit header.199TU_split_5_start:200 .long TU_split_5_end-TU_split_5_version # Length of Unit201TU_split_5_version:202 .short 5 # DWARF version number203 .byte 6 # DWARF Unit Type204 .byte 8 # Address Size (in bytes)205 .long 0 # Offset Into Abbrev. Section206 .quad 0x8899aabbccddeeff # Type Signature207 .long TU_split_5_type-TU_split_5_start # Type offset208# The type-unit DIE, which has a name.209 .byte 2210 .byte 0211# The type DIE, which has a name.212TU_split_5_type:213 .byte 3214 .byte 0215 .byte 0 # NULL216 .byte 0 # NULL217TU_split_5_end:218 219# CHECK: 0x00000000: Type Unit: length = 0x0000001a, format = DWARF32, version = 0x0005, unit_type = DW_UT_split_type, abbr_offset = 0x0000, addr_size = 0x08, name = 'V5_split_type_unit', type_signature = 0x8899aabbccddeeff, type_offset = 0x001a (next unit at 0x0000001e)220# CHECK: 0x00000018: DW_TAG_type_unit221 222 .section .debug_types,"",@progbits223# CHECK-LABEL: .debug_types contents:224 225# DWARF v4 Type unit header. Normal/split are identical so we do only one.226TU_4_start:227 .long TU_4_end-TU_4_version # Length of Unit228TU_4_version:229 .short 4 # DWARF version number230 .long .debug_abbrev # Offset Into Abbrev. Section231 .byte 8 # Address Size (in bytes)232 .quad 0x0011223344556677 # Type Signature233 .long TU_4_type-TU_4_start # Type offset234# The type-unit DIE, which has a name.235 .byte 2236 .long str_TU_4237# The type DIE, which has a name.238TU_4_type:239 .byte 3240 .long str_TU_4241 .byte 0 # NULL242 .byte 0 # NULL243TU_4_end:244 245# CHECK: 0x00000000: Type Unit: length = 0x0000001f, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08, name = 'V4_type_unit', type_signature = 0x0011223344556677, type_offset = 0x001c (next unit at 0x00000023)246# CHECK: 0x00000017: DW_TAG_type_unit247 248 .section .debug_line,"",@progbits249# CHECK-LABEL: .debug_line contents:250 251# DWARF v4 line-table header.252LH_4_start:253 .long LH_4_end-LH_4_version # Length of Unit254LH_4_version:255 .short 4 # DWARF version number256 .long LH_4_header_end-LH_4_params # Length of Prologue257LH_4_params:258 .byte 1 # Minimum Instruction Length259 .byte 1 # Maximum Operations per Instruction260 .byte 1 # Default is_stmt261 .byte -5 # Line Base262 .byte 14 # Line Range263 .byte 13 # Opcode Base264 .byte 0 # Standard Opcode Lengths265 .byte 1266 .byte 1267 .byte 1268 .byte 1269 .byte 0270 .byte 0271 .byte 0272 .byte 1273 .byte 0274 .byte 0275 .byte 1276 # Directory table277 .asciz "Directory4a"278 .asciz "Directory4b"279 .byte 0280 # File table281 .asciz "File4a" # File name 1282 .byte 1 # Directory index 1283 .byte 0x41 # Timestamp 1284 .byte 0x42 # File Size 1285 .asciz "File4b" # File name 2286 .byte 0 # Directory index 2287 .byte 0x43 # Timestamp 2288 .byte 0x44 # File Size 2289 .byte 0 # End of list290LH_4_header_end:291 # Line number program, which is empty.292LH_4_end:293 294# CHECK: Line table prologue:295# CHECK: version: 4296# CHECK-NOT: address_size297# CHECK-NOT: seg_select_size298# CHECK: max_ops_per_inst: 1299# CHECK: include_directories[ 1] = "Directory4a"300# CHECK: include_directories[ 2] = "Directory4b"301# CHECK-NOT: include_directories302# CHECK: file_names[ 1]:303# CHECK-NEXT: name: "File4a"304# CHECK-NEXT: dir_index: 1305# CHECK-NEXT: mod_time: 0x00000041306# CHECK-NEXT: length: 0x00000042307# CHECK: file_names[ 2]:308# CHECK-NEXT: name: "File4b"309# CHECK-NEXT: dir_index: 0310# CHECK-NEXT: mod_time: 0x00000043311# CHECK-NEXT: length: 0x00000044312# CHECK-NOT: file_names313 314# DWARF v5 line-table header.315LH_5_start:316 .long LH_5_end-LH_5_version # Length of Unit317LH_5_version:318 .short 5 # DWARF version number319 .byte 8 # Address Size320 .byte 0 # Segment Selector Size321 .long LH_5_header_end-LH_5_params # Length of Prologue322LH_5_params:323 .byte 1 # Minimum Instruction Length324 .byte 1 # Maximum Operations per Instruction325 .byte 1 # Default is_stmt326 .byte -5 # Line Base327 .byte 14 # Line Range328 .byte 13 # Opcode Base329 .byte 0 # Standard Opcode Lengths330 .byte 1331 .byte 1332 .byte 1333 .byte 1334 .byte 0335 .byte 0336 .byte 0337 .byte 1338 .byte 0339 .byte 0340 .byte 1341 # Directory table format342 .byte 1 # One element per directory entry343 .byte 1 # DW_LNCT_path344 .byte 0x0e # DW_FORM_strp (-> .debug_str)345 # Directory table entries346 .byte 2 # Two directories347 .long str_LT_5a348 .long str_LT_5b349 # File table format350 .byte 3 # Three elements per file entry351 .byte 1 # DW_LNCT_path352 .byte 0x1f # DW_FORM_line_strp (-> .debug_line_str)353 .byte 2 # DW_LNCT_directory_index354 .byte 0x0b # DW_FORM_data1355 .byte 5 # DW_LNCT_MD5356 .byte 0x1e # DW_FORM_data16357 # File table entries358 .byte 2 # Two files359 .long lstr_LT_5a360 .byte 0361 .quad 0x7766554433221100362 .quad 0xffeeddccbbaa9988363 .long lstr_LT_5b364 .byte 1365 .quad 0x8899aabbccddeeff366 .quad 0x0011223344556677367LH_5_header_end:368 # Line number program, which is empty.369LH_5_end:370 371# CHECK: Line table prologue:372# CHECK: version: 5373# CHECK: address_size: 8374# CHECK: seg_select_size: 0375# CHECK: max_ops_per_inst: 1376# Mixing .debug_str (here) with .debug_line_str (in file_names) is not377# something a producer would do, but both are legal and we want to test them.378# CHECK: include_directories[ 0] = .debug_str[0x00000045] = "Directory5a"379# CHECK: include_directories[ 1] = .debug_str[0x00000051] = "Directory5b"380# CHECK-NOT: include_directories381# CHECK: file_names[ 0]:382# CHECK-NEXT: name: .debug_line_str[0x00000000] = "File5a"383# CHECK-NEXT: dir_index: 0384# CHECK-NEXT: md5_checksum: 00112233445566778899aabbccddeeff385# CHECK: file_names[ 1]:386# CHECK-NEXT: name: .debug_line_str[0x00000007] = "File5b"387# CHECK-NEXT: dir_index: 1388# CHECK-NEXT: md5_checksum: ffeeddccbbaa99887766554433221100389# CHECK-NOT: file_names390 391 .section .debug_line_str,"MS",@progbits,1392lstr_LT_5a:393 .asciz "File5a"394lstr_LT_5b:395 .asciz "File5b"396 397 .section .debug_line.dwo,"e",@progbits398# CHECK-LABEL: .debug_line.dwo399 400# DWARF v5 DWO line-table header.401dwo_LH_5_start:402 .long dwo_LH_5_end-dwo_LH_5_version # Length of Unit403dwo_LH_5_version:404 .short 5 # DWARF version number405 .byte 8 # Address Size406 .byte 0 # Segment Selector Size407 .long dwo_LH_5_header_end-dwo_LH_5_params # Length of Prologue408dwo_LH_5_params:409 .byte 1 # Minimum Instruction Length410 .byte 1 # Maximum Operations per Instruction411 .byte 1 # Default is_stmt412 .byte -5 # Line Base413 .byte 14 # Line Range414 .byte 13 # Opcode Base415 .byte 0 # Standard Opcode Lengths416 .byte 1417 .byte 1418 .byte 1419 .byte 1420 .byte 0421 .byte 0422 .byte 0423 .byte 1424 .byte 0425 .byte 0426 .byte 1427 # Directory table format428 .byte 1 # One element per directory entry429 .byte 1 # DW_LNCT_path430 .byte 0x25 # DW_FORM_strx1 (-> .debug_str.dwo)431 # Directory table entries432 .byte 2 # Two directories433 .byte 3434 .byte 4435 # File table format436 .byte 4 # Four elements per file entry437 .byte 1 # DW_LNCT_path438 .byte 0x08 # DW_FORM_string439 .byte 2 # DW_LNCT_directory_index440 .byte 0x0b # DW_FORM_data1441 .byte 3 # DW_LNCT_timestamp442 .byte 0x0f # DW_FORM_udata443 .byte 4 # DW_LNCT_size444 .byte 0x0f # DW_FORM_udata445 # File table entries446 .byte 2 # Two files447 .asciz "DWOFile5a"448 .byte 0449 .byte 0x15450 .byte 0x25451 .asciz "DWOFile5b"452 .byte 1453 .byte 0x35454 .byte 0x45455dwo_LH_5_header_end:456 # Line number program, which is empty.457dwo_LH_5_end:458 459# CHECK: Line table prologue:460# CHECK: version: 5461# CHECK: address_size: 8462# CHECK: seg_select_size: 0463# CHECK: max_ops_per_inst: 1464# CHECK: include_directories[ 0] = indexed (00000003) string = "DWODirectory5a"465# CHECK: include_directories[ 1] = indexed (00000004) string = "DWODirectory5b"466# CHECK-NOT: include_directories467# CHECK: file_names[ 0]:468# CHECK-NEXT: name: "DWOFile5a"469# CHECK-NEXT: dir_index: 0470# CHECK-NEXT: mod_time: 0x00000015471# CHECK-NEXT: length: 0x00000025472# CHECK: file_names[ 1]:473# CHECK-NEXT: name: "DWOFile5b"474# CHECK-NEXT: dir_index: 1475# CHECK-NEXT: mod_time: 0x00000035476# CHECK-NEXT: length: 0x00000045477# CHECK-NOT: file_names478 479# VERIFY: Verifying .debug_types480# VERIFY: No errors.481