1# REQUIRES: system-linux 2 3# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o 4# RUN: %clang %cflags -dwarf-5 %t1.o -o %t.exe -Wl,-q 5# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections 6# RUN: llvm-dwarfdump --show-form --verbose --debug-line %t.exe | FileCheck --check-prefix=PRECHECK %s 7# RUN: llvm-dwarfdump --show-form --verbose --debug-line %t.bolt | FileCheck --check-prefix=POSTCHECK %s 8 9## This test checks that DWARF5 .debug_line is handled correctly. 10 11# PRECHECK: version: 5 12# PRECHECK: include_directories[ 0] = .debug_line_str 13# PRECHECK-SAME: ] = "." 14# PRECHECK-NEXT: file_names[ 0]: 15# PRECHECK-NEXT: name: .debug_line_str 16# PRECHECK-SAME: = "main.cpp" 17# PRECHECK-NEXT: dir_index: 0 18# PRECHECK-NEXT: md5_checksum: bb12fec8d002b1f0e06f7dee4604c6cc 19# PRECHECK-NOT: file_names[ 1]: 20 21# POSTCHECK: version: 5 22# POSTCHECK: include_directories[ 0] = .debug_line_str 23# POSTCHECK-SAME: ] = "." 24# POSTCHECK-NEXT: file_names[ 0]: 25# POSTCHECK-NEXT: name: .debug_line_str 26# POSTCHECK-SAME: ] = "main.cpp" 27# POSTCHECK-NEXT: dir_index: 0 28# POSTCHECK-NEXT: md5_checksum: bb12fec8d002b1f0e06f7dee4604c6cc 29# POSTCHECK-NOT: file_names[ 1]: 30 31# int main() { 32# return 0; 33# } 34 35 .text 36 .file "main.cpp" 37 .globl main # -- Begin function main 38 .p2align 4, 0x90 39 .type main,@function 40main: # @main 41.Lfunc_begin0: 42 .file 0 "." "main.cpp" md5 0xbb12fec8d002b1f0e06f7dee4604c6cc 43 .loc 0 1 0 # main.cpp:1:0 44 .cfi_startproc 45# %bb.0: # %entry 46 pushq %rbp 47 .cfi_def_cfa_offset 16 48 .cfi_offset %rbp, -16 49 movq %rsp, %rbp 50 .cfi_def_cfa_register %rbp 51 movl $0, -4(%rbp) 52.Ltmp0: 53 .loc 0 2 3 prologue_end # main.cpp:2:3 54 xorl %eax, %eax 55 popq %rbp 56 .cfi_def_cfa %rsp, 8 57 retq 58.Ltmp1: 59.Lfunc_end0: 60 .size main, .Lfunc_end0-main 61 .cfi_endproc 62 # -- End function 63 .section .debug_abbrev,"",@progbits 64 .byte 1 # Abbreviation Code 65 .byte 17 # DW_TAG_compile_unit 66 .byte 1 # DW_CHILDREN_yes 67 .byte 37 # DW_AT_producer 68 .byte 37 # DW_FORM_strx1 69 .byte 19 # DW_AT_language 70 .byte 5 # DW_FORM_data2 71 .byte 3 # DW_AT_name 72 .byte 37 # DW_FORM_strx1 73 .byte 114 # DW_AT_str_offsets_base 74 .byte 23 # DW_FORM_sec_offset 75 .byte 16 # DW_AT_stmt_list 76 .byte 23 # DW_FORM_sec_offset 77 .byte 27 # DW_AT_comp_dir 78 .byte 37 # DW_FORM_strx1 79 .byte 17 # DW_AT_low_pc 80 .byte 27 # DW_FORM_addrx 81 .byte 18 # DW_AT_high_pc 82 .byte 6 # DW_FORM_data4 83 .byte 115 # DW_AT_addr_base 84 .byte 23 # DW_FORM_sec_offset 85 .byte 0 # EOM(1) 86 .byte 0 # EOM(2) 87 .byte 2 # Abbreviation Code 88 .byte 46 # DW_TAG_subprogram 89 .byte 0 # DW_CHILDREN_no 90 .byte 17 # DW_AT_low_pc 91 .byte 27 # DW_FORM_addrx 92 .byte 18 # DW_AT_high_pc 93 .byte 6 # DW_FORM_data4 94 .byte 64 # DW_AT_frame_base 95 .byte 24 # DW_FORM_exprloc 96 .byte 3 # DW_AT_name 97 .byte 37 # DW_FORM_strx1 98 .byte 58 # DW_AT_decl_file 99 .byte 11 # DW_FORM_data1 100 .byte 59 # DW_AT_decl_line 101 .byte 11 # DW_FORM_data1 102 .byte 73 # DW_AT_type 103 .byte 19 # DW_FORM_ref4 104 .byte 63 # DW_AT_external 105 .byte 25 # DW_FORM_flag_present 106 .byte 0 # EOM(1) 107 .byte 0 # EOM(2) 108 .byte 3 # Abbreviation Code 109 .byte 36 # DW_TAG_base_type 110 .byte 0 # DW_CHILDREN_no 111 .byte 3 # DW_AT_name 112 .byte 37 # DW_FORM_strx1 113 .byte 62 # DW_AT_encoding 114 .byte 11 # DW_FORM_data1 115 .byte 11 # DW_AT_byte_size 116 .byte 11 # DW_FORM_data1 117 .byte 0 # EOM(1) 118 .byte 0 # EOM(2) 119 .byte 0 # EOM(3) 120 .section .debug_info,"",@progbits 121.Lcu_begin0: 122 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit 123.Ldebug_info_start0: 124 .short 5 # DWARF version number 125 .byte 1 # DWARF Unit Type 126 .byte 8 # Address Size (in bytes) 127 .long .debug_abbrev # Offset Into Abbrev. Section 128 .byte 1 # Abbrev [1] 0xc:0x2b DW_TAG_compile_unit 129 .byte 0 # DW_AT_producer 130 .short 33 # DW_AT_language 131 .byte 1 # DW_AT_name 132 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base 133 .long .Lline_table_start0 # DW_AT_stmt_list 134 .byte 2 # DW_AT_comp_dir 135 .byte 0 # DW_AT_low_pc 136 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc 137 .long .Laddr_table_base0 # DW_AT_addr_base 138 .byte 2 # Abbrev [2] 0x23:0xf DW_TAG_subprogram 139 .byte 0 # DW_AT_low_pc 140 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc 141 .byte 1 # DW_AT_frame_base 142 .byte 86 143 .byte 3 # DW_AT_name 144 .byte 0 # DW_AT_decl_file 145 .byte 1 # DW_AT_decl_line 146 .long 50 # DW_AT_type 147 # DW_AT_external 148 .byte 3 # Abbrev [3] 0x32:0x4 DW_TAG_base_type 149 .byte 4 # DW_AT_name 150 .byte 5 # DW_AT_encoding 151 .byte 4 # DW_AT_byte_size 152 .byte 0 # End Of Children Mark 153.Ldebug_info_end0: 154 .section .debug_str_offsets,"",@progbits 155 .long 24 # Length of String Offsets Set 156 .short 5 157 .short 0 158.Lstr_offsets_base0: 159 .section .debug_str,"MS",@progbits,1 160.Linfo_string0: 161 .asciz "clang version 15.0.0" # string offset=0 162.Linfo_string1: 163 .asciz "main.cpp" # string offset=134 164.Linfo_string2: 165 .asciz "." # string offset=143 166.Linfo_string3: 167 .asciz "main" # string offset=180 168.Linfo_string4: 169 .asciz "int" # string offset=185 170 .section .debug_str_offsets,"",@progbits 171 .long .Linfo_string0 172 .long .Linfo_string1 173 .long .Linfo_string2 174 .long .Linfo_string3 175 .long .Linfo_string4 176 .section .debug_addr,"",@progbits 177 .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution 178.Ldebug_addr_start0: 179 .short 5 # DWARF version number 180 .byte 8 # Address size 181 .byte 0 # Segment selector size 182.Laddr_table_base0: 183 .quad .Lfunc_begin0 184.Ldebug_addr_end0: 185 .ident "clang version 15.0.0" 186 .section ".note.GNU-stack","",@progbits 187 .addrsig 188 .section .debug_line,"",@progbits 189.Lline_table_start0: 190