1 RUN: dsymutil -no-output -verbose -oso-prepend-path=%p %p/Inputs/basic.macho.x86_64 | FileCheck %s
2 RUN: dsymutil -no-output -verbose -oso-prepend-path=%p %p/Inputs/basic-lto.macho.x86_64 | FileCheck %s --check-prefix=CHECK-LTO
3 RUN: dsymutil -no-output -verbose -oso-prepend-path=%p %p/Inputs/basic-archive.macho.x86_64 | FileCheck %s --check-prefix=CHECK-ARCHIVE
4 RUN: dsymutil -no-output -verbose -oso-prepend-path=%p %p/Inputs/basic.macho.x86_64 %p/Inputs/basic-lto.macho.x86_64 %p/Inputs/basic-archive.macho.x86_64 | FileCheck %s --check-prefixes=CHECK,CHECK-LTO,CHECK-ARCHIVE
5 RUN: dsymutil -no-output -verbose -oso-prepend-path=%p -D %p/Inputs %p/Inputs/basic-relink.macho.arm64.dylib | FileCheck %s --check-prefix=CHECK-RELINK
6 RUN: dsymutil -no-output -verbose -oso-prepend-path=%p -D %p/Inputs %p/Inputs/two-level-relink.macho.arm64.dylib | FileCheck %s --check-prefix=CHECK-RELINK-TWO
7 RUN: dsymutil -no-output -verbose -oso-prepend-path=%p -build-variant-suffix=_debug -D WrongPath -D %p/Inputs %p/Inputs/variant-relink.macho.arm64.dylib | FileCheck %s --check-prefix=CHECK-RELINK-VARIANT
9 This test check the basic Dwarf linking process through the debug dumps.
11 ================================= Simple link ================================
12 CHECK: DEBUG MAP OBJECT: {{.*}}basic1.macho.x86_64.o
13 CHECK: Input compilation unit:
14 CHECK-NEXT: TAG_compile_unit
16 CHECK: AT_name {{.*}}basic1.c
18 CHECK: DEBUG MAP OBJECT: {{.*}}basic2.macho.x86_64.o
19 CHECK: Input compilation unit:
20 CHECK-NEXT: TAG_compile_unit
22 CHECK: AT_name {{.*}}basic2.c
24 CHECK: DEBUG MAP OBJECT: {{.*}}basic3.macho.x86_64.o
25 CHECK: Input compilation unit:
26 CHECK-NEXT: TAG_compile_unit
28 CHECK: AT_name {{.*}}basic3.c
30 CHECK-NOT: Found valid debug map entry
31 CHECK: Found valid debug map entry: _main 0x0000000000000000 => 0x0000000100000ea0
32 CHECK-NEXT: Keeping subprogram DIE:
33 CHECK-NEXT: DW_TAG_subprogram
34 CHECK-NEXT: DW_AT_name{{.*}}"main"
36 CHECK: Found valid debug map entry: _private_int 0x0000000000000560 => 0x0000000100001008
37 CHECK-NEXT: Keeping variable DIE:
38 CHECK-NEXT: DW_TAG_variable
39 CHECK-NEXT: DW_AT_name {{.*}}"private_int"
40 CHECK-NOT: Found valid debug map entry
41 CHECK: Found valid debug map entry: _baz 0x0000000000000310 => 0x0000000100001000
42 CHECK-NEXT: Keeping variable DIE:
43 CHECK-NEXT: DW_TAG_variable
44 CHECK-NEXT: DW_AT_name {{.*}}"baz"
45 CHECK-NOT: Found valid debug map entry
46 CHECK: Found valid debug map entry: _foo 0x0000000000000020 => 0x0000000100000ed0
47 CHECK-NEXT: Keeping subprogram DIE:
48 CHECK-NEXT: DW_TAG_subprogram
49 CHECK-NEXT: DW_AT_name {{.*}}"foo"
50 CHECK-NOT: Found valid debug map entry
51 CHECK: Found valid debug map entry: _inc 0x0000000000000070 => 0x0000000100000f20
52 CHECK-NEXT: Keeping subprogram DIE:
53 CHECK-NEXT: DW_TAG_subprogram
54 CHECK-NEXT: DW_AT_name {{.*}}"inc"
56 CHECK-NOT: Found valid debug map entry
57 CHECK: Found valid debug map entry: _val 0xffffffffffffffff => 0x0000000100001004
58 CHECK-NEXT: Keeping variable DIE:
59 CHECK-NEXT: DW_TAG_variable
60 CHECK-NEXT: DW_AT_name {{.*}}"val"
61 CHECK-NOT: Found valid debug map entry
62 CHECK: Found valid debug map entry: _bar 0x0000000000000020 => 0x0000000100000f40
63 CHECK-NEXT: Keeping subprogram DIE:
64 CHECK-NEXT: DW_TAG_subprogram
65 CHECK-NEXT: DW_AT_name {{.*}}"bar"
66 CHECK-NOT: Found valid debug map entry
67 CHECK: Found valid debug map entry: _inc 0x0000000000000070 => 0x0000000100000f90
68 CHECK-NEXT: Keeping subprogram DIE:
69 CHECK-NEXT: DW_TAG_subprogram
70 CHECK-NEXT: DW_AT_name {{.*}}"inc")
73 ================================= LTO link ================================
74 CHECK-LTO: DEBUG MAP OBJECT: {{.*}}basic-lto.macho.x86_64.o
75 CHECK-LTO: Input compilation unit:
76 CHECK-LTO-NEXT: TAG_compile_unit
78 CHECK-LTO: AT_name {{.*}}basic1.c
79 CHECK-LTO: Input compilation unit:
80 CHECK-LTO-NEXT: TAG_compile_unit
82 CHECK-LTO: AT_name {{.*}}basic2.c
83 CHECK-LTO: Input compilation unit:
84 CHECK-LTO-NEXT: TAG_compile_unit
86 CHECK-LTO: AT_name {{.*}}basic3.c
88 CHECK-LTO-NOT: Found valid debug map entry
89 CHECK-LTO: Found valid debug map entry: _main 0x0000000000000000 => 0x0000000100000f40
90 CHECK-LTO-NEXT: Keeping subprogram DIE:
91 CHECK-LTO-NEXT: DW_TAG_subprogram
92 CHECK-LTO-NEXT: DW_AT_name {{.*}}"main"
93 CHECK-LTO-NOT: Found valid debug map entry
94 CHECK-LTO: Found valid debug map entry: _private_int 0x00000000000008e8 => 0x0000000100001008
95 CHECK-LTO-NEXT: Keeping variable DIE:
96 CHECK-LTO-NEXT: DW_TAG_variable
97 CHECK-LTO-NEXT: DW_AT_name {{.*}}"private_int"
98 CHECK-LTO-NOT: Found valid debug map entry
99 CHECK-LTO: Found valid debug map entry: _baz 0x0000000000000658 => 0x0000000100001000
100 CHECK-LTO-NEXT: Keeping variable DIE:
101 CHECK-LTO-NEXT: DW_TAG_variable
102 CHECK-LTO-NEXT: DW_AT_name {{.*}} "baz"
103 CHECK-LTO-NOT: Found valid debug map entry
104 CHECK-LTO: Found valid debug map entry: _foo 0x0000000000000010 => 0x0000000100000f50
105 CHECK-LTO-NEXT: Keeping subprogram DIE:
106 CHECK-LTO-NEXT: DW_TAG_subprogram
107 CHECK-LTO-NEXT: DW_AT_name {{.*}}"foo"
108 CHECK-LTO-NOT: Found valid debug map entry
109 CHECK-LTO: Found valid debug map entry: _val 0x00000000000008ec => 0x0000000100001004
110 CHECK-LTO-NEXT: Keeping variable DIE:
111 CHECK-LTO-NEXT: DW_TAG_variable
112 CHECK-LTO-NEXT: DW_AT_name {{.*}}"val"
113 CHECK-LTO-NOT: Found valid debug map entry
114 CHECK-LTO: Found valid debug map entry: _bar 0x0000000000000050 => 0x0000000100000f90
115 CHECK-LTO-NEXT: Keeping subprogram DIE:
116 CHECK-LTO-NEXT: DW_TAG_subprogram
117 CHECK-LTO-NEXT: DW_AT_name {{.*}}"bar"
120 ================================= Archive link ================================
121 CHECK-ARCHIVE: DEBUG MAP OBJECT: {{.*}}basic1.macho.x86_64.o
122 CHECK-ARCHIVE: Input compilation unit:
123 CHECK-ARCHIVE-NEXT: TAG_compile_unit
124 CHECK-ARCHIVE-NOT: TAG
125 CHECK-ARCHIVE: AT_name {{.*}}basic1.c
127 CHECK-ARCHIVE: DEBUG MAP OBJECT: {{.*}}libbasic.a(basic2.macho.x86_64.o)
128 CHECK-ARCHIVE: Input compilation unit:
129 CHECK-ARCHIVE-NEXT: TAG_compile_unit
130 CHECK-ARCHIVE-NOT: TAG
131 CHECK-ARCHIVE: AT_name {{.*}}basic2.c
133 CHECK-ARCHIVE: DEBUG MAP OBJECT: {{.*}}libbasic.a(basic3.macho.x86_64.o)
134 CHECK-ARCHIVE: Input compilation unit:
135 CHECK-ARCHIVE-NEXT: TAG_compile_unit
136 CHECK-ARCHIVE-NOT: TAG
137 CHECK-ARCHIVE: AT_name {{.*}}basic3.c
139 CHECK-ARCHIVE-NOT: Found valid debug map entry
140 CHECK-ARCHIVE: Found valid debug map entry: _main 0x0000000000000000 => 0x0000000100000ea0
141 CHECK-ARCHIVE-NEXT: Keeping subprogram DIE:
142 CHECK-ARCHIVE-NEXT: DW_TAG_subprogram
143 CHECK-ARCHIVE-NEXT: DW_AT_name{{.*}}"main"
145 CHECK-ARCHIVE-NOT: Found valid debug map entry
146 CHECK-ARCHIVE: Found valid debug map entry: _private_int 0x0000000000000560 => 0x0000000100001004
147 CHECK-ARCHIVE-NEXT: Keeping variable DIE:
148 CHECK-ARCHIVE-NEXT: DW_TAG_variable
149 CHECK-ARCHIVE-NEXT: DW_AT_name {{.*}}"private_int"
150 CHECK-ARCHIVE-NOT: Found valid debug map entry
151 CHECK-ARCHIVE: Found valid debug map entry: _baz 0x0000000000000310 => 0x0000000100001000
152 CHECK-ARCHIVE-NEXT: Keeping variable DIE:
153 CHECK-ARCHIVE-NEXT: DW_TAG_variable
154 CHECK-ARCHIVE-NEXT: DW_AT_name {{.*}}"baz"
155 CHECK-ARCHIVE-NOT: Found valid debug map entry
156 CHECK-ARCHIVE: Found valid debug map entry: _foo 0x0000000000000020 => 0x0000000100000ed0
157 CHECK-ARCHIVE-NEXT: Keeping subprogram DIE:
158 CHECK-ARCHIVE-NEXT: DW_TAG_subprogram
159 CHECK-ARCHIVE-NEXT: DW_AT_name {{.*}}"foo"
160 CHECK-ARCHIVE-NOT: Found valid debug map entry
161 CHECK-ARCHIVE: Found valid debug map entry: _inc 0x0000000000000070 => 0x0000000100000f20
162 CHECK-ARCHIVE-NEXT: Keeping subprogram DIE:
163 CHECK-ARCHIVE-NEXT: DW_TAG_subprogram
164 CHECK-ARCHIVE-NEXT: DW_AT_name {{.*}}"inc"
166 CHECK-ARCHIVE-NOT: Found valid debug map entry
167 CHECK-ARCHIVE: Found valid debug map entry: _val 0xffffffffffffffff => 0x0000000100001008
168 CHECK-ARCHIVE-NEXT: Keeping variable DIE:
169 CHECK-ARCHIVE-NEXT: DW_TAG_variable
170 CHECK-ARCHIVE-NEXT: DW_AT_name {{.*}}"val"
171 CHECK-ARCHIVE-NOT: Found valid debug map entry
172 CHECK-ARCHIVE: Found valid debug map entry: _bar 0x0000000000000020 => 0x0000000100000f40
173 CHECK-ARCHIVE-NEXT: Keeping subprogram DIE:
174 CHECK-ARCHIVE-NEXT: DW_TAG_subprogram
175 CHECK-ARCHIVE-NEXT: DW_AT_name {{.*}}"bar"
176 CHECK-ARCHIVE-NOT: Found valid debug map entry
177 CHECK-ARCHIVE: Found valid debug map entry: _inc 0x0000000000000070 => 0x0000000100000f90
178 CHECK-ARCHIVE-NEXT: Keeping subprogram DIE:
179 CHECK-ARCHIVE-NEXT: DW_TAG_subprogram
180 CHECK-ARCHIVE-NEXT: DW_AT_name {{.*}}"inc")
183 ================================= Simple relink ================================
184 CHECK-RELINK: DEBUG MAP OBJECT: {{.*}}basic-relink.macho.arm64.o
185 CHECK-RELINK: Input compilation unit:
186 CHECK-RELINK-NEXT: TAG_compile_unit
187 CHECK-RELINK-NOT: TAG
188 CHECK-RELINK: AT_name {{.*}}basic-relink.macho.arm64.c
190 CHECK-RELINK: DEBUG MAP OBJECT: {{.*}}foo-relink.dylib
191 CHECK-RELINK: Input compilation unit:
192 CHECK-RELINK-NEXT: TAG_compile_unit
193 CHECK-RELINK-NOT: TAG
194 CHECK-RELINK: AT_name {{.*}}foo-relink.c
196 CHECK-RELINK: Input compilation unit:
197 CHECK-RELINK-NEXT: TAG_compile_unit
198 CHECK-RELINK-NOT: TAG
199 CHECK-RELINK: AT_name {{.*}}altfoo-relink.c
201 CHECK-RELINK: DEBUG MAP OBJECT: {{.*}}bar-relink.dylib
202 CHECK-RELINK: Input compilation unit:
203 CHECK-RELINK-NEXT: TAG_compile_unit
204 CHECK-RELINK-NOT: TAG
205 CHECK-RELINK: AT_name {{.*}}bar-relink.c
207 CHECK-RELINK-NOT: Found valid debug map entry
208 CHECK-RELINK: Found valid debug map entry: _display 0x0000000000000000 => 0x0000000000003f10
209 CHECK-RELINK-NEXT: Keeping subprogram DIE:
210 CHECK-RELINK-NEXT: DW_TAG_subprogram
211 CHECK-RELINK: DW_AT_name{{.*}}"display"
213 CHECK-RELINK: Found valid debug map entry: _foo 0x0000000000003f54 => 0x0000000000003f2c
214 CHECK-RELINK-NEXT: Keeping subprogram DIE:
215 CHECK-RELINK-NEXT: DW_TAG_subprogram
216 CHECK-RELINK: DW_AT_name {{.*}}"foo"
218 CHECK-RELINK-NOT: Found valid debug map entry
219 CHECK-RELINK: Found valid debug map entry: _foo_unused 0x0000000000003f74 => 0x0000000000003f4c
220 CHECK-RELINK-NEXT: Keeping subprogram DIE:
221 CHECK-RELINK-NEXT: DW_TAG_subprogram
222 CHECK-RELINK: DW_AT_name {{.*}}"foo_unused"
224 CHECK-RELINK-NOT: Found valid debug map entry
225 CHECK-RELINK: Found valid debug map entry: _altfoo 0x0000000000003f7c => 0x0000000000003f54
226 CHECK-RELINK-NEXT: Keeping subprogram DIE:
227 CHECK-RELINK-NEXT: DW_TAG_subprogram
228 CHECK-RELINK: DW_AT_name {{.*}}"altfoo"
230 CHECK-RELINK-NOT: Found valid debug map entry
231 CHECK-RELINK: Found valid debug map entry: _baz 0x0000000000004000 => 0x0000000000008000
232 CHECK-RELINK-NEXT: Keeping variable DIE:
233 CHECK-RELINK-NEXT: DW_TAG_variable
234 CHECK-RELINK-NEXT: DW_AT_name {{.*}}"baz"
236 CHECK-RELINK-NOT: Found valid debug map entry
237 CHECK-RELINK: Found valid debug map entry: _bar 0x0000000000003fa0 => 0x0000000000003f78
238 CHECK-RELINK-NEXT: Keeping subprogram DIE:
239 CHECK-RELINK-NEXT: DW_TAG_subprogram
240 CHECK-RELINK: DW_AT_name {{.*}}"bar"
242 ================================= Two level relink ================================
243 CHECK-RELINK-TWO: DEBUG MAP OBJECT: {{.*}}proxy-relink.dylib
244 CHECK-RELINK-TWO: Input compilation unit:
245 CHECK-RELINK-TWO-NEXT: TAG_compile_unit
246 CHECK-RELINK-TWO-NOT: TAG
247 CHECK-RELINK-TWO: AT_name {{.*}}two-level-relink.macho.arm64.c
249 CHECK-RELINK-TWO: Input compilation unit:
250 CHECK-RELINK-TWO-NEXT: TAG_compile_unit
251 CHECK-RELINK-TWO-NOT: TAG
252 CHECK-RELINK-TWO: AT_name {{.*}}bar-relink.c
253 CHECK-RELINK-TWO: DW_AT_APPLE_origin {{.*}}/path/to/bar-relink.dylib
255 CHECK-RELINK-TWO: Input compilation unit:
256 CHECK-RELINK-TWO-NEXT: TAG_compile_unit
257 CHECK-RELINK-TWO-NOT: TAG
258 CHECK-RELINK-TWO: AT_name {{.*}}foo-relink.c
259 CHECK-RELINK-TWO: DW_AT_APPLE_origin {{.*}}/path/to/foo-relink.dylib
261 CHECK-RELINK-TWO: Input compilation unit:
262 CHECK-RELINK-TWO-NEXT: TAG_compile_unit
263 CHECK-RELINK-TWO-NOT: TAG
264 CHECK-RELINK-TWO: AT_name {{.*}}altfoo-relink.c
265 CHECK-RELINK-TWO: DW_AT_APPLE_origin {{.*}}/path/to/foo-relink.dylib
267 CHECK-RELINK-TWO-NOT: Found valid debug map entry
268 CHECK-RELINK-TWO: Found valid debug map entry: _display 0x0000000000003f1c => 0x0000000000003f1c
269 CHECK-RELINK-TWO-NEXT: Keeping subprogram DIE:
270 CHECK-RELINK-TWO-NEXT: DW_TAG_subprogram
271 CHECK-RELINK-TWO: DW_AT_name{{.*}}"display"
273 CHECK-RELINK-TWO-NOT: Found valid debug map entry
274 CHECK-RELINK-TWO: Found valid debug map entry: _baz 0x0000000000008000 => 0x0000000000008000
275 CHECK-RELINK-TWO-NEXT: Keeping variable DIE:
276 CHECK-RELINK-TWO-NEXT: DW_TAG_variable
277 CHECK-RELINK-TWO-NEXT: DW_AT_name {{.*}}"baz"
279 CHECK-RELINK-TWO-NOT: Found valid debug map entry
280 CHECK-RELINK-TWO: Found valid debug map entry: _bar 0x0000000000003f38 => 0x0000000000003f38
281 CHECK-RELINK-TWO-NEXT: Keeping subprogram DIE:
282 CHECK-RELINK-TWO-NEXT: DW_TAG_subprogram
283 CHECK-RELINK-TWO: DW_AT_name {{.*}}"bar"
285 CHECK-RELINK-TWO: Found valid debug map entry: _foo 0x0000000000003f40 => 0x0000000000003f40
286 CHECK-RELINK-TWO-NEXT: Keeping subprogram DIE:
287 CHECK-RELINK-TWO-NEXT: DW_TAG_subprogram
288 CHECK-RELINK-TWO: DW_AT_name {{.*}}"foo"
290 CHECK-RELINK-TWO-NOT: Found valid debug map entry
291 CHECK-RELINK-TWO: Found valid debug map entry: _altfoo 0x0000000000003f64 => 0x0000000000003f64
292 CHECK-RELINK-TWO-NEXT: Keeping subprogram DIE:
293 CHECK-RELINK-TWO-NEXT: DW_TAG_subprogram
294 CHECK-RELINK-TWO: DW_AT_name {{.*}}"altfoo"
296 ================================= Build variants relink ================================
297 CHECK-RELINK-VARIANT: DEBUG MAP OBJECT: {{.*}}basic-relink.macho.arm64.o
298 CHECK-RELINK-VARIANT: DEBUG MAP OBJECT: {{.*}}foo-relink-variant_debug.dylib
299 CHECK-RELINK-VARIANT: DEBUG MAP OBJECT: {{.*}}bar-relink-variant.dylib