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