xref: /llvm-project/llvm/test/tools/dsymutil/ARM/dwarf5-macho.test (revision 4a67f809828e11988c6a097cb400fd7cbbf47628)
1; This test checks to that DWARF v5 debug info can be correctly linked
2; into a dSYM bundle by dsymutil, with the correct section names and DWARF v5
3; headers for the different sections.
4
5; 1.o was produced with the source file:
6
7; a.cpp
8; __attribute__((section("1,__text_foo"))) void foo() {}
9;
10; int foo2(int a) {
11;     return a+5;
12; }
13; int main () {
14;     return 1;
15; }
16
17; clang -g -c -O1 a.cpp -Xclang -gdwarf-5 -o 1.o
18
19
20RUN: rm -rf %t.dir && mkdir -p %t.dir
21RUN: dsymutil -y %p/dummy-debug-map-amr64.map -oso-prepend-path=%p/../Inputs/DWARF5 -o %t.dir/dwarf5-macho.dSYM
22RUN: llvm-dwarfdump %t.dir/dwarf5-macho.dSYM -a --verbose | FileCheck %s
23
24RUN: rm -rf %t.dir && mkdir -p %t.dir
25RUN: dsymutil --linker parallel --no-odr -y %p/dummy-debug-map-amr64.map \
26RUN:   -oso-prepend-path=%p/../Inputs/DWARF5 -o %t.dir/dwarf5-macho.dSYM
27RUN: llvm-dwarfdump %t.dir/dwarf5-macho.dSYM -a --verbose | FileCheck %s
28
29### Uncomment following when llvm-dwarfdump will print resolved address ranges
30### for the case mutiplue compile units.
31COM: rm -rf %t.dir && mkdir -p %t.dir
32COM: dsymutil --linker parallel -y %p/dummy-debug-map-amr64.map \
33COM:   -oso-prepend-path=%p/../Inputs/DWARF5 -o %t.dir/dwarf5-macho.dSYM
34COM: llvm-dwarfdump %t.dir/dwarf5-macho.dSYM -a --verbose | FileCheck %s \
35COM: --check-prefixes=CHECK,CHECK-LLVM
36
37
38CHECK:.debug_abbrev contents:
39CHECK-NEXT: Abbrev table for offset: 0x00000000
40
41CHECK: .debug_info contents:
42CHECK-LLVM: Compile Unit: length = 0x0000001f, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = {{.*}}, addr_size = 0x08
43CHECK-LLVM: DW_TAG_compile_unit
44CHECK-LLVM: DW_TAG_base_type
45CHECK: Compile Unit: length = 0x0000004a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = {{.*}}, addr_size = 0x08
46CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[RANGELIST_OFFSET:[0-9a-f]+]]
47CHECK-NEXT:                  [0x[[RANGELIST_OFFSET_START:[0-9a-f]+]], 0x[[RANGELIST_OFFSET_END:[0-9a-f]+]]))
48CHECK-NEXT: DW_AT_addr_base [DW_FORM_sec_offset]      (0x00000008)
49CHECK:   DW_TAG_subprogram
50CHECK-NEXT:  DW_AT_low_pc [DW_FORM_addrx]     (indexed (00000000) address = 0x[[#%.16x,LOCLIST_LOWPC:]])
51CHECK:     DW_TAG_formal_parameter
52CHECK-NEXT:                   DW_AT_location [DW_FORM_sec_offset]   (0x[[LOC_OFFSET:[0-9a-f]+]]:
53CHECK-NEXT:                      [0x[[#%.16x,LOCLIST_PAIR_START:]], 0x[[#%.16x,LOCLIST_PAIR_END:]]): [[LOCLIST_EXPR:.*]]
54CHECK-NEXT:                      [0x[[#%.16x,LOCLIST_PAIR_START2:]], 0x[[#%.16x,LOCLIST_PAIR_END2:]]): [[LOCLIST_EXPR2:.*]])
55
56CHECK: .debug_loclists contents:
57CHECK-NEXT: 0x00000000: locations list header: length = 0x00000018, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
58CHECK-NEXT: 0x[[LOC_OFFSET]]:
59CHECK-NEXT:            DW_LLE_base_addressx   (0x0000000000000000)
60CHECK-NEXT:            DW_LLE_offset_pair     (0x[[#sub(LOCLIST_PAIR_START,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END,LOCLIST_LOWPC)]])
61CHECK-NEXT:            DW_LLE_offset_pair     (0x[[#sub(LOCLIST_PAIR_START2,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END2,LOCLIST_LOWPC)]])
62CHECK-NEXT:            DW_LLE_end_of_list     ()
63
64CHECK: .debug_line contents:
65CHECK-NEXT: debug_line[0x00000000]
66CHECK-NEXT: Line table prologue:
67CHECK-NEXT:     total_length: 0x0000005a
68CHECK-NEXT:           format: DWARF32
69CHECK-NEXT:          version: 5
70CHECK-NEXT:     address_size: 8
71CHECK-NEXT:  seg_select_size: 0
72CHECK-NEXT:  prologue_length: 0x00000037
73CHECK-NEXT:  min_inst_length: 1
74CHECK-NEXT: max_ops_per_inst: 1
75CHECK-NEXT:  default_is_stmt: 1
76CHECK-NEXT:        line_base: -5
77CHECK-NEXT:       line_range: 14
78CHECK-NEXT:      opcode_base: 13
79CHECK-NEXT: standard_opcode_lengths[DW_LNS_copy] = 0
80CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_pc] = 1
81CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_line] = 1
82CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_file] = 1
83CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_column] = 1
84CHECK-NEXT: standard_opcode_lengths[DW_LNS_negate_stmt] = 0
85CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_basic_block] = 0
86CHECK-NEXT: standard_opcode_lengths[DW_LNS_const_add_pc] = 0
87CHECK-NEXT: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
88CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
89CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
90CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_isa] = 1
91CHECK-NEXT: include_directories[  0] =  .debug_line_str[0x00000000] = "/Users/shubham/Development/test109275485"
92CHECK-NEXT: file_names[  0]:
93CHECK-NEXT:            name:  .debug_line_str[0x00000029] = "a.cpp"
94CHECK-NEXT:       dir_index: 0
95CHECK-NEXT:    md5_checksum: 2675ab7ce3623b564cfd8a2906a462e5
96
97
98CHECK: .debug_str contents:
99
100CHECK: .debug_line_str contents:
101CHECK-NEXT: 0x00000000: "/Users/shubham/Development/test109275485"
102CHECK-NEXT: 0x00000029: "a.cpp"
103
104CHECK: .debug_rnglists contents:
105CHECK-NEXT: 0x00000000: range list header: length = 0x0000000e, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
106CHECK-NEXT: ranges:
107CHECK-NEXT: [[RANGELIST_OFFSET]]: [DW_RLE_base_addressx]:  0x0000000000000000
108CHECK-NEXT: 0x0000000e: [DW_RLE_offset_pair  ]: {{.*}}[0x[[RANGELIST_OFFSET_START]], 0x[[RANGELIST_OFFSET_END]])
109CHECK-NEXT: 0x00000011: [DW_RLE_end_of_list  ]
110
111CHECK: .debug_names contents:
112CHECK-NEXT: Name Index @ 0x0 {
113CHECK-NEXT:   Header {
114CHECK-NEXT:     Length:
115CHECK-NEXT:     Format: DWARF32
116CHECK-NEXT:     Version: 5
117CHECK-NEXT:     CU count: 1
118CHECK-NEXT:     Local TU count: 0
119CHECK-NEXT:     Foreign TU count: 0
120CHECK-NEXT:     Bucket count: 3
121CHECK-NEXT:     Name count: 3
122CHECK-NEXT:     Abbreviations table size:
123CHECK-NEXT:     Augmentation: 'LLVM0700'
124CHECK-NEXT:   }
125