1 # REQUIRES: x86-registered-target
3 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
4 # RUN: llvm-symbolizer --obj=%t.o 0x30 0x20 0x6c 0xf | FileCheck %s
7 # CHECK-NEXT: llvm-symbolizer-bbsections-test.c:13
9 # CHECK-NEXT: llvm-symbolizer-bbsections-test.c:5
11 # CHECK-NEXT: llvm-symbolizer-bbsections-test.c:15
13 # CHECK-NEXT: llvm-symbolizer-bbsections-test.c:18
14 # How to generate this file:
27 # // Use simple control flow to generate lots of basic block sections.
28 # int main(int argc, char *argv[]) {
38 # $ clang -S -fbasic-block-sections=all llvm-symbolizer-bbsections-test.cc
39 # Manually reororder the sections to place them in this order:
47 # Strip the .section .text directives to have all the functions in the same
49 # This ensures the basic blocks are reordered non-contiguous exactly like
50 # how a linker would do it.
52 .file "llvm-symbolizer-bbsections-test.c"
53 #.section .text._Z1fi,"ax",@progbits
54 .globl _Z1fi # -- Begin function _Z1fi
59 .file 1 "Examples" "llvm-symbolizer-bbsections-test.c"
60 .loc 1 1 0 # llvm-symbolizer-bbsections-test.c:1:0
64 .cfi_def_cfa_offset 16
67 .cfi_def_cfa_register %rbp
70 .loc 1 2 10 prologue_end # llvm-symbolizer-bbsections-test.c:2:10
72 .loc 1 2 12 is_stmt 0 # llvm-symbolizer-bbsections-test.c:2:12
74 .loc 1 2 3 # llvm-symbolizer-bbsections-test.c:2:3
81 .size _Z1fi, .Lfunc_end0-_Z1fi
83 #.section text.main,"ax",@progbits,unique,4
88 .loc 1 18 17 is_stmt 1 # llvm-symbolizer-bbsections-test.c:18:17
91 .loc 1 18 12 is_stmt 0 # llvm-symbolizer-bbsections-test.c:18:12
95 .size main.__part.4, .LBB_END3_4-main.__part.4
98 #.section .text._Z1gi,"ax",@progbits
99 .globl _Z1gi # -- Begin function _Z1gi
101 .type _Z1gi,@function
104 .loc 1 5 0 is_stmt 1 # llvm-symbolizer-bbsections-test.c:5:0
108 .cfi_def_cfa_offset 16
109 .cfi_offset %rbp, -16
111 .cfi_def_cfa_register %rbp
114 .loc 1 6 10 prologue_end # llvm-symbolizer-bbsections-test.c:6:10
116 .loc 1 6 12 is_stmt 0 # llvm-symbolizer-bbsections-test.c:6:12
118 .loc 1 6 3 # llvm-symbolizer-bbsections-test.c:6:3
125 .size _Z1gi, .Lfunc_end1-_Z1gi
127 #.section .text.main,"ax",@progbits
128 .globl main # -- Begin function main
133 .loc 1 13 0 is_stmt 1 # llvm-symbolizer-bbsections-test.c:13:0
137 .cfi_def_cfa_offset 16
138 .cfi_offset %rbp, -16
140 .cfi_def_cfa_register %rbp
146 .loc 1 14 12 prologue_end # llvm-symbolizer-bbsections-test.c:14:12
149 .loc 1 14 7 is_stmt 0 # llvm-symbolizer-bbsections-test.c:14:7
153 #.section .text._Z1hi,"ax",@progbits
154 .globl _Z1hi # -- Begin function _Z1hi
156 .type _Z1hi,@function
159 .loc 1 9 0 is_stmt 1 # llvm-symbolizer-bbsections-test.c:9:0
163 .cfi_def_cfa_offset 16
164 .cfi_offset %rbp, -16
166 .cfi_def_cfa_register %rbp
169 .loc 1 10 10 prologue_end # llvm-symbolizer-bbsections-test.c:10:10
171 .loc 1 10 12 is_stmt 0 # llvm-symbolizer-bbsections-test.c:10:12
173 .loc 1 10 3 # llvm-symbolizer-bbsections-test.c:10:3
180 .size _Z1hi, .Lfunc_end2-_Z1hi
182 #.section .text.main,"ax",@progbits,unique,5
185 .cfi_def_cfa %rbp, 16
186 .cfi_offset %rbp, -16
187 .loc 1 19 14 is_stmt 1 # llvm-symbolizer-bbsections-test.c:19:14
189 .loc 1 19 12 is_stmt 0 # llvm-symbolizer-bbsections-test.c:19:12
191 .loc 1 19 5 # llvm-symbolizer-bbsections-test.c:19:5
196 .size main.__part.5, .LBB_END3_5-main.__part.5
198 #.section .text.main,"ax",@progbits,unique,1
201 .cfi_def_cfa %rbp, 16
202 .cfi_offset %rbp, -16
203 .loc 1 15 14 is_stmt 1 # llvm-symbolizer-bbsections-test.c:15:14
205 .loc 1 15 12 is_stmt 0 # llvm-symbolizer-bbsections-test.c:15:12
207 .loc 1 15 5 # llvm-symbolizer-bbsections-test.c:15:5
211 .size main.__part.1, .LBB_END3_1-main.__part.1
213 #.section .text.main,"ax",@progbits,unique,2
216 .cfi_def_cfa %rbp, 16
217 .cfi_offset %rbp, -16
218 .loc 1 16 17 is_stmt 1 # llvm-symbolizer-bbsections-test.c:16:17
221 .loc 1 16 12 is_stmt 0 # llvm-symbolizer-bbsections-test.c:16:12
225 .size main.__part.2, .LBB_END3_2-main.__part.2
227 #.section .text.main,"ax",@progbits,unique,3
230 .cfi_def_cfa %rbp, 16
231 .cfi_offset %rbp, -16
232 .loc 1 17 14 is_stmt 1 # llvm-symbolizer-bbsections-test.c:17:14
234 .loc 1 17 12 is_stmt 0 # llvm-symbolizer-bbsections-test.c:17:12
236 .loc 1 17 5 # llvm-symbolizer-bbsections-test.c:17:5
240 .size main.__part.3, .LBB_END3_3-main.__part.3
242 #.section .text.main,"ax",@progbits,unique,6
245 .cfi_def_cfa %rbp, 16
246 .cfi_offset %rbp, -16
247 .loc 1 0 5 # llvm-symbolizer-bbsections-test.c:0:5
251 .size main.__part.6, .LBB_END3_6-main.__part.6
253 #.section .text.main,"ax",@progbits,unique,7
256 .cfi_def_cfa %rbp, 16
257 .cfi_offset %rbp, -16
261 .size main.__part.7, .LBB_END3_7-main.__part.7
263 #.section .text.main,"ax",@progbits,unique,8
266 .cfi_def_cfa %rbp, 16
267 .cfi_offset %rbp, -16
268 .loc 1 20 3 is_stmt 1 # llvm-symbolizer-bbsections-test.c:20:3
272 .size main.__part.8, .LBB_END3_8-main.__part.8
274 #.section .text.main,"ax",@progbits,unique,9
277 .cfi_def_cfa %rbp, 16
278 .cfi_offset %rbp, -16
279 .loc 1 21 1 # llvm-symbolizer-bbsections-test.c:21:1
287 .size main.__part.9, .LBB_END3_9-main.__part.9
289 #.section .text.main,"ax",@progbits
291 .size main, .Lfunc_end3-main
293 .section .debug_abbrev,"",@progbits
294 .byte 1 # Abbreviation Code
295 .byte 17 # DW_TAG_compile_unit
296 .byte 1 # DW_CHILDREN_yes
297 .byte 37 # DW_AT_producer
298 .byte 14 # DW_FORM_strp
299 .byte 19 # DW_AT_language
300 .byte 5 # DW_FORM_data2
302 .byte 14 # DW_FORM_strp
303 .byte 16 # DW_AT_stmt_list
304 .byte 23 # DW_FORM_sec_offset
305 .byte 27 # DW_AT_comp_dir
306 .byte 14 # DW_FORM_strp
307 .byte 17 # DW_AT_low_pc
308 .byte 1 # DW_FORM_addr
309 .byte 85 # DW_AT_ranges
310 .byte 23 # DW_FORM_sec_offset
313 .byte 2 # Abbreviation Code
314 .byte 46 # DW_TAG_subprogram
315 .byte 1 # DW_CHILDREN_yes
316 .byte 17 # DW_AT_low_pc
317 .byte 1 # DW_FORM_addr
318 .byte 18 # DW_AT_high_pc
319 .byte 6 # DW_FORM_data4
320 .byte 64 # DW_AT_frame_base
321 .byte 24 # DW_FORM_exprloc
322 .byte 110 # DW_AT_linkage_name
323 .byte 14 # DW_FORM_strp
325 .byte 14 # DW_FORM_strp
326 .byte 58 # DW_AT_decl_file
327 .byte 11 # DW_FORM_data1
328 .byte 59 # DW_AT_decl_line
329 .byte 11 # DW_FORM_data1
330 .byte 73 # DW_AT_type
331 .byte 19 # DW_FORM_ref4
332 .byte 63 # DW_AT_external
333 .byte 25 # DW_FORM_flag_present
336 .byte 3 # Abbreviation Code
337 .byte 5 # DW_TAG_formal_parameter
338 .byte 0 # DW_CHILDREN_no
339 .byte 2 # DW_AT_location
340 .byte 24 # DW_FORM_exprloc
342 .byte 14 # DW_FORM_strp
343 .byte 58 # DW_AT_decl_file
344 .byte 11 # DW_FORM_data1
345 .byte 59 # DW_AT_decl_line
346 .byte 11 # DW_FORM_data1
347 .byte 73 # DW_AT_type
348 .byte 19 # DW_FORM_ref4
351 .byte 4 # Abbreviation Code
352 .byte 46 # DW_TAG_subprogram
353 .byte 1 # DW_CHILDREN_yes
354 .byte 85 # DW_AT_ranges
355 .byte 23 # DW_FORM_sec_offset
356 .byte 64 # DW_AT_frame_base
357 .byte 24 # DW_FORM_exprloc
359 .byte 14 # DW_FORM_strp
360 .byte 58 # DW_AT_decl_file
361 .byte 11 # DW_FORM_data1
362 .byte 59 # DW_AT_decl_line
363 .byte 11 # DW_FORM_data1
364 .byte 73 # DW_AT_type
365 .byte 19 # DW_FORM_ref4
366 .byte 63 # DW_AT_external
367 .byte 25 # DW_FORM_flag_present
370 .byte 5 # Abbreviation Code
371 .byte 36 # DW_TAG_base_type
372 .byte 0 # DW_CHILDREN_no
374 .byte 14 # DW_FORM_strp
375 .byte 62 # DW_AT_encoding
376 .byte 11 # DW_FORM_data1
377 .byte 11 # DW_AT_byte_size
378 .byte 11 # DW_FORM_data1
381 .byte 6 # Abbreviation Code
382 .byte 15 # DW_TAG_pointer_type
383 .byte 0 # DW_CHILDREN_no
384 .byte 73 # DW_AT_type
385 .byte 19 # DW_FORM_ref4
389 .section .debug_info,"",@progbits
391 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
393 .short 4 # DWARF version number
394 .long .debug_abbrev # Offset Into Abbrev. Section
395 .byte 8 # Address Size (in bytes)
396 .byte 1 # Abbrev [1] 0xb:0xea DW_TAG_compile_unit
397 .long .Linfo_string0 # DW_AT_producer
398 .short 33 # DW_AT_language
399 .long .Linfo_string1 # DW_AT_name
400 .long .Lline_table_start0 # DW_AT_stmt_list
401 .long .Linfo_string2 # DW_AT_comp_dir
402 .quad 0 # DW_AT_low_pc
403 .long .Ldebug_ranges1 # DW_AT_ranges
404 .byte 2 # Abbrev [2] 0x2a:0x2c DW_TAG_subprogram
405 .quad .Lfunc_begin0 # DW_AT_low_pc
406 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
407 .byte 1 # DW_AT_frame_base
409 .long .Linfo_string3 # DW_AT_linkage_name
410 .long .Linfo_string4 # DW_AT_name
411 .byte 1 # DW_AT_decl_file
412 .byte 1 # DW_AT_decl_line
413 .long 220 # DW_AT_type
415 .byte 3 # Abbrev [3] 0x47:0xe DW_TAG_formal_parameter
416 .byte 2 # DW_AT_location
419 .long .Linfo_string11 # DW_AT_name
420 .byte 1 # DW_AT_decl_file
421 .byte 1 # DW_AT_decl_line
422 .long 220 # DW_AT_type
423 .byte 0 # End Of Children Mark
424 .byte 2 # Abbrev [2] 0x56:0x2c DW_TAG_subprogram
425 .quad .Lfunc_begin1 # DW_AT_low_pc
426 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
427 .byte 1 # DW_AT_frame_base
429 .long .Linfo_string6 # DW_AT_linkage_name
430 .long .Linfo_string7 # DW_AT_name
431 .byte 1 # DW_AT_decl_file
432 .byte 5 # DW_AT_decl_line
433 .long 220 # DW_AT_type
435 .byte 3 # Abbrev [3] 0x73:0xe DW_TAG_formal_parameter
436 .byte 2 # DW_AT_location
439 .long .Linfo_string11 # DW_AT_name
440 .byte 1 # DW_AT_decl_file
441 .byte 5 # DW_AT_decl_line
442 .long 220 # DW_AT_type
443 .byte 0 # End Of Children Mark
444 .byte 2 # Abbrev [2] 0x82:0x2c DW_TAG_subprogram
445 .quad .Lfunc_begin2 # DW_AT_low_pc
446 .long .Lfunc_end2-.Lfunc_begin2 # DW_AT_high_pc
447 .byte 1 # DW_AT_frame_base
449 .long .Linfo_string8 # DW_AT_linkage_name
450 .long .Linfo_string9 # DW_AT_name
451 .byte 1 # DW_AT_decl_file
452 .byte 9 # DW_AT_decl_line
453 .long 220 # DW_AT_type
455 .byte 3 # Abbrev [3] 0x9f:0xe DW_TAG_formal_parameter
456 .byte 2 # DW_AT_location
459 .long .Linfo_string11 # DW_AT_name
460 .byte 1 # DW_AT_decl_file
461 .byte 9 # DW_AT_decl_line
462 .long 220 # DW_AT_type
463 .byte 0 # End Of Children Mark
464 .byte 4 # Abbrev [4] 0xae:0x2e DW_TAG_subprogram
465 .long .Ldebug_ranges0 # DW_AT_ranges
466 .byte 1 # DW_AT_frame_base
468 .long .Linfo_string10 # DW_AT_name
469 .byte 1 # DW_AT_decl_file
470 .byte 13 # DW_AT_decl_line
471 .long 220 # DW_AT_type
473 .byte 3 # Abbrev [3] 0xbf:0xe DW_TAG_formal_parameter
474 .byte 2 # DW_AT_location
477 .long .Linfo_string12 # DW_AT_name
478 .byte 1 # DW_AT_decl_file
479 .byte 13 # DW_AT_decl_line
480 .long 220 # DW_AT_type
481 .byte 3 # Abbrev [3] 0xcd:0xe DW_TAG_formal_parameter
482 .byte 2 # DW_AT_location
485 .long .Linfo_string13 # DW_AT_name
486 .byte 1 # DW_AT_decl_file
487 .byte 13 # DW_AT_decl_line
488 .long 227 # DW_AT_type
489 .byte 0 # End Of Children Mark
490 .byte 5 # Abbrev [5] 0xdc:0x7 DW_TAG_base_type
491 .long .Linfo_string5 # DW_AT_name
492 .byte 5 # DW_AT_encoding
493 .byte 4 # DW_AT_byte_size
494 .byte 6 # Abbrev [6] 0xe3:0x5 DW_TAG_pointer_type
495 .long 232 # DW_AT_type
496 .byte 6 # Abbrev [6] 0xe8:0x5 DW_TAG_pointer_type
497 .long 237 # DW_AT_type
498 .byte 5 # Abbrev [5] 0xed:0x7 DW_TAG_base_type
499 .long .Linfo_string14 # DW_AT_name
500 .byte 6 # DW_AT_encoding
501 .byte 1 # DW_AT_byte_size
502 .byte 0 # End Of Children Mark
504 .section .debug_ranges,"",@progbits
557 .section .debug_str,"MS",@progbits,1
559 .asciz "clang version 12.0.0 (git@github.com:llvm/llvm-project.git bfa6ca07a8cda0ab889b7fee0b914907ce594e11)" # string offset=0
561 .asciz "llvm-symbolizer-bbsections-test.c" # string offset=101
563 .asciz "Examples" # string offset=135
565 .asciz "_Z1fi" # string offset=182
567 .asciz "f" # string offset=188
569 .asciz "int" # string offset=190
571 .asciz "_Z1gi" # string offset=194
573 .asciz "g" # string offset=200
575 .asciz "_Z1hi" # string offset=202
577 .asciz "h" # string offset=208
579 .asciz "main" # string offset=210
581 .asciz "a" # string offset=215
583 .asciz "argc" # string offset=217
585 .asciz "argv" # string offset=222
587 .asciz "char" # string offset=227
588 .ident "clang version 12.0.0 (git@github.com:llvm/llvm-project.git bfa6ca07a8cda0ab889b7fee0b914907ce594e11)"
589 .section ".note.GNU-stack","",@progbits
594 .section .debug_line,"",@progbits