1 ## Test loading a skinny mach-o file with DWARF. First we make the mach-o file,
2 ## from yaml, then we convert the object file to a GSYM file, then we do
3 ## lookups on the newly created GSYM, and finally we dump the entire GSYM.
5 # RUN: yaml2obj %s -o %t
6 # RUN: llvm-gsymutil --convert %t -o %t.gsym 2>&1 | FileCheck %s --check-prefix=CONVERT
7 # RUN: llvm-gsymutil --address=0 --address=0x100000000 --address=0x100000f90 --address=0x100000faa --address=0x200000000 %t.gsym 2>&1 | FileCheck %s --check-prefix=ADDR
8 # RUN: llvm-gsymutil --verbose --address=0x100000000 --address=0x100000f90 --address=0x100000faa %t.gsym 2>&1 | FileCheck %s --check-prefix=ADDRV
9 # RUN: llvm-gsymutil %t.gsym 2>&1 | FileCheck %s --check-prefix=DUMP
11 # CONVERT: Input file: {{.*\.yaml\.tmp}}
12 # CONVERT: Output file (x86_64): {{.*\.yaml\.tmp\.gsym}}
13 # CONVERT: Loaded 2 functions from DWARF.
14 # CONVERT: Loaded 2 functions from symbol table.
15 # CONVERT: Pruned 2 functions, ended with 2 total
17 # ADDR: Looking up addresses in "{{.*\.yaml\.tmp\.gsym}}":
18 # ADDR-NEXT: 0x0000000000000000: error: address 0x0 is not in GSYM
19 # ADDR-NEXT: 0x0000000100000000: error: address 0x100000000 is not in GSYM
20 # ADDR-NEXT: 0x0000000100000f90: main @ /tmp/main.cpp:4
21 # ADDR-NEXT: 0x0000000100000faa: _Z3fooi @ /tmp/main.cpp:2 [inlined]
22 # ADDR-NEXT: main + 26 @ /tmp/main.cpp:5
23 # ADDR-NEXT: 0x0000000200000000: error: address 0x200000000 is not in GSYM
25 # ADDRV: error: address 0x100000000 is not in GSYM
26 # ADDRV: FunctionInfo for 0x0000000100000f90:
27 # ADDRV-NEXT: [0x0000000100000f90 - 0x0000000100000fb5) "main"
28 # ADDRV-NEXT: LineTable:
29 # ADDRV-NEXT: 0x0000000100000f90 /tmp/main.cpp:4
30 # ADDRV-NEXT: 0x0000000100000fa4 /tmp/main.cpp:5
31 # ADDRV-NEXT: 0x0000000100000faa /tmp/main.cpp:2
32 # ADDRV-NEXT: 0x0000000100000fb0 /tmp/main.cpp:5
33 # ADDRV-NEXT: 0x0000000100000fb3 /tmp/main.cpp:6
34 # ADDRV-NEXT: InlineInfo:
35 # ADDRV-NEXT: [0x0000000100000f90 - 0x0000000100000fb5) main
36 # ADDRV-NEXT: [0x0000000100000faa - 0x0000000100000fb0) _Z3fooi called from /tmp/main.cpp:5
38 # ADDRV: LookupResult for 0x0000000100000f90:
39 # ADDRV-NEXT: 0x0000000100000f90: main @ /tmp/main.cpp:4
41 # ADDRV: FunctionInfo for 0x0000000100000faa:
42 # ADDRV-NEXT: [0x0000000100000f90 - 0x0000000100000fb5) "main"
43 # ADDRV-NEXT: LineTable:
44 # ADDRV-NEXT: 0x0000000100000f90 /tmp/main.cpp:4
45 # ADDRV-NEXT: 0x0000000100000fa4 /tmp/main.cpp:5
46 # ADDRV-NEXT: 0x0000000100000faa /tmp/main.cpp:2
47 # ADDRV-NEXT: 0x0000000100000fb0 /tmp/main.cpp:5
48 # ADDRV-NEXT: 0x0000000100000fb3 /tmp/main.cpp:6
49 # ADDRV-NEXT: InlineInfo:
50 # ADDRV-NEXT: [0x0000000100000f90 - 0x0000000100000fb5) main
51 # ADDRV-NEXT: [0x0000000100000faa - 0x0000000100000fb0) _Z3fooi called from /tmp/main.cpp:5
53 # ADDRV: LookupResult for 0x0000000100000faa:
54 # ADDRV-NEXT: 0x0000000100000faa: _Z3fooi @ /tmp/main.cpp:2 [inlined]
55 # ADDRV-NEXT: main + 26 @ /tmp/main.cpp:5
58 # DUMP-NEXT: Magic = 0x4753594d
59 # DUMP-NEXT: Version = 0x0001
60 # DUMP-NEXT: AddrOffSize = 0x02
61 # DUMP-NEXT: UUIDSize = 0x10
62 # DUMP-NEXT: BaseAddress = 0x0000000100000000
63 # DUMP-NEXT: NumAddresses = 0x00000002
64 # DUMP-NEXT: StrtabOffset = 0x00000050
65 # DUMP-NEXT: StrtabSize = 0x0000001c
66 # DUMP-NEXT: UUID = f6241b5209ed3bbea6bc8a7f5a4817cd
68 # DUMP: Address Table:
69 # DUMP-NEXT: INDEX OFFSET16 (ADDRESS)
70 # DUMP-NEXT: ====== ===============================
71 # DUMP-NEXT: [ 0] 0x0f70 (0x0000000100000f70)
72 # DUMP-NEXT: [ 1] 0x0f90 (0x0000000100000f90)
74 # DUMP: Address Info Offsets:
75 # DUMP-NEXT: INDEX Offset
76 # DUMP-NEXT: ====== ==========
77 # DUMP-NEXT: [ 0] 0x0000006c
78 # DUMP-NEXT: [ 1] 0x0000008c
81 # DUMP-NEXT: INDEX DIRECTORY BASENAME PATH
82 # DUMP-NEXT: ====== ========== ========== ==============================
83 # DUMP-NEXT: [ 0] 0x00000000 0x00000000
84 # DUMP-NEXT: [ 1] 0x00000009 0x0000000e /tmp/main.cpp
87 # DUMP-NEXT: 0x00000000: ""
88 # DUMP-NEXT: 0x00000001: "_Z3fooi"
89 # DUMP-NEXT: 0x00000009: "/tmp"
90 # DUMP-NEXT: 0x0000000e: "main.cpp"
91 # DUMP-NEXT: 0x00000017: "main"
93 # DUMP: FunctionInfo @ 0x0000006c: [0x0000000100000f70 - 0x0000000100000f81) "_Z3fooi"
94 # DUMP-NEXT: LineTable:
95 # DUMP-NEXT: 0x0000000100000f70 /tmp/main.cpp:1
96 # DUMP-NEXT: 0x0000000100000f77 /tmp/main.cpp:2
97 # DUMP-NEXT: FunctionInfo @ 0x0000008c: [0x0000000100000f90 - 0x0000000100000fb5) "main"
98 # DUMP-NEXT: LineTable:
99 # DUMP-NEXT: 0x0000000100000f90 /tmp/main.cpp:4
100 # DUMP-NEXT: 0x0000000100000fa4 /tmp/main.cpp:5
101 # DUMP-NEXT: 0x0000000100000faa /tmp/main.cpp:2
102 # DUMP-NEXT: 0x0000000100000fb0 /tmp/main.cpp:5
103 # DUMP-NEXT: 0x0000000100000fb3 /tmp/main.cpp:6
104 # DUMP-NEXT: InlineInfo:
105 # DUMP-NEXT: [0x0000000100000f90 - 0x0000000100000fb5) main
106 # DUMP-NEXT: [0x0000000100000faa - 0x0000000100000fb0) _Z3fooi called from /tmp/main.cpp:5
112 cpusubtype: 0x00000003
121 uuid: F6241B52-09ED-3BBE-A6BC-8A7F5A4817CD
122 - cmd: LC_BUILD_VERSION
159 addr: 0x0000000100000F70
166 reserved1: 0x00000000
167 reserved2: 0x00000000
168 reserved3: 0x00000000
169 content: CFFAEDFE07000001030000000A000000070000007805000000000000000000001B00000018000000F6241B5209ED3BBEA6BC8A7F5A4817CD32000000180000000100000000
170 - sectname: __unwind_info
172 addr: 0x0000000100000FB8
179 reserved1: 0x00000000
180 reserved2: 0x00000000
181 reserved3: 0x00000000
182 content: CFFAEDFE07000001030000000A000000070000007805000000000000000000001B00000018000000F6241B5209ED3BBEA6BC8A7F5A4817CD320000001800000001000000000E0A00
206 - sectname: __debug_line
208 addr: 0x0000000100002000
215 reserved1: 0x00000000
216 reserved2: 0x00000000
217 reserved3: 0x00000000
218 - sectname: __debug_pubnames
220 addr: 0x000000010000206A
227 reserved1: 0x00000000
228 reserved2: 0x00000000
229 reserved3: 0x00000000
230 - sectname: __debug_pubtypes
232 addr: 0x0000000100002099
239 reserved1: 0x00000000
240 reserved2: 0x00000000
241 reserved3: 0x00000000
242 - sectname: __debug_aranges
244 addr: 0x00000001000020BC
251 reserved1: 0x00000000
252 reserved2: 0x00000000
253 reserved3: 0x00000000
254 - sectname: __debug_info
256 addr: 0x00000001000020FC
263 reserved1: 0x00000000
264 reserved2: 0x00000000
265 reserved3: 0x00000000
266 - sectname: __debug_abbrev
268 addr: 0x00000001000021DC
275 reserved1: 0x00000000
276 reserved2: 0x00000000
277 reserved3: 0x00000000
278 - sectname: __debug_str
280 addr: 0x0000000100002284
287 reserved1: 0x00000000
288 reserved2: 0x00000000
289 reserved3: 0x00000000
290 - sectname: __apple_names
292 addr: 0x00000001000022E9
299 reserved1: 0x00000000
300 reserved2: 0x00000000
301 reserved3: 0x00000000
302 content: 485341480100000003000000030000000C0000000000000001000000010006000000000002000000FFFFFFFF8973880BDE28616A6A7F9A7C44000000580000006C00000047000000020000002A000000AC000000000000003F000000020000002A000000AC0000000000000051000000010000006900000000000000
303 - sectname: __apple_namespac
305 addr: 0x0000000100002365
312 reserved1: 0x00000000
313 reserved2: 0x00000000
314 reserved3: 0x00000000
315 content: 485341480100000001000000000000000C000000000000000100000001000600FFFFFFFF
316 - sectname: __apple_types
318 addr: 0x0000000100002389
325 reserved1: 0x00000000
326 reserved2: 0x00000000
327 reserved3: 0x00000000
328 content: 48534148010000000200000002000000180000000000000004000000010006000300050005000B000600060000000000010000003080880B6320957C440000005B0000004D0000000100000062000000240000A4283A0C000000006000000001000000D800000024000057D77B9300000000
329 - sectname: __apple_objc
331 addr: 0x00000001000023FB
338 reserved1: 0x00000000
339 reserved2: 0x00000000
340 reserved3: 0x00000000
341 content: 485341480100000001000000000000000C000000000000000100000001000600FFFFFFFF
363 - __mh_execute_header
368 - 'Apple clang version 11.0.0 (clang-1100.0.33.17)'
382 Tag: DW_TAG_compile_unit
383 Children: DW_CHILDREN_yes
385 - Attribute: DW_AT_producer
387 - Attribute: DW_AT_language
389 - Attribute: DW_AT_name
391 - Attribute: DW_AT_stmt_list
392 Form: DW_FORM_sec_offset
393 - Attribute: DW_AT_comp_dir
395 - Attribute: DW_AT_GNU_pubnames
396 Form: DW_FORM_flag_present
397 - Attribute: DW_AT_low_pc
399 - Attribute: DW_AT_high_pc
402 Tag: DW_TAG_subprogram
403 Children: DW_CHILDREN_yes
405 - Attribute: DW_AT_low_pc
407 - Attribute: DW_AT_high_pc
409 - Attribute: DW_AT_frame_base
410 Form: DW_FORM_exprloc
411 - Attribute: DW_AT_abstract_origin
412 Form: DW_FORM_ref_addr
414 Tag: DW_TAG_formal_parameter
415 Children: DW_CHILDREN_no
417 - Attribute: DW_AT_location
418 Form: DW_FORM_exprloc
419 - Attribute: DW_AT_abstract_origin
420 Form: DW_FORM_ref_addr
422 Tag: DW_TAG_subprogram
423 Children: DW_CHILDREN_yes
425 - Attribute: DW_AT_linkage_name
427 - Attribute: DW_AT_name
429 - Attribute: DW_AT_decl_file
431 - Attribute: DW_AT_decl_line
433 - Attribute: DW_AT_type
434 Form: DW_FORM_ref_addr
435 - Attribute: DW_AT_external
436 Form: DW_FORM_flag_present
437 - Attribute: DW_AT_inline
440 Tag: DW_TAG_formal_parameter
441 Children: DW_CHILDREN_no
443 - Attribute: DW_AT_name
445 - Attribute: DW_AT_decl_file
447 - Attribute: DW_AT_decl_line
449 - Attribute: DW_AT_type
450 Form: DW_FORM_ref_addr
452 Tag: DW_TAG_base_type
453 Children: DW_CHILDREN_no
455 - Attribute: DW_AT_name
457 - Attribute: DW_AT_encoding
459 - Attribute: DW_AT_byte_size
462 Tag: DW_TAG_subprogram
463 Children: DW_CHILDREN_yes
465 - Attribute: DW_AT_low_pc
467 - Attribute: DW_AT_high_pc
469 - Attribute: DW_AT_frame_base
470 Form: DW_FORM_exprloc
471 - Attribute: DW_AT_name
473 - Attribute: DW_AT_decl_file
475 - Attribute: DW_AT_decl_line
477 - Attribute: DW_AT_type
478 Form: DW_FORM_ref_addr
479 - Attribute: DW_AT_external
480 Form: DW_FORM_flag_present
482 Tag: DW_TAG_formal_parameter
483 Children: DW_CHILDREN_no
485 - Attribute: DW_AT_location
486 Form: DW_FORM_exprloc
487 - Attribute: DW_AT_name
489 - Attribute: DW_AT_decl_file
491 - Attribute: DW_AT_decl_line
493 - Attribute: DW_AT_type
494 Form: DW_FORM_ref_addr
497 Children: DW_CHILDREN_no
499 - Attribute: DW_AT_location
500 Form: DW_FORM_exprloc
501 - Attribute: DW_AT_name
503 - Attribute: DW_AT_decl_file
505 - Attribute: DW_AT_decl_line
507 - Attribute: DW_AT_type
508 Form: DW_FORM_ref_addr
510 Tag: DW_TAG_inlined_subroutine
511 Children: DW_CHILDREN_yes
513 - Attribute: DW_AT_abstract_origin
514 Form: DW_FORM_ref_addr
515 - Attribute: DW_AT_low_pc
517 - Attribute: DW_AT_high_pc
519 - Attribute: DW_AT_call_file
521 - Attribute: DW_AT_call_line
524 Tag: DW_TAG_pointer_type
525 Children: DW_CHILDREN_no
527 - Attribute: DW_AT_type
528 Form: DW_FORM_ref_addr
530 Tag: DW_TAG_const_type
531 Children: DW_CHILDREN_no
533 - Attribute: DW_AT_type
534 Form: DW_FORM_ref_addr
540 SegmentSelectorSize: 0
542 - Address: 0x0000000100000F70
544 - Address: 0x0000000100000F90
552 - DieOffset: 0x0000002A
554 - DieOffset: 0x0000002A
556 - DieOffset: 0x00000069
564 - DieOffset: 0x00000062
566 - DieOffset: 0x000000D8
572 - AbbrCode: 0x00000001
574 - Value: 0x0000000000000001
575 - Value: 0x0000000000000004
576 - Value: 0x0000000000000031
577 - Value: 0x0000000000000000
578 - Value: 0x000000000000003A
579 - Value: 0x0000000000000001
580 - Value: 0x0000000100000F70
581 - Value: 0x0000000000000045
582 - AbbrCode: 0x00000002
584 - Value: 0x0000000100000F70
585 - Value: 0x0000000000000011
586 - Value: 0x0000000000000001
588 - Value: 0x0000000000000046
589 - AbbrCode: 0x00000003
591 - Value: 0x0000000000000002
592 BlockData: [ 0x91, 0x7C ]
593 - Value: 0x0000000000000056
594 - AbbrCode: 0x00000000
595 - AbbrCode: 0x00000004
597 - Value: 0x000000000000003F
598 - Value: 0x0000000000000047
599 - Value: 0x0000000000000001
600 - Value: 0x0000000000000001
601 - Value: 0x0000000000000062
602 - Value: 0x0000000000000001
603 - Value: 0x0000000000000001
604 - AbbrCode: 0x00000005
606 - Value: 0x000000000000004B
607 - Value: 0x0000000000000001
608 - Value: 0x0000000000000001
609 - Value: 0x0000000000000062
610 - AbbrCode: 0x00000000
611 - AbbrCode: 0x00000006
613 - Value: 0x000000000000004D
614 - Value: 0x0000000000000005
615 - Value: 0x0000000000000004
616 - AbbrCode: 0x00000007
618 - Value: 0x0000000100000F90
619 - Value: 0x0000000000000025
620 - Value: 0x0000000000000001
622 - Value: 0x0000000000000051
623 - Value: 0x0000000000000001
624 - Value: 0x0000000000000004
625 - Value: 0x0000000000000062
626 - Value: 0x0000000000000001
627 - AbbrCode: 0x00000008
629 - Value: 0x0000000000000002
630 BlockData: [ 0x91, 0x74 ]
631 - Value: 0x0000000000000056
632 - Value: 0x0000000000000001
633 - Value: 0x0000000000000004
634 - Value: 0x0000000000000062
635 - AbbrCode: 0x00000008
637 - Value: 0x0000000000000002
638 BlockData: [ 0x91, 0x68 ]
639 - Value: 0x000000000000005B
640 - Value: 0x0000000000000001
641 - Value: 0x0000000000000004
642 - Value: 0x00000000000000C9
643 - AbbrCode: 0x00000009
645 - Value: 0x0000000000000002
646 BlockData: [ 0x91, 0x64 ]
647 - Value: 0x000000000000004B
648 - Value: 0x0000000000000001
649 - Value: 0x0000000000000005
650 - Value: 0x0000000000000062
651 - AbbrCode: 0x0000000A
653 - Value: 0x0000000000000046
654 - Value: 0x0000000100000FAA
655 - Value: 0x0000000000000006
656 - Value: 0x0000000000000001
657 - Value: 0x0000000000000005
658 - AbbrCode: 0x00000003
660 - Value: 0x0000000000000002
661 BlockData: [ 0x91, 0x7C ]
662 - Value: 0x0000000000000056
663 - AbbrCode: 0x00000000
664 - AbbrCode: 0x00000000
665 - AbbrCode: 0x0000000B
667 - Value: 0x00000000000000CE
668 - AbbrCode: 0x0000000B
670 - Value: 0x00000000000000D3
671 - AbbrCode: 0x0000000C
673 - Value: 0x00000000000000D8
674 - AbbrCode: 0x00000006
676 - Value: 0x0000000000000060
677 - Value: 0x0000000000000006
678 - Value: 0x0000000000000001
679 - AbbrCode: 0x00000000
690 StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
697 - Opcode: DW_LNS_extended_op
699 SubOpcode: DW_LNE_set_address
701 - Opcode: DW_LNS_copy
703 - Opcode: DW_LNS_set_column
705 - Opcode: DW_LNS_set_prologue_end
709 - Opcode: DW_LNS_set_column
711 - Opcode: DW_LNS_negate_stmt
715 - Opcode: DW_LNS_set_column
719 - Opcode: DW_LNS_advance_pc
721 - Opcode: DW_LNS_extended_op
723 SubOpcode: DW_LNE_end_sequence
725 - Opcode: DW_LNS_extended_op
727 SubOpcode: DW_LNE_set_address
731 - Opcode: DW_LNS_set_column
733 - Opcode: DW_LNS_set_prologue_end
735 - Opcode: DW_LNS_const_add_pc
739 - Opcode: DW_LNS_set_column
743 - Opcode: DW_LNS_set_column
745 - Opcode: DW_LNS_negate_stmt
749 - Opcode: DW_LNS_set_column
751 - Opcode: DW_LNS_negate_stmt
755 - Opcode: DW_LNS_set_column
759 - Opcode: DW_LNS_advance_pc
761 - Opcode: DW_LNS_extended_op
763 SubOpcode: DW_LNE_end_sequence