1 # RUN: llvm-mc %s -filetype obj -triple x86_64-linux-elf -o - \
2 # RUN: | llvm-dwarfdump --debug-loc - \
5 # RUN: llvm-mc %s -filetype obj -triple x86_64-linux-elf -o - \
6 # RUN: | llvm-dwarfdump --verify - \
7 # RUN: | FileCheck %s --check-prefix VERIFY
9 # CHECK: .debug_loc contents:
12 # CHECK-NEXT: (0x0000000000000000, 0x0000000000000003): DW_OP_reg5 RDI
13 # CHECK-NEXT: (0x0000000000000003, 0x0000000000000004): DW_OP_reg0 RAX
16 # CHECK-NEXT: (0x0000000000000010, 0x0000000000000013): DW_OP_reg5 RDI
17 # CHECK-NEXT: (0x0000000000000013, 0x0000000000000014): DW_OP_reg0 RAX
19 # VERIFY: Verifying .debug_info Unit Header Chain
20 # VERIFY-NOT: DIE has invalid DW_AT_location encoding
23 # int* foo(int* i) { return i; }
24 # int* bar(int* i) { return i; }
26 # clang -g -O3 test.c -S -o debugloc.s
36 .loc 1 1 0 # test.c:1:0
39 #DEBUG_VALUE: foo:i <- %RDI
40 .loc 1 2 3 prologue_end # test.c:2:3
43 #DEBUG_VALUE: foo:i <- %RAX
47 .size foo, .Lfunc_end0-foo
55 .loc 1 5 0 # test.c:5:0
58 #DEBUG_VALUE: bar:i <- %RDI
59 .loc 1 6 3 prologue_end # test.c:6:3
62 #DEBUG_VALUE: bar:i <- %RAX
66 .size bar, .Lfunc_end1-bar
69 .section .debug_str,"MS",@progbits,1
71 .asciz "clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)" # string offset=0
73 .asciz "test.c" # string offset=54
75 .asciz "/tmp" # string offset=61
77 .asciz "foo" # string offset=66
79 .asciz "int" # string offset=70
81 .asciz "bar" # string offset=74
83 .asciz "i" # string offset=78
84 .section .debug_loc,"",@progbits
86 .quad .Lfunc_begin0-.Lfunc_begin0
87 .quad .Ltmp0-.Lfunc_begin0
88 .short 1 # Loc expr size
90 .quad .Ltmp0-.Lfunc_begin0
91 .quad .Lfunc_end0-.Lfunc_begin0
92 .short 1 # Loc expr size
97 .quad .Lfunc_begin1-.Lfunc_begin0
98 .quad .Ltmp2-.Lfunc_begin0
99 .short 1 # Loc expr size
100 .byte 85 # DW_OP_reg5
101 .quad .Ltmp2-.Lfunc_begin0
102 .quad .Lfunc_end1-.Lfunc_begin0
103 .short 1 # Loc expr size
104 .byte 80 # DW_OP_reg0
107 .section .debug_abbrev,"",@progbits
109 .byte 1 # Abbreviation Code
110 .byte 17 # DW_TAG_compile_unit
111 .byte 1 # DW_CHILDREN_yes
112 .byte 37 # DW_AT_producer
113 .byte 14 # DW_FORM_strp
114 .byte 19 # DW_AT_language
115 .byte 5 # DW_FORM_data2
117 .byte 14 # DW_FORM_strp
118 .byte 16 # DW_AT_stmt_list
119 .byte 23 # DW_FORM_sec_offset
120 .byte 27 # DW_AT_comp_dir
121 .byte 14 # DW_FORM_strp
122 .ascii "\341\177" # DW_AT_APPLE_optimized
123 .byte 25 # DW_FORM_flag_present
124 .byte 17 # DW_AT_low_pc
125 .byte 1 # DW_FORM_addr
126 .byte 18 # DW_AT_high_pc
127 .byte 6 # DW_FORM_data4
130 .byte 2 # Abbreviation Code
131 .byte 46 # DW_TAG_subprogram
132 .byte 1 # DW_CHILDREN_yes
133 .byte 17 # DW_AT_low_pc
134 .byte 1 # DW_FORM_addr
135 .byte 18 # DW_AT_high_pc
136 .byte 6 # DW_FORM_data4
137 .ascii "\347\177" # DW_AT_APPLE_omit_frame_ptr
138 .byte 25 # DW_FORM_flag_present
139 .byte 64 # DW_AT_frame_base
140 .byte 24 # DW_FORM_exprloc
142 .byte 14 # DW_FORM_strp
143 .byte 58 # DW_AT_decl_file
144 .byte 11 # DW_FORM_data1
145 .byte 59 # DW_AT_decl_line
146 .byte 11 # DW_FORM_data1
147 .byte 39 # DW_AT_prototyped
148 .byte 25 # DW_FORM_flag_present
149 .byte 73 # DW_AT_type
150 .byte 19 # DW_FORM_ref4
151 .byte 63 # DW_AT_external
152 .byte 25 # DW_FORM_flag_present
153 .ascii "\341\177" # DW_AT_APPLE_optimized
154 .byte 25 # DW_FORM_flag_present
157 .byte 3 # Abbreviation Code
158 .byte 5 # DW_TAG_formal_parameter
159 .byte 0 # DW_CHILDREN_no
160 .byte 2 # DW_AT_location
161 .byte 23 # DW_FORM_sec_offset
163 .byte 14 # DW_FORM_strp
164 .byte 58 # DW_AT_decl_file
165 .byte 11 # DW_FORM_data1
166 .byte 59 # DW_AT_decl_line
167 .byte 11 # DW_FORM_data1
168 .byte 73 # DW_AT_type
169 .byte 19 # DW_FORM_ref4
172 .byte 4 # Abbreviation Code
173 .byte 15 # DW_TAG_pointer_type
174 .byte 0 # DW_CHILDREN_no
175 .byte 73 # DW_AT_type
176 .byte 19 # DW_FORM_ref4
179 .byte 5 # Abbreviation Code
180 .byte 36 # DW_TAG_base_type
181 .byte 0 # DW_CHILDREN_no
183 .byte 14 # DW_FORM_strp
184 .byte 62 # DW_AT_encoding
185 .byte 11 # DW_FORM_data1
186 .byte 11 # DW_AT_byte_size
187 .byte 11 # DW_FORM_data1
191 .section .debug_info,"",@progbits
194 .long 133 # Length of Unit
195 .short 4 # DWARF version number
196 .long .Lsection_abbrev # Offset Into Abbrev. Section
197 .byte 8 # Address Size (in bytes)
198 .byte 1 # Abbrev [1] 0xb:0x7e DW_TAG_compile_unit
199 .long .Linfo_string0 # DW_AT_producer
200 .short 12 # DW_AT_language
201 .long .Linfo_string1 # DW_AT_name
202 .long .Lline_table_start0 # DW_AT_stmt_list
203 .long .Linfo_string2 # DW_AT_comp_dir
204 # DW_AT_APPLE_optimized
205 .quad .Lfunc_begin0 # DW_AT_low_pc
206 .long .Lfunc_end1-.Lfunc_begin0 # DW_AT_high_pc
207 .byte 2 # Abbrev [2] 0x2a:0x29 DW_TAG_subprogram
208 .quad .Lfunc_begin0 # DW_AT_low_pc
209 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
210 # DW_AT_APPLE_omit_frame_ptr
211 .byte 1 # DW_AT_frame_base
213 .long .Linfo_string3 # DW_AT_name
214 .byte 1 # DW_AT_decl_file
215 .byte 1 # DW_AT_decl_line
217 .long 124 # DW_AT_type
219 # DW_AT_APPLE_optimized
220 .byte 3 # Abbrev [3] 0x43:0xf DW_TAG_formal_parameter
221 .long .Ldebug_loc0 # DW_AT_location
222 .long .Linfo_string6 # DW_AT_name
223 .byte 1 # DW_AT_decl_file
224 .byte 1 # DW_AT_decl_line
225 .long 124 # DW_AT_type
226 .byte 0 # End Of Children Mark
227 .byte 2 # Abbrev [2] 0x53:0x29 DW_TAG_subprogram
228 .quad .Lfunc_begin1 # DW_AT_low_pc
229 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
230 # DW_AT_APPLE_omit_frame_ptr
231 .byte 1 # DW_AT_frame_base
233 .long .Linfo_string5 # DW_AT_name
234 .byte 1 # DW_AT_decl_file
235 .byte 5 # DW_AT_decl_line
237 .long 124 # DW_AT_type
239 # DW_AT_APPLE_optimized
240 .byte 3 # Abbrev [3] 0x6c:0xf DW_TAG_formal_parameter
241 .long .Ldebug_loc1 # DW_AT_location
242 .long .Linfo_string6 # DW_AT_name
243 .byte 1 # DW_AT_decl_file
244 .byte 5 # DW_AT_decl_line
245 .long 124 # DW_AT_type
246 .byte 0 # End Of Children Mark
247 .byte 4 # Abbrev [4] 0x7c:0x5 DW_TAG_pointer_type
248 .long 129 # DW_AT_type
249 .byte 5 # Abbrev [5] 0x81:0x7 DW_TAG_base_type
250 .long .Linfo_string4 # DW_AT_name
251 .byte 5 # DW_AT_encoding
252 .byte 4 # DW_AT_byte_size
253 .byte 0 # End Of Children Mark
254 .section .debug_ranges,"",@progbits
256 .section .debug_macinfo,"",@progbits
257 .byte 0 # End Of Macro List Mark
258 .section .debug_pubnames,"",@progbits
259 .long .LpubNames_end0-.LpubNames_begin0 # Length of Public Names Info
261 .short 2 # DWARF Version
262 .long .Lcu_begin0 # Offset of Compilation Unit Info
263 .long 137 # Compilation Unit Length
264 .long 42 # DIE offset
265 .asciz "foo" # External Name
266 .long 83 # DIE offset
267 .asciz "bar" # External Name
270 .section .debug_pubtypes,"",@progbits
271 .long .LpubTypes_end0-.LpubTypes_begin0 # Length of Public Types Info
273 .short 2 # DWARF Version
274 .long .Lcu_begin0 # Offset of Compilation Unit Info
275 .long 137 # Compilation Unit Length
276 .long 129 # DIE offset
277 .asciz "int" # External Name
281 .ident "clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)"
282 .section ".note.GNU-stack","",@progbits
283 .section .debug_line,"",@progbits