1 # REQUIRES: system-linux
3 # RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %tmain.o
4 # RUN: %clang %cflags -dwarf-5 %tmain.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-info %t.exe | FileCheck --check-prefix=PRECHECK %s
7 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt | FileCheck --check-prefix=POSTCHECK %s
9 ## This test checks that we correctly encode new index into .debug_addr section
10 ## from DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x#)
12 # PRECHECK: version = 0x0005
13 # PRECHECK: DW_TAG_variable
14 # PRECHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x0)
15 # PRECHECK: DW_TAG_variable
16 # PRECHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x1)
19 # POSTCHECK: version = 0x0005
20 # POSTCHECK: DW_TAG_variable
21 # POSTCHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x2)
23 # POSTCHECK: DW_TAG_variable
24 # POSTCHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x3)
27 # clang++ main.cpp -g -O2
28 # void use(int * x, int * y) {
35 # int main(int argc, char *argv[]) {
44 .file 0 "/testLocExprLoc" "main.cpp" md5 0xd4fd79ce0087c4cefd089752bf2182c6
45 .globl _Z3usePiS_ # -- Begin function _Z3usePiS_
47 .type _Z3usePiS_,@function
48 _Z3usePiS_
: # @_Z3usePiS_
50 .loc 0 1 0 # main.cpp:1:0
53 #DEBUG_VALUE: use:x <- $rdi
54 #DEBUG_VALUE: use:y <- $rsi
55 .loc 0 2 4 prologue_end # main.cpp:2:4
57 .loc 0 3 4 # main.cpp:3:4
59 .loc 0 4 1 # main.cpp:4:1
63 .size _Z3usePiS_, .Lfunc_end0-_Z3usePiS_
66 .globl main # -- Begin function main
71 .loc 0 8 0 # main.cpp:8:0
74 #DEBUG_VALUE: main:argc <- $edi
75 #DEBUG_VALUE: main:argv <- $rsi
76 # kill: def $edi killed $edi def $rdi
77 .loc 0 2 4 prologue_end # main.cpp:2:4
81 #DEBUG_VALUE: use:x <- undef
82 .loc 0 3 4 # main.cpp:3:4
86 #DEBUG_VALUE: use:y <- undef
87 .loc 0 12 13 # main.cpp:12:13
88 leal
(%rdi
,%rdi
), %eax
90 .loc 0 12 4 is_stmt 0 # main.cpp:12:4
94 .size main, .Lfunc_end1-main
113 .section .debug_abbrev,"",@progbits
114 .byte 1 # Abbreviation Code
115 .byte 17 # DW_TAG_compile_unit
116 .byte 1 # DW_CHILDREN_yes
117 .byte 37 # DW_AT_producer
118 .byte 37 # DW_FORM_strx1
119 .byte 19 # DW_AT_language
120 .byte 5 # DW_FORM_data2
122 .byte 37 # DW_FORM_strx1
123 .byte 114 # DW_AT_str_offsets_base
124 .byte 23 # DW_FORM_sec_offset
125 .byte 16 # DW_AT_stmt_list
126 .byte 23 # DW_FORM_sec_offset
127 .byte 27 # DW_AT_comp_dir
128 .byte 37 # DW_FORM_strx1
129 .byte 17 # DW_AT_low_pc
130 .byte 27 # DW_FORM_addrx
131 .byte 18 # DW_AT_high_pc
132 .byte 6 # DW_FORM_data4
133 .byte 115 # DW_AT_addr_base
134 .byte 23 # DW_FORM_sec_offset
137 .byte 2 # Abbreviation Code
138 .byte 52 # DW_TAG_variable
139 .byte 0 # DW_CHILDREN_no
141 .byte 37 # DW_FORM_strx1
142 .byte 73 # DW_AT_type
143 .byte 19 # DW_FORM_ref4
144 .byte 63 # DW_AT_external
145 .byte 25 # DW_FORM_flag_present
146 .byte 58 # DW_AT_decl_file
147 .byte 11 # DW_FORM_data1
148 .byte 59 # DW_AT_decl_line
149 .byte 11 # DW_FORM_data1
150 .byte 2 # DW_AT_location
151 .byte 24 # DW_FORM_exprloc
154 .byte 3 # Abbreviation Code
155 .byte 36 # DW_TAG_base_type
156 .byte 0 # DW_CHILDREN_no
158 .byte 37 # DW_FORM_strx1
159 .byte 62 # DW_AT_encoding
160 .byte 11 # DW_FORM_data1
161 .byte 11 # DW_AT_byte_size
162 .byte 11 # DW_FORM_data1
165 .byte 4 # Abbreviation Code
166 .byte 46 # DW_TAG_subprogram
167 .byte 1 # DW_CHILDREN_yes
168 .byte 17 # DW_AT_low_pc
169 .byte 27 # DW_FORM_addrx
170 .byte 18 # DW_AT_high_pc
171 .byte 6 # DW_FORM_data4
172 .byte 64 # DW_AT_frame_base
173 .byte 24 # DW_FORM_exprloc
174 .byte 122 # DW_AT_call_all_calls
175 .byte 25 # DW_FORM_flag_present
176 .byte 49 # DW_AT_abstract_origin
177 .byte 19 # DW_FORM_ref4
180 .byte 5 # Abbreviation Code
181 .byte 5 # DW_TAG_formal_parameter
182 .byte 0 # DW_CHILDREN_no
183 .byte 2 # DW_AT_location
184 .byte 24 # DW_FORM_exprloc
185 .byte 49 # DW_AT_abstract_origin
186 .byte 19 # DW_FORM_ref4
189 .byte 6 # Abbreviation Code
190 .byte 46 # DW_TAG_subprogram
191 .byte 1 # DW_CHILDREN_yes
192 .byte 110 # DW_AT_linkage_name
193 .byte 37 # DW_FORM_strx1
195 .byte 37 # DW_FORM_strx1
196 .byte 58 # DW_AT_decl_file
197 .byte 11 # DW_FORM_data1
198 .byte 59 # DW_AT_decl_line
199 .byte 11 # DW_FORM_data1
200 .byte 63 # DW_AT_external
201 .byte 25 # DW_FORM_flag_present
202 .byte 32 # DW_AT_inline
203 .byte 33 # DW_FORM_implicit_const
207 .byte 7 # Abbreviation Code
208 .byte 5 # DW_TAG_formal_parameter
209 .byte 0 # DW_CHILDREN_no
211 .byte 37 # DW_FORM_strx1
212 .byte 58 # DW_AT_decl_file
213 .byte 11 # DW_FORM_data1
214 .byte 59 # DW_AT_decl_line
215 .byte 11 # DW_FORM_data1
216 .byte 73 # DW_AT_type
217 .byte 19 # DW_FORM_ref4
220 .byte 8 # Abbreviation Code
221 .byte 15 # DW_TAG_pointer_type
222 .byte 0 # DW_CHILDREN_no
223 .byte 73 # DW_AT_type
224 .byte 19 # DW_FORM_ref4
227 .byte 9 # Abbreviation Code
228 .byte 46 # DW_TAG_subprogram
229 .byte 1 # DW_CHILDREN_yes
230 .byte 17 # DW_AT_low_pc
231 .byte 27 # DW_FORM_addrx
232 .byte 18 # DW_AT_high_pc
233 .byte 6 # DW_FORM_data4
234 .byte 64 # DW_AT_frame_base
235 .byte 24 # DW_FORM_exprloc
236 .byte 122 # DW_AT_call_all_calls
237 .byte 25 # DW_FORM_flag_present
239 .byte 37 # DW_FORM_strx1
240 .byte 58 # DW_AT_decl_file
241 .byte 11 # DW_FORM_data1
242 .byte 59 # DW_AT_decl_line
243 .byte 11 # DW_FORM_data1
244 .byte 73 # DW_AT_type
245 .byte 19 # DW_FORM_ref4
246 .byte 63 # DW_AT_external
247 .byte 25 # DW_FORM_flag_present
250 .byte 10 # Abbreviation Code
251 .byte 5 # DW_TAG_formal_parameter
252 .byte 0 # DW_CHILDREN_no
253 .byte 2 # DW_AT_location
254 .byte 24 # DW_FORM_exprloc
256 .byte 37 # DW_FORM_strx1
257 .byte 58 # DW_AT_decl_file
258 .byte 11 # DW_FORM_data1
259 .byte 59 # DW_AT_decl_line
260 .byte 11 # DW_FORM_data1
261 .byte 73 # DW_AT_type
262 .byte 19 # DW_FORM_ref4
265 .byte 11 # Abbreviation Code
266 .byte 29 # DW_TAG_inlined_subroutine
267 .byte 0 # DW_CHILDREN_no
268 .byte 49 # DW_AT_abstract_origin
269 .byte 19 # DW_FORM_ref4
270 .byte 17 # DW_AT_low_pc
271 .byte 27 # DW_FORM_addrx
272 .byte 18 # DW_AT_high_pc
273 .byte 6 # DW_FORM_data4
274 .byte 88 # DW_AT_call_file
275 .byte 11 # DW_FORM_data1
276 .byte 89 # DW_AT_call_line
277 .byte 11 # DW_FORM_data1
278 .byte 87 # DW_AT_call_column
279 .byte 11 # DW_FORM_data1
283 .section .debug_info,"",@progbits
285 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
287 .short 5 # DWARF version number
288 .byte 1 # DWARF Unit Type
289 .byte 8 # Address Size (in bytes)
290 .long .debug_abbrev # Offset Into Abbrev. Section
291 .byte 1 # Abbrev [1] 0xc:0xa7 DW_TAG_compile_unit
292 .byte 0 # DW_AT_producer
293 .short 33 # DW_AT_language
295 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base
296 .long .Lline_table_start0 # DW_AT_stmt_list
297 .byte 2 # DW_AT_comp_dir
298 .byte 2 # DW_AT_low_pc
299 .long .Lfunc_end1-.Lfunc_begin0 # DW_AT_high_pc
300 .long .Laddr_table_base0 # DW_AT_addr_base
301 .byte 2 # Abbrev [2] 0x23:0xb DW_TAG_variable
303 .long 46 # DW_AT_type
305 .byte 0 # DW_AT_decl_file
306 .byte 6 # DW_AT_decl_line
307 .byte 2 # DW_AT_location
310 .byte 3 # Abbrev [3] 0x2e:0x4 DW_TAG_base_type
312 .byte 5 # DW_AT_encoding
313 .byte 4 # DW_AT_byte_size
314 .byte 2 # Abbrev [2] 0x32:0xb DW_TAG_variable
316 .long 46 # DW_AT_type
318 .byte 0 # DW_AT_decl_file
319 .byte 7 # DW_AT_decl_line
320 .byte 2 # DW_AT_location
323 .byte 4 # Abbrev [4] 0x3d:0x1b DW_TAG_subprogram
324 .byte 2 # DW_AT_low_pc
325 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
326 .byte 1 # DW_AT_frame_base
328 # DW_AT_call_all_calls
329 .long 88 # DW_AT_abstract_origin
330 .byte 5 # Abbrev [5] 0x49:0x7 DW_TAG_formal_parameter
331 .byte 1 # DW_AT_location
333 .long 93 # DW_AT_abstract_origin
334 .byte 5 # Abbrev [5] 0x50:0x7 DW_TAG_formal_parameter
335 .byte 1 # DW_AT_location
337 .long 101 # DW_AT_abstract_origin
338 .byte 0 # End Of Children Mark
339 .byte 6 # Abbrev [6] 0x58:0x16 DW_TAG_subprogram
340 .byte 6 # DW_AT_linkage_name
342 .byte 0 # DW_AT_decl_file
343 .byte 1 # DW_AT_decl_line
346 .byte 7 # Abbrev [7] 0x5d:0x8 DW_TAG_formal_parameter
348 .byte 0 # DW_AT_decl_file
349 .byte 1 # DW_AT_decl_line
350 .long 110 # DW_AT_type
351 .byte 7 # Abbrev [7] 0x65:0x8 DW_TAG_formal_parameter
353 .byte 0 # DW_AT_decl_file
354 .byte 1 # DW_AT_decl_line
355 .long 110 # DW_AT_type
356 .byte 0 # End Of Children Mark
357 .byte 8 # Abbrev [8] 0x6e:0x5 DW_TAG_pointer_type
358 .long 46 # DW_AT_type
359 .byte 9 # Abbrev [9] 0x73:0x31 DW_TAG_subprogram
360 .byte 3 # DW_AT_low_pc
361 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
362 .byte 1 # DW_AT_frame_base
364 # DW_AT_call_all_calls
366 .byte 0 # DW_AT_decl_file
367 .byte 8 # DW_AT_decl_line
368 .long 46 # DW_AT_type
370 .byte 10 # Abbrev [10] 0x82:0xa DW_TAG_formal_parameter
371 .byte 1 # DW_AT_location
374 .byte 0 # DW_AT_decl_file
375 .byte 8 # DW_AT_decl_line
376 .long 46 # DW_AT_type
377 .byte 10 # Abbrev [10] 0x8c:0xa DW_TAG_formal_parameter
378 .byte 1 # DW_AT_location
380 .byte 10 # DW_AT_name
381 .byte 0 # DW_AT_decl_file
382 .byte 8 # DW_AT_decl_line
383 .long 164 # DW_AT_type
384 .byte 11 # Abbrev [11] 0x96:0xd DW_TAG_inlined_subroutine
385 .long 88 # DW_AT_abstract_origin
386 .byte 3 # DW_AT_low_pc
387 .long .Ltmp2-.Lfunc_begin1 # DW_AT_high_pc
388 .byte 0 # DW_AT_call_file
389 .byte 11 # DW_AT_call_line
390 .byte 4 # DW_AT_call_column
391 .byte 0 # End Of Children Mark
392 .byte 8 # Abbrev [8] 0xa4:0x5 DW_TAG_pointer_type
393 .long 169 # DW_AT_type
394 .byte 8 # Abbrev [8] 0xa9:0x5 DW_TAG_pointer_type
395 .long 174 # DW_AT_type
396 .byte 3 # Abbrev [3] 0xae:0x4 DW_TAG_base_type
397 .byte 11 # DW_AT_name
398 .byte 6 # DW_AT_encoding
399 .byte 1 # DW_AT_byte_size
400 .byte 0 # End Of Children Mark
402 .section .debug_str_offsets,"",@progbits
403 .long 52 # Length of String Offsets Set
407 .section .debug_str,"MS",@progbits,1
409 .asciz "clang version 15.0.0" # string offset=0
411 .asciz "main.cpp" # string offset=134
413 .asciz "/testLocExprLoc" # string offset=143
415 .asciz "x" # string offset=195
417 .asciz "int" # string offset=197
419 .asciz "y" # string offset=201
421 .asciz "_Z3usePiS_" # string offset=203
423 .asciz "use" # string offset=214
425 .asciz "main" # string offset=218
427 .asciz "argc" # string offset=223
429 .asciz "argv" # string offset=228
431 .asciz "char" # string offset=233
432 .section .debug_str_offsets,"",@progbits
443 .long .Linfo_string10
444 .long .Linfo_string11
445 .section .debug_addr,"",@progbits
446 .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
448 .short 5 # DWARF version number
449 .byte 8 # Address size
450 .byte 0 # Segment selector size
457 .ident "clang version 15.0.0"
458 .section ".note.GNU-stack","",@progbits
460 .section .debug_line,"",@progbits