1 ## Test that reconstructs a dSYM file from YAML and generates a callsite-enabled gsym from it - and then verifies the gsym.
2 ## See llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-callsite-info.test for the script to generate this yaml file
4 # RUN: split-file %s %t
5 # RUN: yaml2obj %t/call_sites.dSYM.yaml -o %t/call_sites.dSYM
7 # RUN: llvm-gsymutil --convert=%t/call_sites.dSYM --callsites-yaml-file=%t/callsites.yaml -o %t/call_sites_dSYM.gsym
9 # Dump the GSYM file and check the output for callsite information
10 # RUN: llvm-gsymutil %t/call_sites_dSYM.gsym | FileCheck --check-prefix=CHECK-GSYM %s
13 # CHECK-GSYM: FunctionInfo @ 0x[[#%x,FUNC_INFO:]]: [0x[[#%x,FUNC_START:]] - 0x[[#%x,FUNC_END:]]) "func_mainBin_dec_call_everything"
14 # CHECK-GSYM-NEXT: LineTable:
15 # // func_mainBin_dec_call_everything() {
16 # CHECK-GSYM-NEXT: 0x[[#%x,ENTRY:]] {{.*}}/call_sites.cpp:16
17 # // func_mainBin_dec_01();
18 # CHECK-GSYM-NEXT: 0x[[#%x,ADDR_DEC_01_CALL:]] {{.*}}/call_sites.cpp:17
19 # // func_mainBin_dec_02();
20 # CHECK-GSYM-NEXT: 0x[[#%x,ADDR_DEC_02_CALL:]] {{.*}}/call_sites.cpp:18
21 # // func_mainBin_dec_03();
22 # CHECK-GSYM-NEXT: 0x[[#%x,ADDR_DEC_03_CALL:]] {{.*}}/call_sites.cpp:19
23 # // func_mainBin_inc_01();
24 # CHECK-GSYM-NEXT: 0x[[#%x,ADDR_INC_01_CALL:]] {{.*}}/call_sites.cpp:21
25 # // func_mainBin_inc_02();
26 # CHECK-GSYM-NEXT: 0x[[#%x,ADDR_INC_02_CALL:]] {{.*}}/call_sites.cpp:22
27 # // func_mainBin_inc_03();
28 # CHECK-GSYM-NEXT: 0x[[#%x,ADDR_INC_03_CALL:]] {{.*}}/call_sites.cpp:23
30 # CHECK-GSYM-NEXT: 0x[[#%x,ADDR_FUNC_CALL:]] {{.*}}/call_sites.cpp:25
31 # // g_extern_func_ptr();
32 # CHECK-GSYM-NEXT: 0x[[#%x,ADDR_EXTERN_FUNC_CALL:]] {{.*}}/call_sites.cpp:26
33 # // g_volatile_var = 0;
34 # CHECK-GSYM-NEXT: 0x[[#%x,ADDR_VAR_ASSIGN:]] {{.*}}/call_sites.cpp:28
36 # CHECK-GSYM-NEXT: 0x[[#%x,]] {{.*}}/call_sites.cpp:29
37 # CHECK-GSYM-NEXT: CallSites (by relative return offset):
38 # CHECK-GSYM-NEXT: 0x[[#%.4x,sub(ADDR_DEC_02_CALL,FUNC_START)]] Flags[InternalCall] MatchRegex[func_mainBin_dec_01]
39 # CHECK-GSYM-NEXT: 0x[[#%.4x,sub(ADDR_DEC_03_CALL,FUNC_START)]] Flags[InternalCall] MatchRegex[func_mainBin_dec_02]
40 # CHECK-GSYM-NEXT: 0x[[#%.4x,sub(ADDR_INC_01_CALL,FUNC_START)]] Flags[InternalCall] MatchRegex[func_mainBin_dec_03]
41 # CHECK-GSYM-NEXT: 0x[[#%.4x,sub(ADDR_INC_02_CALL,FUNC_START)]] Flags[InternalCall] MatchRegex[func_mainBin_inc_01]
42 # CHECK-GSYM-NEXT: 0x[[#%.4x,sub(ADDR_INC_03_CALL,FUNC_START)]] Flags[InternalCall] MatchRegex[func_mainBin_inc_02]
43 # CHECK-GSYM-NEXT: 0x[[#%.4x,sub(ADDR_FUNC_CALL,FUNC_START)]] Flags[InternalCall] MatchRegex[func_mainBin_inc_03]
44 # CHECK-GSYM-NEXT: 0x[[#%.4x,sub(ADDR_EXTERN_FUNC_CALL,FUNC_START)]] Flags[None] MatchRegex[.*func.*]
45 # CHECK-GSYM-NEXT: 0x[[#%.4x,sub(ADDR_VAR_ASSIGN,FUNC_START)]] Flags[ExternalCall] MatchRegex[.*extern_func.*]
50 - name: func_mainBin_dec_call_everything
53 match_regex: ["func_mainBin_dec_01"]
57 match_regex: ["func_mainBin_dec_02"]
61 match_regex: ["func_mainBin_dec_03"]
65 match_regex: ["func_mainBin_inc_01"]
69 match_regex: ["func_mainBin_inc_02"]
73 match_regex: ["func_mainBin_inc_03"]
77 match_regex: [".*func.*"]
79 match_regex: [".*extern_func.*"]
84 #--- call_sites.dSYM.yaml
98 uuid: 4C4C44E9-5555-3144-A1D3-328233D00078
99 - cmd: LC_BUILD_VERSION
146 content: CFFAEDFE0C000001000000000A000000080000007005000000000000000000001B000000180000004C4C44E955553144A1D3328233D0007832000000180000000100000000000B0000000B00000000000200000018000000001000000C000000C0100000EB00000019000000480000005F5F504147455A45524F00000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000019000000980000005F5F544558540000000000000000000000000000010000000040000000000000
194 - sectname: __debug_line
206 - sectname: __debug_aranges
218 - sectname: __debug_info
230 - sectname: __debug_frame
242 content: 14000000FFFFFFFF0400080001781E0C1F0000000000000014000000000000003803000001000000140000000000000014000000000000004C03000001000000140000000000000014000000000000006003000001000000140000000000000014000000000000007403000001000000140000000000000014000000000000008803000001000000140000000000000014000000000000009C0300000100000014000000000000001C00000000000000B0030000010000004800000000000000480C1D109E019D021C00000000000000F8030000010000001800000000000000480C1D109E019D02
243 - sectname: __debug_abbrev
255 - sectname: __debug_str
267 - sectname: __apple_namespac
279 content: 485341480100000001000000000000000C000000000000000100000001000600FFFFFFFF
280 - sectname: __apple_names
292 content: 48534148010000000B0000000B0000000C000000000000000100000001000600FFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFF01000000FFFFFFFF0300000004000000060000000900000073A83B36215E623FACBB81686A7F9A7C1939EE6AC7E03A771A39EE6AC8E03A773856D6801B39EE6AC9E03A77A4000000B4000000C4000000D4000000E4000000F40000000401000014010000240100003401000044010000AC000000010000002E00000000000000CA000000010000007300000000000000BF000000010000004F0000000000000075010000010000008001000000000000DC0000000100000088000000000000001801000001000000C700000000000000F0000000010000009D000000000000002C01000001000000DC00000000000000540100000100000006010000000000000401000001000000B2000000000000004001000001000000F100000000000000
293 - sectname: __apple_types
305 content: 48534148010000000100000001000000180000000000000004000000010006000300050005000B0006000600000000003080880B38000000BB0000000100000048000000240000A4283A0C00000000
306 - sectname: __apple_objc
318 content: 485341480100000001000000000000000C000000000000000100000001000600FFFFFFFF
385 - _func_mainBin_dec_01
386 - _func_mainBin_dec_02
387 - _func_mainBin_dec_03
388 - _func_mainBin_inc_01
389 - _func_mainBin_inc_02
390 - _func_mainBin_inc_03
391 - _func_mainBin_dec_call_everything
395 - __mh_execute_header
399 - 'clang version 20.0.0git (https://github.com/alx32/llvm-project.git f41f6ea1f33c4f5e7c94f3d155e44292d1809c50)'
402 - '/tmp/___________________________________/tst'
407 - func_mainBin_dec_01
408 - func_mainBin_dec_02
409 - func_mainBin_dec_03
410 - func_mainBin_inc_01
411 - func_mainBin_inc_02
412 - func_mainBin_inc_03
413 - func_mainBin_dec_call_everything
419 Tag: DW_TAG_compile_unit
420 Children: DW_CHILDREN_yes
422 - Attribute: DW_AT_producer
424 - Attribute: DW_AT_language
426 - Attribute: DW_AT_name
428 - Attribute: DW_AT_LLVM_sysroot
430 - Attribute: DW_AT_stmt_list
431 Form: DW_FORM_sec_offset
432 - Attribute: DW_AT_comp_dir
434 - Attribute: DW_AT_APPLE_optimized
435 Form: DW_FORM_flag_present
436 - Attribute: DW_AT_low_pc
438 - Attribute: DW_AT_high_pc
442 Children: DW_CHILDREN_no
444 - Attribute: DW_AT_name
446 - Attribute: DW_AT_type
447 Form: DW_FORM_ref_addr
448 - Attribute: DW_AT_external
449 Form: DW_FORM_flag_present
450 - Attribute: DW_AT_decl_file
452 - Attribute: DW_AT_decl_line
454 - Attribute: DW_AT_location
455 Form: DW_FORM_exprloc
457 Tag: DW_TAG_volatile_type
458 Children: DW_CHILDREN_no
460 - Attribute: DW_AT_type
461 Form: DW_FORM_ref_addr
463 Tag: DW_TAG_base_type
464 Children: DW_CHILDREN_no
466 - Attribute: DW_AT_name
468 - Attribute: DW_AT_encoding
470 - Attribute: DW_AT_byte_size
473 Tag: DW_TAG_pointer_type
474 Children: DW_CHILDREN_no
476 - Attribute: DW_AT_type
477 Form: DW_FORM_ref_addr
479 Tag: DW_TAG_subroutine_type
480 Children: DW_CHILDREN_no
482 - Attribute: DW_AT_type
483 Form: DW_FORM_ref_addr
485 Tag: DW_TAG_subprogram
486 Children: DW_CHILDREN_no
488 - Attribute: DW_AT_low_pc
490 - Attribute: DW_AT_high_pc
492 - Attribute: DW_AT_APPLE_omit_frame_ptr
493 Form: DW_FORM_flag_present
494 - Attribute: DW_AT_frame_base
495 Form: DW_FORM_exprloc
496 - Attribute: DW_AT_call_all_calls
497 Form: DW_FORM_flag_present
498 - Attribute: DW_AT_name
500 - Attribute: DW_AT_decl_file
502 - Attribute: DW_AT_decl_line
504 - Attribute: DW_AT_external
505 Form: DW_FORM_flag_present
506 - Attribute: DW_AT_APPLE_optimized
507 Form: DW_FORM_flag_present
509 Tag: DW_TAG_subprogram
510 Children: DW_CHILDREN_yes
512 - Attribute: DW_AT_low_pc
514 - Attribute: DW_AT_high_pc
516 - Attribute: DW_AT_frame_base
517 Form: DW_FORM_exprloc
518 - Attribute: DW_AT_call_all_calls
519 Form: DW_FORM_flag_present
520 - Attribute: DW_AT_name
522 - Attribute: DW_AT_decl_file
524 - Attribute: DW_AT_decl_line
526 - Attribute: DW_AT_external
527 Form: DW_FORM_flag_present
528 - Attribute: DW_AT_APPLE_optimized
529 Form: DW_FORM_flag_present
531 Tag: DW_TAG_call_site
532 Children: DW_CHILDREN_no
534 - Attribute: DW_AT_call_origin
536 - Attribute: DW_AT_call_return_pc
539 Tag: DW_TAG_call_site
540 Children: DW_CHILDREN_no
542 - Attribute: DW_AT_call_target
543 Form: DW_FORM_exprloc
544 - Attribute: DW_AT_call_return_pc
547 Tag: DW_TAG_subprogram
548 Children: DW_CHILDREN_yes
550 - Attribute: DW_AT_low_pc
552 - Attribute: DW_AT_high_pc
554 - Attribute: DW_AT_frame_base
555 Form: DW_FORM_exprloc
556 - Attribute: DW_AT_call_all_calls
557 Form: DW_FORM_flag_present
558 - Attribute: DW_AT_name
560 - Attribute: DW_AT_decl_file
562 - Attribute: DW_AT_decl_line
564 - Attribute: DW_AT_type
565 Form: DW_FORM_ref_addr
566 - Attribute: DW_AT_external
567 Form: DW_FORM_flag_present
568 - Attribute: DW_AT_APPLE_optimized
569 Form: DW_FORM_flag_present
576 - Address: 0x100000338
604 BlockData: [ 0x3, 0x0, 0x40, 0x0, 0x0, 0x1, 0x0, 0x0,
622 BlockData: [ 0x3, 0x8, 0x40, 0x0, 0x0, 0x1, 0x0, 0x0,
641 BlockData: [ 0x3, 0x10, 0x40, 0x0, 0x0, 0x1, 0x0, 0x0,
797 StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
799 - Name: call_sites.cpp
804 - Opcode: DW_LNS_extended_op
806 SubOpcode: DW_LNE_set_address
808 - Opcode: DW_LNS_set_column
810 - Opcode: DW_LNS_set_prologue_end
814 - Opcode: DW_LNS_set_column
816 - Opcode: DW_LNS_negate_stmt
820 - Opcode: DW_LNS_set_column
822 - Opcode: DW_LNS_negate_stmt
824 - Opcode: DW_LNS_set_prologue_end
828 - Opcode: DW_LNS_set_column
830 - Opcode: DW_LNS_negate_stmt
834 - Opcode: DW_LNS_set_column
836 - Opcode: DW_LNS_negate_stmt
838 - Opcode: DW_LNS_set_prologue_end
842 - Opcode: DW_LNS_set_column
844 - Opcode: DW_LNS_negate_stmt
848 - Opcode: DW_LNS_set_column
850 - Opcode: DW_LNS_negate_stmt
852 - Opcode: DW_LNS_set_prologue_end
856 - Opcode: DW_LNS_set_column
858 - Opcode: DW_LNS_negate_stmt
862 - Opcode: DW_LNS_set_column
864 - Opcode: DW_LNS_negate_stmt
866 - Opcode: DW_LNS_set_prologue_end
870 - Opcode: DW_LNS_set_column
872 - Opcode: DW_LNS_negate_stmt
876 - Opcode: DW_LNS_set_column
878 - Opcode: DW_LNS_negate_stmt
880 - Opcode: DW_LNS_set_prologue_end
884 - Opcode: DW_LNS_set_column
886 - Opcode: DW_LNS_negate_stmt
890 - Opcode: DW_LNS_set_column
892 - Opcode: DW_LNS_negate_stmt
896 - Opcode: DW_LNS_set_column
898 - Opcode: DW_LNS_set_prologue_end
916 - Opcode: DW_LNS_set_column
920 - Opcode: DW_LNS_set_column
922 - Opcode: DW_LNS_set_epilogue_begin
926 - Opcode: DW_LNS_set_column
930 - Opcode: DW_LNS_set_column
932 - Opcode: DW_LNS_set_prologue_end
938 - Opcode: DW_LNS_negate_stmt
940 - Opcode: DW_LNS_set_epilogue_begin
944 - Opcode: DW_LNS_advance_pc
946 - Opcode: DW_LNS_extended_op
948 SubOpcode: DW_LNE_end_sequence