[NFC][RemoveDIs] Prefer iterators over inst-pointers in InstCombine
[llvm-project.git] / llvm / test / tools / dsymutil / ARM / dwarf5-dwarf4-combination-macho.test
blobcb73e28396a0d3442dd9da1c5db7202ba43aecf2
1 ; This test checks to ensure that if a DWARF v5 and DWARF v4 object file is used to
2 ; generate a dsym, dsymutil correctly outputs the debug information, by keeping
3 ; the DWARF v5 and DWARF v4 debug info distinct, and that all the section headers
4 ; have the correct format.
6 ; 1.o was produced with the source file:
8 ; a.cpp
9 ; __attribute__((section("1,__text_foo"))) void foo() {}
11 ; int foo2(int a) {
12 ;     return a+5;
13 ; }
14 ; int main () {
15 ;     return 1;
16 ; }
18 ; clang -g -c -O1 a.cpp -Xclang -gdwarf-5 -o 1.o
20 ; 2.o was produced with the following source file:
22 ; b.cpp
23 ; __attribute__((section("1,__text_foo2"))) void foo2() {}
25 ; int bar(int x) {
26 ;     int y = x + 2;
27 ;     return y;
28 ; }
30 ; clang -g -c -O1 b.cpp -gdwarf-4 -o 2.o
33 RUN: rm -rf %t.dir && mkdir -p %t.dir
34 RUN: dsymutil -y %p/dummy-debug-map-amr64.map -oso-prepend-path=%p/../Inputs/DWARF5-DWARF4-combination -o %t.dir/dwarf5-dwarf4-combination-macho.dSYM
35 RUN: llvm-dwarfdump %t.dir/dwarf5-dwarf4-combination-macho.dSYM -a --verbose | FileCheck %s
38 CHECK:.debug_abbrev contents:
39 CHECK-NEXT: Abbrev table for offset: 0x00000000
41 CHECK: .debug_info contents:
42 CHECK: 0x00000000: Compile Unit: length = 0x0000004a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 
43 CHECK: DW_AT_producer [DW_FORM_strx]     (indexed (00000000) string = "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")
44 CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "a.cpp")
45 CHECK: DW_AT_LLVM_sysroot [DW_FORM_strx] (indexed (00000002) string = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
46 CHECK: DW_AT_APPLE_sdk [DW_FORM_strx]    (indexed (00000003) string = "MacOSX.sdk")
47 CHECK: DW_AT_str_offsets_base [DW_FORM_sec_offset]       (0x00000008)
48 CHECK: DW_AT_comp_dir [DW_FORM_strx]     (indexed (00000004) string = "/Users/shubham/Development/test109275485")
49 CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[RANGELIST_OFFSET:[0-9a-f]+]]
50 CHECK-NEXT:                  [0x[[RANGELIST_OFFSET_START:[0-9a-f]+]], 0x[[RANGELIST_OFFSET_END:[0-9a-f]+]]))
51 CHECK-NEXT: DW_AT_addr_base [DW_FORM_sec_offset]      (0x00000008)
52 CHECK: 0x0000002c:   DW_TAG_subprogram [2] * (0x0000000c)
53 CHECK-NEXT:  DW_AT_low_pc [DW_FORM_addrx]     (indexed (00000000) address = 0x[[#%.16x,LOCLIST_LOWPC:]])
54 CHECK: DW_AT_linkage_name [DW_FORM_strx]       (indexed (00000005) string = "_Z4foo2i")
55 CHECK: DW_AT_name [DW_FORM_strx]       (indexed (00000006) string = "foo2")
56 CHECK: 0x0000003c:     DW_TAG_formal_parameter [3]   (0x0000002c)
57 CHECK-NEXT:                   DW_AT_location [DW_FORM_sec_offset]   (0x[[LOCLIST_OFFSET:[0-9a-f]+]]: 
58 CHECK-NEXT:                      [0x[[#%.16x,LOCLIST_PAIR_START:]], 0x[[#%.16x,LOCLIST_PAIR_END:]]): [[LOCLIST_EXPR:.*]]
59 CHECK-NEXT:                      [0x[[#%.16x,LOCLIST_PAIR_START2:]], 0x[[#%.16x,LOCLIST_PAIR_END2:]]): [[LOCLIST_EXPR2:.*]])
60 CHECK: DW_AT_name [DW_FORM_strx]     (indexed (00000007) string = "a")
62 CHECK: 0x0000004e: Compile Unit: length = 0x00000072, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 
63 CHECK: DW_AT_producer [DW_FORM_strp]     ( .debug_str[0x00000001] = "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")
64 CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000e0] = "b.cpp")
65 CHECK: DW_AT_LLVM_sysroot [DW_FORM_strp] ( .debug_str[0x00000039] = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
66 CHECK: DW_AT_APPLE_sdk [DW_FORM_strp]    ( .debug_str[0x00000098] = "MacOSX.sdk")
67 CHECK-NOT: DW_AT_str_offsets_base
68 CHECK: DW_AT_comp_dir [DW_FORM_strp]     ( .debug_str[0x000000a3] = "/Users/shubham/Development/test109275485")
69 CHECK:              DW_AT_low_pc [DW_FORM_addr]       (0x[[#%.16x,RANGE_LOWPC:]])
70 CHECK-NEXT:              DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
71 CHECK-NEXT:                 [0x[[#%.16x,RANGE_START:]], 0x[[#%.16x,RANGE_END:]]))
72 CHECK: 0x00000080:   DW_TAG_subprogram [6] * (0x00000059)
73 CHECK-NEXT:                DW_AT_low_pc [DW_FORM_addr]     (0x[[#%.16x,LOC_LOWPC:]])
74 CHECK: DW_AT_linkage_name [DW_FORM_strp]       ( .debug_str[0x000000e6] = "_Z3bari")
75 CHECK: DW_AT_name [DW_FORM_strp]       ( .debug_str[0x000000ee] = "bar")
76 CHECK: 0x0000009d:     DW_TAG_formal_parameter [7]   (0x00000080)
77 CHECK-NEXT:                  DW_AT_location [DW_FORM_sec_offset]   (0x[[LOC_OFFSET:[0-9a-f]+]]: 
78 CHECK-NEXT:                     [0x[[#%.16x,LOC_PAIR_START:]], 0x[[#%.16x,LOC_PAIR_END:]]): [[LOC_EXPR:.*]]
79 CHECK-NEXT:                     [0x[[#%.16x,LOC_PAIR_START2:]], 0x[[#%.16x,LOC_PAIR_END2:]]): [[LOC_EXPR2:.*]])
80 CHECK: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x000000f2] = "x")
82 CHECK: .debug_loc contents:
83 CHECK-NEXT: 0x[[LOC_OFFSET]]:
84 CHECK-NEXT:            (0x[[#sub(LOC_PAIR_START,LOC_LOWPC)]], 0x[[#sub(LOC_PAIR_END,LOC_LOWPC)]]): [[LOC_EXPR:.*]]
85 CHECK-NEXT:            (0x[[#sub(LOC_PAIR_START2,LOC_LOWPC)]], 0x[[#sub(LOC_PAIR_END2,LOC_LOWPC)]]): [[LOC_EXPR2:.*]]
87 CHECK: .debug_loclists contents:
88 CHECK-NEXT: 0x00000000: locations list header: length = 0x00000018, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
89 CHECK-NEXT: 0x[[LOCLIST_OFFSET]]: 
90 CHECK-NEXT:            DW_LLE_base_addressx   (0x0000000000000000)
91 CHECK-NEXT:            DW_LLE_offset_pair     (0x[[#sub(LOCLIST_PAIR_START,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END,LOCLIST_LOWPC)]])
92 CHECK-NEXT:            DW_LLE_offset_pair     (0x[[#sub(LOCLIST_PAIR_START2,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END2,LOCLIST_LOWPC)]])
93 CHECK-NEXT:            DW_LLE_end_of_list     ()
95 CHECK: .debug_line contents:
96 CHECK-NEXT: debug_line[0x00000000]
97 CHECK-NEXT: Line table prologue:
98 CHECK-NEXT:     total_length: 0x00000048
99 CHECK-NEXT:           format: DWARF32
100 CHECK-NEXT:          version: 5
101 CHECK-NEXT:     address_size: 8
102 CHECK-NEXT:  seg_select_size: 0
103 CHECK-NEXT:  prologue_length: 0x00000025
104 CHECK-NEXT:  min_inst_length: 1
105 CHECK-NEXT: max_ops_per_inst: 1
106 CHECK-NEXT:  default_is_stmt: 1
107 CHECK-NEXT:        line_base: -5
108 CHECK-NEXT:       line_range: 14
109 CHECK-NEXT:      opcode_base: 13
110 CHECK-NEXT: standard_opcode_lengths[DW_LNS_copy] = 0
111 CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_pc] = 1
112 CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_line] = 1
113 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_file] = 1
114 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_column] = 1
115 CHECK-NEXT: standard_opcode_lengths[DW_LNS_negate_stmt] = 0
116 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_basic_block] = 0
117 CHECK-NEXT: standard_opcode_lengths[DW_LNS_const_add_pc] = 0
118 CHECK-NEXT: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
119 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
120 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
121 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_isa] = 1
122 CHECK-NEXT: include_directories[  0] =  .debug_line_str[0x00000000] = "/Users/shubham/Development/test109275485"
123 CHECK-NEXT: file_names[  0]:
124 CHECK-NEXT:            name:  .debug_line_str[0x00000029] = "a.cpp"
125 CHECK-NEXT:       dir_index: 0
127 CHECK: debug_line[0x0000004c]
128 CHECK-NEXT: Line table prologue:
129 CHECK-NEXT:     total_length: 0x0000003b
130 CHECK-NEXT:           format: DWARF32
131 CHECK-NEXT:          version: 4
132 CHECK-NEXT:  prologue_length: 0x0000001d
133 CHECK-NEXT:  min_inst_length: 1
134 CHECK-NEXT: max_ops_per_inst: 1
135 CHECK-NEXT:  default_is_stmt: 1
136 CHECK-NEXT:        line_base: -5
137 CHECK-NEXT:       line_range: 14
138 CHECK-NEXT:      opcode_base: 13
139 CHECK-NEXT: standard_opcode_lengths[DW_LNS_copy] = 0
140 CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_pc] = 1
141 CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_line] = 1
142 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_file] = 1
143 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_column] = 1
144 CHECK-NEXT: standard_opcode_lengths[DW_LNS_negate_stmt] = 0
145 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_basic_block] = 0
146 CHECK-NEXT: standard_opcode_lengths[DW_LNS_const_add_pc] = 0
147 CHECK-NEXT: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
148 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
149 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
150 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_isa] = 1
151 CHECK-NEXT: file_names[  1]:
152 CHECK-NEXT:            name: "b.cpp"
153 CHECK-NEXT:       dir_index: 0
154 CHECK-NEXT:        mod_time: 0x00000000
155 CHECK-NEXT:          length: 0x00000000
157 CHECK: .debug_str contents:
158 CHECK-NEXT: 0x00000000: ""
159 CHECK-NEXT: 0x00000001: "Apple clang version 14.0.3 (clang-1403.0.22.14.1)"
160 CHECK-NEXT: 0x00000033: "a.cpp"
161 CHECK-NEXT: 0x00000039: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
162 CHECK-NEXT: 0x00000098: "MacOSX.sdk"
163 CHECK-NEXT: 0x000000a3: "/Users/shubham/Development/test109275485"
164 CHECK-NEXT: 0x000000cc: "_Z4foo2i"
165 CHECK-NEXT: 0x000000d5: "foo2"
166 CHECK-NEXT: 0x000000da: "a"
167 CHECK-NEXT: 0x000000dc: "int"
168 CHECK-NEXT: 0x000000e0: "b.cpp"
169 CHECK-NEXT: 0x000000e6: "_Z3bari"
170 CHECK-NEXT: 0x000000ee: "bar"
171 CHECK-NEXT: 0x000000f2: "x"
172 CHECK-NEXT: 0x000000f4: "y"
174 CHECK: .debug_line_str contents:
175 CHECK-NEXT: 0x00000000: "/Users/shubham/Development/test109275485"
176 CHECK-NEXT: 0x00000029: "a.cpp"
178 CHECK: .debug_ranges contents:
179 CHECK-NEXT: 00000000 [[#sub(RANGE_START,RANGE_LOWPC)]] [[#sub(RANGE_END,RANGE_LOWPC)]]
181 CHECK: .debug_rnglists contents:
182 CHECK-NEXT: 0x00000000: range list header: length = 0x0000000e, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
183 CHECK-NEXT: ranges:
184 CHECK-NEXT: [[RANGELIST_OFFSET]]: [DW_RLE_base_addressx]:  0x0000000000000000
185 CHECK-NEXT: 0x0000000e: [DW_RLE_offset_pair  ]: {{.*}}[0x[[RANGELIST_OFFSET_START]], 0x[[RANGELIST_OFFSET_END]])
186 CHECK-NEXT: 0x00000011: [DW_RLE_end_of_list  ]
188 CHECK: .debug_str_offsets contents:
189 CHECK-NEXT: 0x00000000: Contribution size = 40, Format = DWARF32, Version = 5
190 CHECK-NEXT: 0x00000008: 00000001 "Apple clang version 14.0.3 (clang-1403.0.22.14.1)"
191 CHECK-NEXT: 0x0000000c: 00000033 "a.cpp"
192 CHECK-NEXT: 0x00000010: 00000039 "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
193 CHECK-NEXT: 0x00000014: 00000098 "MacOSX.sdk"
194 CHECK-NEXT: 0x00000018: 000000a3 "/Users/shubham/Development/test109275485"
195 CHECK-NEXT: 0x0000001c: 000000cc "_Z4foo2i"
196 CHECK-NEXT: 0x00000020: 000000d5 "foo2"
197 CHECK-NEXT: 0x00000024: 000000da "a"
198 CHECK-NEXT: 0x00000028: 000000dc "int"
200 CHECK: .debug_names contents:
201 CHECK-NEXT: Name Index @ 0x0 {
202 CHECK-NEXT:   Header {
203 CHECK-NEXT:     Length: 0xBC
204 CHECK-NEXT:     Format: DWARF32
205 CHECK-NEXT:     Version: 5
206 CHECK-NEXT:     CU count: 2
207 CHECK-NEXT:     Local TU count: 0
208 CHECK-NEXT:     Foreign TU count: 0
209 CHECK-NEXT:     Bucket count: 5
210 CHECK-NEXT:     Name count: 5
211 CHECK-NEXT:     Abbreviations table size: 0x11
212 CHECK-NEXT:     Augmentation: 'LLVM0700'
213 CHECK-NEXT:   }