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 .byte 0x00 # EOM(3) 45 46.ifdef ELF 47 .section .debug_info,"",@progbits 48.endif 49.ifdef MACHO 50 .section __DWARF,__debug_info,regular,debug 51.endif 52 53# DWARF-32 v5 normal CU header. 54Lset0 = CU_5_end-CU_5_version # Length of Unit 55 .long Lset0 56CU_5_version: 57 .short 5 # DWARF version number 58 .byte 1 # DWARF Unit Type 59 .byte 8 # Address Size (in bytes) 60.ifdef ELF 61 .long abbrev # Offset Into Abbrev. Section 62.endif 63.ifdef MACHO 64 .long 0 65.endif 66# The compile-unit DIE, with DW_AT_producer, DW_AT_name, DW_AT_stmt_list. 67 .byte 1 68 .long str_producer 69 .long str_CU_5 70.ifdef ELF 71 .long LH_5_start 72.endif 73.ifdef MACHO 74 .long 0 75.endif 76 .byte 0 # NULL 77CU_5_end: 78 79# CHECK-LABEL: .debug_info contents: 80# 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) 81# CHECK: 0x0000000c: DW_TAG_compile_unit 82# CHECK-NEXT: DW_AT_producer {{.*}} "Handmade DWARF producer" 83# CHECK-NEXT: DW_AT_name {{.*}} "V5_compile_unit" 84# CHECK-NEXT: DW_AT_stmt_list {{.*}} (0x00000000) 85 86.ifdef ELF 87 .section .debug_line,"",@progbits 88.endif 89.ifdef MACHO 90 .section __DWARF,__debug_line,regular,debug 91.endif 92 93# DWARF-64 v5 line-table header. 94LH_5_start: 95 .long -1 96Lset1 = LH_5_end-LH_5_version # Length of Unit 97 .quad Lset1 98LH_5_version: 99 .short 5 # DWARF version number 100 .byte 8 # Address Size 101 .byte 0 # Segment Selector Size 102Lset2 = LH_5_header_end-LH_5_params # Length of Prologue 103 .quad Lset2 104LH_5_params: 105 .byte 1 # Minimum Instruction Length 106 .byte 1 # Maximum Operations per Instruction 107 .byte 1 # Default is_stmt 108 .byte -5 # Line Base 109 .byte 14 # Line Range 110 .byte 13 # Opcode Base 111 .byte 0 # Standard Opcode Lengths 112 .byte 1 113 .byte 1 114 .byte 1 115 .byte 1 116 .byte 0 117 .byte 0 118 .byte 0 119 .byte 1 120 .byte 0 121 .byte 0 122 .byte 1 123 # Directory table format 124 .byte 1 # One element per directory entry 125 .byte 1 # DW_LNCT_path 126 .byte 0x0e # DW_FORM_strp (-> .debug_str) 127 # Directory table entries 128 .byte 2 # Two directories 129 .quad str_LT_5a 130 .quad str_LT_5b 131 # File table format 132 .byte 4 # Four elements per file entry 133 .byte 1 # DW_LNCT_path 134 .byte 0x08 # DW_FORM_string 135 .byte 2 # DW_LNCT_directory_index 136 .byte 0x0b # DW_FORM_data1 137 .byte 3 # DW_LNCT_timestamp 138 .byte 0x0f # DW_FORM_udata 139 .byte 4 # DW_LNCT_size 140 .byte 0x0f # DW_FORM_udata 141 # File table entries 142 .byte 2 # Two files 143 .asciz "File5a" 144 .byte 0 145 .byte 0x51 146 .byte 0x52 147 .asciz "File5b" 148 .byte 1 149 .byte 0x53 150 .byte 0x54 151LH_5_header_end: 152 # Line number program, which is empty. 153LH_5_end: 154 155# CHECK-LABEL: .debug_line contents: 156# CHECK: Line table prologue: 157# CHECK: total_length: 0x0000000000000050 158# CHECK: version: 5 159# CHECK: address_size: 8 160# CHECK: seg_select_size: 0 161# CHECK: prologue_length: 0x0000000000000044 162# CHECK: max_ops_per_inst: 1 163# CHECK: include_directories[ 0] = .debug_str[0x0000000000000028] = "Directory5a" 164# CHECK: include_directories[ 1] = .debug_str[0x0000000000000034] = "Directory5b" 165# CHECK-NOT: include_directories 166# CHECK: file_names[ 0]: 167# CHECK-NEXT: name: "File5a" 168# CHECK-NEXT: dir_index: 0 169# CHECK-NEXT: mod_time: 0x00000051 170# CHECK-NEXT: length: 0x00000052 171# CHECK: file_names[ 1]: 172# CHECK-NEXT: name: "File5b" 173# CHECK-NEXT: dir_index: 1 174# CHECK-NEXT: mod_time: 0x00000053 175# CHECK-NEXT: length: 0x00000054 176# CHECK-NOT: file_names 177