285 lines · plain
1# RUN: llvm-mc %s -filetype obj -triple x86_64-linux-elf -o - \2# RUN: | llvm-dwarfdump --debug-loc - \3# RUN: | FileCheck %s4 5# RUN: llvm-mc %s -filetype obj -triple x86_64-linux-elf -o - \6# RUN: | llvm-dwarfdump --verify - \7# RUN: | FileCheck %s --check-prefix VERIFY8 9# CHECK: .debug_loc contents:10 11# CHECK: 0x00000000:12# CHECK-NEXT: (0x0000000000000000, 0x0000000000000003): DW_OP_reg5 RDI13# CHECK-NEXT: (0x0000000000000003, 0x0000000000000004): DW_OP_reg0 RAX14 15# CHECK: 0x00000036:16# CHECK-NEXT: (0x0000000000000010, 0x0000000000000013): DW_OP_reg5 RDI17# CHECK-NEXT: (0x0000000000000013, 0x0000000000000014): DW_OP_reg0 RAX18 19# VERIFY: Verifying .debug_info Unit Header Chain20# VERIFY-NOT: DIE has invalid DW_AT_location encoding21 22# Source:23# int* foo(int* i) { return i; }24# int* bar(int* i) { return i; }25# Compile with:26# clang -g -O3 test.c -S -o debugloc.s27 28 .text29 .file "test.c"30 .globl foo31 .align 16, 0x9032 .type foo,@function33foo: # @foo34.Lfunc_begin0:35 .file 1 "test.c"36 .loc 1 1 0 # test.c:1:037 .cfi_startproc38# %bb.0:39 #DEBUG_VALUE: foo:i <- %RDI40 .loc 1 2 3 prologue_end # test.c:2:341 movq %rdi, %rax42.Ltmp0:43 #DEBUG_VALUE: foo:i <- %RAX44 retq45.Ltmp1:46.Lfunc_end0:47 .size foo, .Lfunc_end0-foo48 .cfi_endproc49 50 .globl bar51 .align 16, 0x9052 .type bar,@function53bar: # @bar54.Lfunc_begin1:55 .loc 1 5 0 # test.c:5:056 .cfi_startproc57# %bb.0:58 #DEBUG_VALUE: bar:i <- %RDI59 .loc 1 6 3 prologue_end # test.c:6:360 movq %rdi, %rax61.Ltmp2:62 #DEBUG_VALUE: bar:i <- %RAX63 retq64.Ltmp3:65.Lfunc_end1:66 .size bar, .Lfunc_end1-bar67 .cfi_endproc68 69 .section .debug_str,"MS",@progbits,170.Linfo_string0:71 .asciz "clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)" # string offset=072.Linfo_string1:73 .asciz "test.c" # string offset=5474.Linfo_string2:75 .asciz "/tmp" # string offset=6176.Linfo_string3:77 .asciz "foo" # string offset=6678.Linfo_string4:79 .asciz "int" # string offset=7080.Linfo_string5:81 .asciz "bar" # string offset=7482.Linfo_string6:83 .asciz "i" # string offset=7884 .section .debug_loc,"",@progbits85.Ldebug_loc0:86 .quad .Lfunc_begin0-.Lfunc_begin087 .quad .Ltmp0-.Lfunc_begin088 .short 1 # Loc expr size89 .byte 85 # DW_OP_reg590 .quad .Ltmp0-.Lfunc_begin091 .quad .Lfunc_end0-.Lfunc_begin092 .short 1 # Loc expr size93 .byte 80 # DW_OP_reg094 .quad 095 .quad 096.Ldebug_loc1:97 .quad .Lfunc_begin1-.Lfunc_begin098 .quad .Ltmp2-.Lfunc_begin099 .short 1 # Loc expr size100 .byte 85 # DW_OP_reg5101 .quad .Ltmp2-.Lfunc_begin0102 .quad .Lfunc_end1-.Lfunc_begin0103 .short 1 # Loc expr size104 .byte 80 # DW_OP_reg0105 .quad 0106 .quad 0107 .section .debug_abbrev,"",@progbits108.Lsection_abbrev:109 .byte 1 # Abbreviation Code110 .byte 17 # DW_TAG_compile_unit111 .byte 1 # DW_CHILDREN_yes112 .byte 37 # DW_AT_producer113 .byte 14 # DW_FORM_strp114 .byte 19 # DW_AT_language115 .byte 5 # DW_FORM_data2116 .byte 3 # DW_AT_name117 .byte 14 # DW_FORM_strp118 .byte 16 # DW_AT_stmt_list119 .byte 23 # DW_FORM_sec_offset120 .byte 27 # DW_AT_comp_dir121 .byte 14 # DW_FORM_strp122 .ascii "\341\177" # DW_AT_APPLE_optimized123 .byte 25 # DW_FORM_flag_present124 .byte 17 # DW_AT_low_pc125 .byte 1 # DW_FORM_addr126 .byte 18 # DW_AT_high_pc127 .byte 6 # DW_FORM_data4128 .byte 0 # EOM(1)129 .byte 0 # EOM(2)130 .byte 2 # Abbreviation Code131 .byte 46 # DW_TAG_subprogram132 .byte 1 # DW_CHILDREN_yes133 .byte 17 # DW_AT_low_pc134 .byte 1 # DW_FORM_addr135 .byte 18 # DW_AT_high_pc136 .byte 6 # DW_FORM_data4137 .ascii "\347\177" # DW_AT_APPLE_omit_frame_ptr138 .byte 25 # DW_FORM_flag_present139 .byte 64 # DW_AT_frame_base140 .byte 24 # DW_FORM_exprloc141 .byte 3 # DW_AT_name142 .byte 14 # DW_FORM_strp143 .byte 58 # DW_AT_decl_file144 .byte 11 # DW_FORM_data1145 .byte 59 # DW_AT_decl_line146 .byte 11 # DW_FORM_data1147 .byte 39 # DW_AT_prototyped148 .byte 25 # DW_FORM_flag_present149 .byte 73 # DW_AT_type150 .byte 19 # DW_FORM_ref4151 .byte 63 # DW_AT_external152 .byte 25 # DW_FORM_flag_present153 .ascii "\341\177" # DW_AT_APPLE_optimized154 .byte 25 # DW_FORM_flag_present155 .byte 0 # EOM(1)156 .byte 0 # EOM(2)157 .byte 3 # Abbreviation Code158 .byte 5 # DW_TAG_formal_parameter159 .byte 0 # DW_CHILDREN_no160 .byte 2 # DW_AT_location161 .byte 23 # DW_FORM_sec_offset162 .byte 3 # DW_AT_name163 .byte 14 # DW_FORM_strp164 .byte 58 # DW_AT_decl_file165 .byte 11 # DW_FORM_data1166 .byte 59 # DW_AT_decl_line167 .byte 11 # DW_FORM_data1168 .byte 73 # DW_AT_type169 .byte 19 # DW_FORM_ref4170 .byte 0 # EOM(1)171 .byte 0 # EOM(2)172 .byte 4 # Abbreviation Code173 .byte 15 # DW_TAG_pointer_type174 .byte 0 # DW_CHILDREN_no175 .byte 73 # DW_AT_type176 .byte 19 # DW_FORM_ref4177 .byte 0 # EOM(1)178 .byte 0 # EOM(2)179 .byte 5 # Abbreviation Code180 .byte 36 # DW_TAG_base_type181 .byte 0 # DW_CHILDREN_no182 .byte 3 # DW_AT_name183 .byte 14 # DW_FORM_strp184 .byte 62 # DW_AT_encoding185 .byte 11 # DW_FORM_data1186 .byte 11 # DW_AT_byte_size187 .byte 11 # DW_FORM_data1188 .byte 0 # EOM(1)189 .byte 0 # EOM(2)190 .byte 0 # EOM(3)191 .section .debug_info,"",@progbits192.Lsection_info:193.Lcu_begin0:194 .long 133 # Length of Unit195 .short 4 # DWARF version number196 .long .Lsection_abbrev # Offset Into Abbrev. Section197 .byte 8 # Address Size (in bytes)198 .byte 1 # Abbrev [1] 0xb:0x7e DW_TAG_compile_unit199 .long .Linfo_string0 # DW_AT_producer200 .short 12 # DW_AT_language201 .long .Linfo_string1 # DW_AT_name202 .long .Lline_table_start0 # DW_AT_stmt_list203 .long .Linfo_string2 # DW_AT_comp_dir204 # DW_AT_APPLE_optimized205 .quad .Lfunc_begin0 # DW_AT_low_pc206 .long .Lfunc_end1-.Lfunc_begin0 # DW_AT_high_pc207 .byte 2 # Abbrev [2] 0x2a:0x29 DW_TAG_subprogram208 .quad .Lfunc_begin0 # DW_AT_low_pc209 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc210 # DW_AT_APPLE_omit_frame_ptr211 .byte 1 # DW_AT_frame_base212 .byte 87213 .long .Linfo_string3 # DW_AT_name214 .byte 1 # DW_AT_decl_file215 .byte 1 # DW_AT_decl_line216 # DW_AT_prototyped217 .long 124 # DW_AT_type218 # DW_AT_external219 # DW_AT_APPLE_optimized220 .byte 3 # Abbrev [3] 0x43:0xf DW_TAG_formal_parameter221 .long .Ldebug_loc0 # DW_AT_location222 .long .Linfo_string6 # DW_AT_name223 .byte 1 # DW_AT_decl_file224 .byte 1 # DW_AT_decl_line225 .long 124 # DW_AT_type226 .byte 0 # End Of Children Mark227 .byte 2 # Abbrev [2] 0x53:0x29 DW_TAG_subprogram228 .quad .Lfunc_begin1 # DW_AT_low_pc229 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc230 # DW_AT_APPLE_omit_frame_ptr231 .byte 1 # DW_AT_frame_base232 .byte 87233 .long .Linfo_string5 # DW_AT_name234 .byte 1 # DW_AT_decl_file235 .byte 5 # DW_AT_decl_line236 # DW_AT_prototyped237 .long 124 # DW_AT_type238 # DW_AT_external239 # DW_AT_APPLE_optimized240 .byte 3 # Abbrev [3] 0x6c:0xf DW_TAG_formal_parameter241 .long .Ldebug_loc1 # DW_AT_location242 .long .Linfo_string6 # DW_AT_name243 .byte 1 # DW_AT_decl_file244 .byte 5 # DW_AT_decl_line245 .long 124 # DW_AT_type246 .byte 0 # End Of Children Mark247 .byte 4 # Abbrev [4] 0x7c:0x5 DW_TAG_pointer_type248 .long 129 # DW_AT_type249 .byte 5 # Abbrev [5] 0x81:0x7 DW_TAG_base_type250 .long .Linfo_string4 # DW_AT_name251 .byte 5 # DW_AT_encoding252 .byte 4 # DW_AT_byte_size253 .byte 0 # End Of Children Mark254 .section .debug_ranges,"",@progbits255.Ldebug_range:256 .section .debug_macinfo,"",@progbits257 .byte 0 # End Of Macro List Mark258 .section .debug_pubnames,"",@progbits259 .long .LpubNames_end0-.LpubNames_begin0 # Length of Public Names Info260.LpubNames_begin0:261 .short 2 # DWARF Version262 .long .Lcu_begin0 # Offset of Compilation Unit Info263 .long 137 # Compilation Unit Length264 .long 42 # DIE offset265 .asciz "foo" # External Name266 .long 83 # DIE offset267 .asciz "bar" # External Name268 .long 0 # End Mark269.LpubNames_end0:270 .section .debug_pubtypes,"",@progbits271 .long .LpubTypes_end0-.LpubTypes_begin0 # Length of Public Types Info272.LpubTypes_begin0:273 .short 2 # DWARF Version274 .long .Lcu_begin0 # Offset of Compilation Unit Info275 .long 137 # Compilation Unit Length276 .long 129 # DIE offset277 .asciz "int" # External Name278 .long 0 # End Mark279.LpubTypes_end0:280 281 .ident "clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)"282 .section ".note.GNU-stack","",@progbits283 .section .debug_line,"",@progbits284.Lline_table_start0:285