1# Test object to verify dwarfdump handles a DWARF-64 v5 line header. 2# FIXME: Make the other headers DWARF-64 also. 3# FIXME: Add variants for earlier DWARF versions. 4 5# RUN: llvm-mc -triple x86_64-unknown-linux --defsym ELF=0 \ 6# RUN: -filetype=obj -o - %s | llvm-dwarfdump -v - | FileCheck %s 7 8# RUN: llvm-mc -triple x86_64-apple-darwin --defsym MACHO=0 \ 9# RUN: -filetype=obj -o - %s | llvm-dwarfdump -v - | FileCheck %s 10 11.ifdef ELF 12 .section .debug_str,"MS",@progbits,1 13.endif 14.ifdef MACHO 15 .section __DWARF,__debug_str,regular,debug 16.endif 17str_producer: 18 .asciz "Handmade DWARF producer" 19str_CU_5: 20 .asciz "V5_compile_unit" 21str_LT_5a: 22 .asciz "Directory5a" 23str_LT_5b: 24 .asciz "Directory5b" 25 26.ifdef ELF 27 .section .debug_abbrev,"",@progbits 28.endif 29.ifdef MACHO 30 .section __DWARF,__debug_abbrev,regular,debug 31.endif 32abbrev: 33 .byte 0x01 # Abbrev code 34 .byte 0x11 # DW_TAG_compile_unit 35 .byte 0x00 # DW_CHILDREN_no 36 .byte 0x25 # DW_AT_producer 37 .byte 0x0e # DW_FORM_strp 38 .byte 0x03 # DW_AT_name 39 .byte 0x0e # DW_FORM_strp 40 .byte 0x10 # DW_AT_stmt_list 41 .byte 0x17 # DW_FORM_sec_offset 42 .byte 0x00 # EOM(1) 43 .byte 0x00 # EOM(2) 44 45.ifdef ELF 46 .section .debug_info,"",@progbits 47.endif 48.ifdef MACHO 49 .section __DWARF,__debug_info,regular,debug 50.endif 51 52# DWARF-32 v5 normal CU header. 53Lset0 = CU_5_end-CU_5_version # Length of Unit 54 .long Lset0 55CU_5_version: 56 .short 5 # DWARF version number 57 .byte 1 # DWARF Unit Type 58 .byte 8 # Address Size (in bytes) 59.ifdef ELF 60 .long abbrev # Offset Into Abbrev. Section 61.endif 62.ifdef MACHO 63 .long 0 64.endif 65# The compile-unit DIE, with DW_AT_producer, DW_AT_name, DW_AT_stmt_list. 66 .byte 1 67 .long str_producer 68 .long str_CU_5 69.ifdef ELF 70 .long LH_5_start 71.endif 72.ifdef MACHO 73 .long 0 74.endif 75 .byte 0 # NULL 76CU_5_end: 77 78# CHECK-LABEL: .debug_info contents: 79# CHECK: 0x00000000: Compile Unit: length = 0x00000016, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x0000001a) 80# CHECK: 0x0000000c: DW_TAG_compile_unit 81# CHECK-NEXT: DW_AT_producer {{.*}} "Handmade DWARF producer" 82# CHECK-NEXT: DW_AT_name {{.*}} "V5_compile_unit" 83# CHECK-NEXT: DW_AT_stmt_list {{.*}} (0x00000000) 84 85.ifdef ELF 86 .section .debug_line,"",@progbits 87.endif 88.ifdef MACHO 89 .section __DWARF,__debug_line,regular,debug 90.endif 91 92# DWARF-64 v5 line-table header. 93LH_5_start: 94 .long -1 95Lset1 = LH_5_end-LH_5_version # Length of Unit 96 .quad Lset1 97LH_5_version: 98 .short 5 # DWARF version number 99 .byte 8 # Address Size 100 .byte 0 # Segment Selector Size 101Lset2 = LH_5_header_end-LH_5_params # Length of Prologue 102 .quad Lset2 103LH_5_params: 104 .byte 1 # Minimum Instruction Length 105 .byte 1 # Maximum Operations per Instruction 106 .byte 1 # Default is_stmt 107 .byte -5 # Line Base 108 .byte 14 # Line Range 109 .byte 13 # Opcode Base 110 .byte 0 # Standard Opcode Lengths 111 .byte 1 112 .byte 1 113 .byte 1 114 .byte 1 115 .byte 0 116 .byte 0 117 .byte 0 118 .byte 1 119 .byte 0 120 .byte 0 121 .byte 1 122 # Directory table format 123 .byte 1 # One element per directory entry 124 .byte 1 # DW_LNCT_path 125 .byte 0x0e # DW_FORM_strp (-> .debug_str) 126 # Directory table entries 127 .byte 2 # Two directories 128 .quad str_LT_5a 129 .quad str_LT_5b 130 # File table format 131 .byte 4 # Four elements per file entry 132 .byte 1 # DW_LNCT_path 133 .byte 0x08 # DW_FORM_string 134 .byte 2 # DW_LNCT_directory_index 135 .byte 0x0b # DW_FORM_data1 136 .byte 3 # DW_LNCT_timestamp 137 .byte 0x0f # DW_FORM_udata 138 .byte 4 # DW_LNCT_size 139 .byte 0x0f # DW_FORM_udata 140 # File table entries 141 .byte 2 # Two files 142 .asciz "File5a" 143 .byte 0 144 .byte 0x51 145 .byte 0x52 146 .asciz "File5b" 147 .byte 1 148 .byte 0x53 149 .byte 0x54 150LH_5_header_end: 151 # Line number program, which is empty. 152LH_5_end: 153 154# CHECK-LABEL: .debug_line contents: 155# CHECK: Line table prologue: 156# CHECK: total_length: 0x0000000000000050 157# CHECK: version: 5 158# CHECK: address_size: 8 159# CHECK: seg_select_size: 0 160# CHECK: prologue_length: 0x0000000000000044 161# CHECK: max_ops_per_inst: 1 162# CHECK: include_directories[ 0] = .debug_str[0x0000000000000028] = "Directory5a" 163# CHECK: include_directories[ 1] = .debug_str[0x0000000000000034] = "Directory5b" 164# CHECK-NOT: include_directories 165# CHECK: file_names[ 0]: 166# CHECK-NEXT: name: "File5a" 167# CHECK-NEXT: dir_index: 0 168# CHECK-NEXT: mod_time: 0x00000051 169# CHECK-NEXT: length: 0x00000052 170# CHECK: file_names[ 1]: 171# CHECK-NEXT: name: "File5b" 172# CHECK-NEXT: dir_index: 1 173# CHECK-NEXT: mod_time: 0x00000053 174# CHECK-NEXT: length: 0x00000054 175# CHECK-NOT: file_names 176