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 - | \ 6# RUN: llvm-dwarfdump -v - | FileCheck %s 7 8 .section .debug_str,"MS",@progbits,1 9str_producer: 10 .asciz "Handmade DWARF producer" 11str_CU_4: 12 .asciz "V4_compile_unit" 13str_CU_5: 14 .asciz "V5_compile_unit" 15str_TU_4: 16 .asciz "V4_type_unit" 17str_LT_5a: 18 .asciz "Directory5a" 19str_LT_5b: 20 .asciz "Directory5b" 21 22 .section .debug_str.dwo,"MS",@progbits,1 23dwo_TU_5: 24 .asciz "V5_split_type_unit" 25dwo_producer: 26 .asciz "Handmade DWO producer" 27dwo_CU_5: 28 .asciz "V5_dwo_compile_unit" 29dwo_LT_5a: 30 .asciz "DWODirectory5a" 31dwo_LT_5b: 32 .asciz "DWODirectory5b" 33 34# All CUs/TUs use the same abbrev section for simplicity. 35 .section .debug_abbrev,"",@progbits 36 .byte 0x01 # Abbrev code 37 .byte 0x11 # DW_TAG_compile_unit 38 .byte 0x00 # DW_CHILDREN_no 39 .byte 0x25 # DW_AT_producer 40 .byte 0x0e # DW_FORM_strp 41 .byte 0x03 # DW_AT_name 42 .byte 0x0e # DW_FORM_strp 43 .byte 0x10 # DW_AT_stmt_list 44 .byte 0x17 # DW_FORM_sec_offset 45 .byte 0x00 # EOM(1) 46 .byte 0x00 # EOM(2) 47 .byte 0x02 # Abbrev code 48 .byte 0x41 # DW_TAG_type_unit 49 .byte 0x01 # DW_CHILDREN_yes 50 .byte 0x03 # DW_AT_name 51 .byte 0x0e # DW_FORM_strp 52 .byte 0x00 # EOM(1) 53 .byte 0x00 # EOM(2) 54 .byte 0x03 # Abbrev code 55 .byte 0x13 # DW_TAG_structure_type 56 .byte 0x00 # DW_CHILDREN_no (no members) 57 .byte 0x03 # DW_AT_name 58 .byte 0x0e # DW_FORM_strp 59 .byte 0x00 # EOM(1) 60 .byte 0x00 # EOM(2) 61 .byte 0x00 # EOM(3) 62 63# And a .dwo copy for the .dwo sections. 64 .section .debug_abbrev.dwo,"",@progbits 65 .byte 0x01 # Abbrev code 66 .byte 0x11 # DW_TAG_compile_unit 67 .byte 0x00 # DW_CHILDREN_no 68 .byte 0x25 # DW_AT_producer 69 .byte 0x0e # DW_FORM_strp 70 .byte 0x03 # DW_AT_name 71 .byte 0x0e # DW_FORM_strp 72 .byte 0x10 # DW_AT_stmt_list 73 .byte 0x17 # DW_FORM_sec_offset 74 .byte 0x00 # EOM(1) 75 .byte 0x00 # EOM(2) 76 .byte 0x02 # Abbrev code 77 .byte 0x41 # DW_TAG_type_unit 78 .byte 0x01 # DW_CHILDREN_yes 79 .byte 0x03 # DW_AT_name 80 .byte 0x0e # DW_FORM_strp 81 .byte 0x00 # EOM(1) 82 .byte 0x00 # EOM(2) 83 .byte 0x03 # Abbrev code 84 .byte 0x13 # DW_TAG_structure_type 85 .byte 0x00 # DW_CHILDREN_no (no members) 86 .byte 0x03 # DW_AT_name 87 .byte 0x0e # DW_FORM_strp 88 .byte 0x00 # EOM(1) 89 .byte 0x00 # EOM(2) 90 .byte 0x00 # EOM(3) 91 92 .section .debug_info,"",@progbits 93# CHECK-LABEL: .debug_info contents: 94 95# DWARF v4 CU header. V4 CU headers all look the same so we do only one. 96 .long CU_4_end-CU_4_version # Length of Unit 97CU_4_version: 98 .short 4 # DWARF version number 99 .long .debug_abbrev # Offset Into Abbrev. Section 100 .byte 8 # Address Size (in bytes) 101# The compile-unit DIE, with DW_AT_producer, DW_AT_name, DW_AT_stmt_list. 102 .byte 1 103 .long str_producer 104 .long str_CU_4 105 .long LH_4_start 106 .byte 0 # NULL 107CU_4_end: 108 109# CHECK: 0x00000000: Compile Unit: length = 0x00000015 version = 0x0004 abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x00000019) 110# CHECK: 0x0000000b: DW_TAG_compile_unit 111 112# DWARF v5 normal CU header. 113 .long CU_5_end-CU_5_version # Length of Unit 114CU_5_version: 115 .short 5 # DWARF version number 116 .byte 1 # DWARF Unit Type 117 .byte 8 # Address Size (in bytes) 118 .long .debug_abbrev # Offset Into Abbrev. Section 119# The compile-unit DIE, with DW_AT_producer, DW_AT_name, DW_AT_stmt_list. 120 .byte 1 121 .long str_producer 122 .long str_CU_5 123 .long LH_5_start 124 .byte 0 # NULL 125CU_5_end: 126 127# CHECK: 0x00000019: Compile Unit: length = 0x00000016 version = 0x0005 unit_type = DW_UT_compile abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x00000033) 128# CHECK: 0x00000025: DW_TAG_compile_unit 129 130 .section .debug_info.dwo,"",@progbits 131# CHECK-LABEL: .debug_info.dwo 132 133# DWARF v5 split CU header. 134 .long CU_split_5_end-CU_split_5_version # Length of Unit 135CU_split_5_version: 136 .short 5 # DWARF version number 137 .byte 5 # DWARF Unit Type 138 .byte 8 # Address Size (in bytes) 139 .long .debug_abbrev.dwo # Offset Into Abbrev. Section 140 .quad 0x5a # DWO ID 141# The split compile-unit DIE, with DW_AT_producer, DW_AT_name, DW_AT_stmt_list. 142 .byte 1 143 .long dwo_producer 144 .long dwo_CU_5 145 .long dwo_LH_5_start 146 .byte 0 # NULL 147CU_split_5_end: 148 149# CHECK: 0x00000000: Compile Unit: length = 0x0000001e version = 0x0005 unit_type = DW_UT_split_compile abbr_offset = 0x0000 addr_size = 0x08 DWO_id = 0x000000000000005a (next unit at 0x00000022) 150# CHECK: 0x00000014: DW_TAG_compile_unit 151# CHECK-NEXT: DW_AT_producer {{.*}} "Handmade DWO producer" 152# CHECK-NEXT: DW_AT_name {{.*}} "V5_dwo_compile_unit" 153 154 .section .debug_types,"",@progbits 155# CHECK-LABEL: .debug_types contents: 156 157# DWARF v4 Type unit header. Normal/split are identical so we do only one. 158TU_4_start: 159 .long TU_4_end-TU_4_version # Length of Unit 160TU_4_version: 161 .short 4 # DWARF version number 162 .long .debug_abbrev # Offset Into Abbrev. Section 163 .byte 8 # Address Size (in bytes) 164 .quad 0x0011223344556677 # Type Signature 165 .long TU_4_type-TU_4_start # Type offset 166# The type-unit DIE, which has a name. 167 .byte 2 168 .long str_TU_4 169# The type DIE, which has a name. 170TU_4_type: 171 .byte 3 172 .long str_TU_4 173 .byte 0 # NULL 174 .byte 0 # NULL 175TU_4_end: 176 177# CHECK: 0x00000000: Type Unit: length = 0x0000001f version = 0x0004 abbr_offset = 0x0000 addr_size = 0x08 name = 'V4_type_unit' type_signature = 0x0011223344556677 type_offset = 0x001c (next unit at 0x00000023) 178# CHECK: 0x00000017: DW_TAG_type_unit 179 180 .section .debug_types.dwo,"",@progbits 181# FIXME: DWARF v5 wants type units in .debug_info[.dwo] not .debug_types[.dwo]. 182# CHECK: .debug_types.dwo contents: 183 184# DWARF v5 split type unit header. 185TU_split_5_start: 186 .long TU_split_5_end-TU_split_5_version # Length of Unit 187TU_split_5_version: 188 .short 5 # DWARF version number 189 .byte 6 # DWARF Unit Type 190 .byte 8 # Address Size (in bytes) 191 .long .debug_abbrev.dwo # Offset Into Abbrev. Section 192 .quad 0x8899aabbccddeeff # Type Signature 193 .long TU_split_5_type-TU_split_5_start # Type offset 194# The type-unit DIE, which has a name. 195 .byte 2 196 .long dwo_TU_5 197# The type DIE, which has a name. 198TU_split_5_type: 199 .byte 3 200 .long dwo_TU_5 201 .byte 0 # NULL 202 .byte 0 # NULL 203TU_split_5_end: 204 205# CHECK: 0x00000000: Type Unit: length = 0x00000020 version = 0x0005 unit_type = DW_UT_split_type abbr_offset = 0x0000 addr_size = 0x08 name = 'V5_split_type_unit' type_signature = 0x8899aabbccddeeff type_offset = 0x001d (next unit at 0x00000024) 206# CHECK: 0x00000018: DW_TAG_type_unit 207 208 .section .debug_line,"",@progbits 209# CHECK-LABEL: .debug_line contents: 210 211# DWARF v4 line-table header. 212LH_4_start: 213 .long LH_4_end-LH_4_version # Length of Unit 214LH_4_version: 215 .short 4 # DWARF version number 216 .long LH_4_header_end-LH_4_params # Length of Prologue 217LH_4_params: 218 .byte 1 # Minimum Instruction Length 219 .byte 1 # Maximum Operations per Instruction 220 .byte 1 # Default is_stmt 221 .byte -5 # Line Base 222 .byte 14 # Line Range 223 .byte 13 # Opcode Base 224 .byte 0 # Standard Opcode Lengths 225 .byte 1 226 .byte 1 227 .byte 1 228 .byte 1 229 .byte 0 230 .byte 0 231 .byte 0 232 .byte 1 233 .byte 0 234 .byte 0 235 .byte 1 236 # Directory table 237 .asciz "Directory4a" 238 .asciz "Directory4b" 239 .byte 0 240 # File table 241 .asciz "File4a" # File name 1 242 .byte 1 # Directory index 1 243 .byte 0x41 # Timestamp 1 244 .byte 0x42 # File Size 1 245 .asciz "File4b" # File name 2 246 .byte 0 # Directory index 2 247 .byte 0x43 # Timestamp 2 248 .byte 0x44 # File Size 2 249 .byte 0 # End of list 250LH_4_header_end: 251 # Line number program, which is empty. 252LH_4_end: 253 254# CHECK: Line table prologue: 255# CHECK: version: 4 256# CHECK-NOT: address_size 257# CHECK-NOT: seg_select_size 258# CHECK: max_ops_per_inst: 1 259# CHECK: include_directories[ 1] = "Directory4a" 260# CHECK: include_directories[ 2] = "Directory4b" 261# CHECK-NOT: include_directories 262# CHECK: file_names[ 1]: 263# CHECK-NEXT: name: "File4a" 264# CHECK-NEXT: dir_index: 1 265# CHECK-NEXT: mod_time: 0x00000041 266# CHECK-NEXT: length: 0x00000042 267# CHECK: file_names[ 2]: 268# CHECK-NEXT: name: "File4b" 269# CHECK-NEXT: dir_index: 0 270# CHECK-NEXT: mod_time: 0x00000043 271# CHECK-NEXT: length: 0x00000044 272# CHECK-NOT: file_names 273 274# DWARF v5 line-table header. 275LH_5_start: 276 .long LH_5_end-LH_5_version # Length of Unit 277LH_5_version: 278 .short 5 # DWARF version number 279 .byte 8 # Address Size 280 .byte 0 # Segment Selector Size 281 .long LH_5_header_end-LH_5_params # Length of Prologue 282LH_5_params: 283 .byte 1 # Minimum Instruction Length 284 .byte 1 # Maximum Operations per Instruction 285 .byte 1 # Default is_stmt 286 .byte -5 # Line Base 287 .byte 14 # Line Range 288 .byte 13 # Opcode Base 289 .byte 0 # Standard Opcode Lengths 290 .byte 1 291 .byte 1 292 .byte 1 293 .byte 1 294 .byte 0 295 .byte 0 296 .byte 0 297 .byte 1 298 .byte 0 299 .byte 0 300 .byte 1 301 # Directory table format 302 .byte 1 # One element per directory entry 303 .byte 1 # DW_LNCT_path 304 .byte 0x0e # DW_FORM_strp (-> .debug_str) 305 # Directory table entries 306 .byte 2 # Two directories 307 .long str_LT_5a 308 .long str_LT_5b 309 # File table format 310 .byte 3 # Three elements per file entry 311 .byte 1 # DW_LNCT_path 312 .byte 0x1f # DW_FORM_line_strp (-> .debug_line_str) 313 .byte 2 # DW_LNCT_directory_index 314 .byte 0x0b # DW_FORM_data1 315 .byte 5 # DW_LNCT_MD5 316 .byte 0x1e # DW_FORM_data16 317 # File table entries 318 .byte 2 # Two files 319 .long lstr_LT_5a 320 .byte 0 321 .quad 0x7766554433221100 322 .quad 0xffeeddccbbaa9988 323 .long lstr_LT_5b 324 .byte 1 325 .quad 0x8899aabbccddeeff 326 .quad 0x0011223344556677 327LH_5_header_end: 328 # Line number program, which is empty. 329LH_5_end: 330 331# CHECK: Line table prologue: 332# CHECK: version: 5 333# CHECK: address_size: 8 334# CHECK: seg_select_size: 0 335# CHECK: max_ops_per_inst: 1 336# Mixing .debug_str (here) with .debug_line_str (in file_names) is not 337# something a producer would do, but both are legal and we want to test them. 338# CHECK: include_directories[ 0] = .debug_str[0x00000045] = "Directory5a" 339# CHECK: include_directories[ 1] = .debug_str[0x00000051] = "Directory5b" 340# CHECK-NOT: include_directories 341# CHECK: file_names[ 0]: 342# CHECK-NEXT: name: .debug_line_str[0x00000000] = "File5a" 343# CHECK-NEXT: dir_index: 0 344# CHECK-NEXT: md5_checksum: 00112233445566778899aabbccddeeff 345# CHECK: file_names[ 1]: 346# CHECK-NEXT: name: .debug_line_str[0x00000007] = "File5b" 347# CHECK-NEXT: dir_index: 1 348# CHECK-NEXT: md5_checksum: ffeeddccbbaa99887766554433221100 349# CHECK-NOT: file_names 350 351 .section .debug_line_str,"MS",@progbits,1 352lstr_LT_5a: 353 .asciz "File5a" 354lstr_LT_5b: 355 .asciz "File5b" 356 357 .section .debug_line.dwo,"",@progbits 358# CHECK-LABEL: .debug_line.dwo 359 360# DWARF v5 DWO line-table header. 361dwo_LH_5_start: 362 .long dwo_LH_5_end-dwo_LH_5_version # Length of Unit 363dwo_LH_5_version: 364 .short 5 # DWARF version number 365 .byte 8 # Address Size 366 .byte 0 # Segment Selector Size 367 .long dwo_LH_5_header_end-dwo_LH_5_params # Length of Prologue 368dwo_LH_5_params: 369 .byte 1 # Minimum Instruction Length 370 .byte 1 # Maximum Operations per Instruction 371 .byte 1 # Default is_stmt 372 .byte -5 # Line Base 373 .byte 14 # Line Range 374 .byte 13 # Opcode Base 375 .byte 0 # Standard Opcode Lengths 376 .byte 1 377 .byte 1 378 .byte 1 379 .byte 1 380 .byte 0 381 .byte 0 382 .byte 0 383 .byte 1 384 .byte 0 385 .byte 0 386 .byte 1 387 # Directory table format 388 .byte 1 # One element per directory entry 389 .byte 1 # DW_LNCT_path 390 .byte 0x0e # DW_FORM_strp (-> .debug_str.dwo) 391 # Directory table entries 392 .byte 2 # Two directories 393 .long dwo_LT_5a 394 .long dwo_LT_5b 395 # File table format 396 .byte 4 # Four elements per file entry 397 .byte 1 # DW_LNCT_path 398 .byte 0x08 # DW_FORM_string 399 .byte 2 # DW_LNCT_directory_index 400 .byte 0x0b # DW_FORM_data1 401 .byte 3 # DW_LNCT_timestamp 402 .byte 0x0f # DW_FORM_udata 403 .byte 4 # DW_LNCT_size 404 .byte 0x0f # DW_FORM_udata 405 # File table entries 406 .byte 2 # Two files 407 .asciz "DWOFile5a" 408 .byte 0 409 .byte 0x15 410 .byte 0x25 411 .asciz "DWOFile5b" 412 .byte 1 413 .byte 0x35 414 .byte 0x45 415dwo_LH_5_header_end: 416 # Line number program, which is empty. 417dwo_LH_5_end: 418 419# CHECK: Line table prologue: 420# CHECK: version: 5 421# CHECK: address_size: 8 422# CHECK: seg_select_size: 0 423# CHECK: max_ops_per_inst: 1 424# CHECK: include_directories[ 0] = .debug_str[0x0000003d] = "DWODirectory5a" 425# CHECK: include_directories[ 1] = .debug_str[0x0000004c] = "DWODirectory5b" 426# CHECK-NOT: include_directories 427# CHECK: file_names[ 0]: 428# CHECK-NEXT: name: "DWOFile5a" 429# CHECK-NEXT: dir_index: 0 430# CHECK-NEXT: mod_time: 0x00000015 431# CHECK-NEXT: length: 0x00000025 432# CHECK: file_names[ 1]: 433# CHECK-NEXT: name: "DWOFile5b" 434# CHECK-NEXT: dir_index: 1 435# CHECK-NEXT: mod_time: 0x00000035 436# CHECK-NEXT: length: 0x00000045 437# CHECK-NOT: file_names 438