dsym-companion.test
9.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
RUN: dsymutil -o - %p/../Inputs/basic.macho.i386 -f | llvm-readobj --file-headers -l -S --symbols - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK32
RUN: dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 -f | llvm-readobj --file-headers -l -S --symbols - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK64
This test checks that the dSYM companion binaries generated in 32 and 64 bits
are correct. The check are pretty strict (we check even the offsets and sizes
of the sections) in order to test the VM address layout algorithm. As the
debug sections are generated, this is a bit risky, but I don't expect
dsymutil's output to change much for these tiny C programs so this should
be OK.
The 32bits version doesn't have object files, thus it has basically no debug
sections.
CHECK32: Format: Mach-O 32-bit i386
CHECK32: Arch: i386
CHECK32: AddressSize: 32bit
CHECK64: Format: Mach-O 64-bit x86-64
CHECK64: Arch: x86_64
CHECK64: AddressSize: 64bit
CHECK: MachHeader {
CHECK32: Magic: Magic (0xFEEDFACE)
CHECK32: CpuType: X86 (0x7)
CHECK32: CpuSubType: CPU_SUBTYPE_I386_ALL (0x3)
CHECK64: Magic: Magic64 (0xFEEDFACF)
CHECK64: CpuType: X86-64 (0x1000007)
CHECK64: CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3)
CHECK: FileType: DWARFSymbol (0xA)
CHECK: NumOfLoadCommands: 7
CHECK: Flags [ (0x0)
CHECK: }
CHECK: Sections [
CHECK: Section {
CHECK: Name: __text
CHECK: Segment: __TEXT
CHECK32: Address: 0x1E90
CHECK32: Size: 0x11A
CHECK64: Address: 0x100000EA0
CHECK64: Size: 0x109
CHECK: Offset: 0
CHECK: Alignment: 4
CHECK: RelocationOffset: 0x0
CHECK: RelocationCount: 0
CHECK: Type: Regular (0x0)
CHECK: Attributes [ (0x800004)
CHECK: PureInstructions (0x800000)
CHECK: SomeInstructions (0x4)
CHECK: ]
CHECK: Reserved1: 0x0
CHECK: Reserved2: 0x0
CHECK: }
CHECK: Section {
CHECK: Name: __unwind_info
CHECK: Segment: __TEXT
CHECK32: Address: 0x1FAC
CHECK64: Address: 0x100000FAC
CHECK: Size: 0x48
CHECK: Offset: 0
CHECK: Alignment: 2
CHECK: RelocationOffset: 0x0
CHECK: RelocationCount: 0
CHECK: Type: Regular (0x0)
CHECK: Attributes [ (0x0)
CHECK: ]
CHECK: Reserved1: 0x0
CHECK: Reserved2: 0x0
CHECK: }
CHECK32: Section {
CHECK32: Name: __nl_symbol_ptr
CHECK32: Segment: __DATA
CHECK32: Address: 0x2000
CHECK32: Size: 0x4
CHECK32: Offset: 0
CHECK32: Alignment: 2
CHECK32: RelocationOffset: 0x0
CHECK32: RelocationCount: 0
CHECK32: Type: NonLazySymbolPointers (0x6)
CHECK32: Attributes [ (0x0)
CHECK32: ]
CHECK32: Reserved1: 0x0
CHECK32: Reserved2: 0x0
CHECK32: }
CHECK: Section {
CHECK: Name: __data
CHECK: Segment: __DATA
CHECK32: Address: 0x2004
CHECK64: Address: 0x100001000
CHECK: Size: 0x4
CHECK: Offset: 0
CHECK: Alignment: 2
CHECK: RelocationOffset: 0x0
CHECK: RelocationCount: 0
CHECK: Type: Regular (0x0)
CHECK: Attributes [ (0x0)
CHECK: ]
CHECK: Reserved1: 0x0
CHECK: Reserved2: 0x0
CHECK: }
CHECK: Section {
CHECK: Name: __common
CHECK: Segment: __DATA
CHECK32: Address: 0x2008
CHECK64: Address: 0x100001004
CHECK: Size: 0x4
CHECK: Offset: 0
CHECK: Alignment: 2
CHECK: RelocationOffset: 0x0
CHECK: RelocationCount: 0
CHECK: Type: ZeroFill (0x1)
CHECK: Attributes [ (0x0)
CHECK: ]
CHECK: Reserved1: 0x0
CHECK: Reserved2: 0x0
CHECK: }
CHECK: Section {
CHECK: Name: __bss
CHECK: Segment: __DATA
CHECK32: Address: 0x200C
CHECK64: Address: 0x100001008
CHECK: Size: 0x4
CHECK: Offset: 0
CHECK: Alignment: 2
CHECK: RelocationOffset: 0x0
CHECK: RelocationCount: 0
CHECK: Type: ZeroFill (0x1)
CHECK: Attributes [ (0x0)
CHECK: ]
CHECK: Reserved1: 0x0
CHECK: Reserved2: 0x0
CHECK: }
CHECK64: Section {
CHECK64: Name: __debug_line
CHECK64: Segment: __DWARF
CHECK64: Address: 0x100003000
CHECK64: Size: 0xEA
CHECK64: Offset: 8192
CHECK64: Alignment: 0
CHECK64: RelocationOffset: 0x0
CHECK64: RelocationCount: 0
CHECK64: Type: Regular (0x0)
CHECK64: Attributes [ (0x0)
CHECK64: ]
CHECK64: Reserved1: 0x0
CHECK64: Reserved2: 0x0
CHECK64: }
CHECK64: Section {
CHECK64: Name: __debug_pubnames
CHECK64: Segment: __DWARF
CHECK64: Address: 0x1000030EA
CHECK64: Size: 0x7F
CHECK64: Offset: 8426
CHECK64: Alignment: 0
CHECK64: RelocationOffset: 0x0
CHECK64: RelocationCount: 0
CHECK64: Type: Regular (0x0)
CHECK64: Attributes [ (0x0)
CHECK64: ]
CHECK64: Reserved1: 0x0
CHECK64: Reserved2: 0x0
CHECK64: }
CHECK64: Section {
CHECK64: Name: __debug_pubtypes
CHECK64: Segment: __DWARF
CHECK64: Address: 0x100003169
CHECK64: Size: 0x57
CHECK64: Offset: 8553
CHECK64: Alignment: 0
CHECK64: RelocationOffset: 0x0
CHECK64: RelocationCount: 0
CHECK64: Type: Regular (0x0)
CHECK64: Attributes [ (0x0)
CHECK64: ]
CHECK64: Reserved1: 0x0
CHECK64: Reserved2: 0x0
CHECK64: }
CHECK64: Section {
CHECK64: Name: __debug_aranges
CHECK64: Segment: __DWARF
CHECK64: Address: 0x1000031C0
CHECK64: Size: 0xB0
CHECK64: Offset: 8640
CHECK64: Alignment: 0
CHECK64: RelocationOffset: 0x0
CHECK64: RelocationCount: 0
CHECK64: Type: Regular (0x0)
CHECK64: Attributes [ (0x0)
CHECK64: ]
CHECK64: Reserved1: 0x0
CHECK64: Reserved2: 0x0
CHECK64: }
CHECK64: Section {
CHECK64: Name: __debug_info
CHECK64: Segment: __DWARF
CHECK64: Address: 0x100003270
CHECK64: Size: 0x1BC
CHECK64: Offset: 8816
CHECK64: Alignment: 0
CHECK64: RelocationOffset: 0x0
CHECK64: RelocationCount: 0
CHECK64: Type: Regular (0x0)
CHECK64: Attributes [ (0x0)
CHECK64: ]
CHECK64: Reserved1: 0x0
CHECK64: Reserved2: 0x0
CHECK64: }
CHECK: Section {
CHECK: Name: __debug_abbrev
CHECK: Segment: __DWARF
CHECK32: Address: 0x4000
CHECK32: Size: 0x1
CHECK32: Offset: 8192
CHECK64: Address: 0x10000342C
CHECK64: Size: 0x8F
CHECK64: Offset: 9260
CHECK: Alignment: 0
CHECK: RelocationOffset: 0x0
CHECK: RelocationCount: 0
CHECK: Type: Regular (0x0)
CHECK: Attributes [ (0x0)
CHECK: ]
CHECK: Reserved1: 0x0
CHECK: Reserved2: 0x0
CHECK: }
CHECK: Section {
CHECK: Name: __debug_str
CHECK: Segment: __DWARF
CHECK32: Address: 0x4001
CHECK32: Size: 0x1
CHECK32: Offset: 8193
CHECK64: Address: 0x1000034BB
CHECK64: Size: 0x9F
CHECK64: Offset: 9403
CHECK: Alignment: 0
CHECK: RelocationOffset: 0x0
CHECK: RelocationCount: 0
CHECK: Type: Regular (0x0)
CHECK: Attributes [ (0x0)
CHECK: ]
CHECK: Reserved1: 0x0
CHECK: Reserved2: 0x0
CHECK: }
CHECK: ]
CHECK: Symbols [
CHECK: Symbol {
CHECK: Name: _inc (2)
CHECK: Type: Section (0xE)
CHECK: Section: __text
CHECK: RefType: UndefinedNonLazy (0x0)
CHECK: Flags [ (0x0)
CHECK: ]
CHECK32: Value: 0x1F20
CHECK64: Value: 0x100000F20
CHECK: }
CHECK: Symbol {
CHECK: Name: _inc (2)
CHECK: Type: Section (0xE)
CHECK: Section: __text
CHECK: RefType: UndefinedNonLazy (0x0)
CHECK: Flags [ (0x0)
CHECK: ]
CHECK32: Value: 0x1F90
CHECK64: Value: 0x100000F90
CHECK: }
CHECK: Symbol {
CHECK: Name: _baz (7)
CHECK: Type: Section (0xE)
CHECK: Section: __data
CHECK: RefType: UndefinedNonLazy (0x0)
CHECK: Flags [ (0x0)
CHECK: ]
CHECK32: Value: 0x2004
CHECK64: Value: 0x100001000
CHECK: }
CHECK: Symbol {
CHECK: Name: _private_int (12)
CHECK: Type: Section (0xE)
CHECK: Section: __bss
CHECK: RefType: UndefinedNonLazy (0x0)
CHECK: Flags [ (0x0)
CHECK: ]
CHECK32: Value: 0x200C
CHECK64: Value: 0x100001008
CHECK: }
CHECK: Symbol {
CHECK: Name: __mh_execute_header (25)
CHECK: Extern
CHECK: Type: Section (0xE)
CHECK: Section: __text
CHECK: RefType: UndefinedNonLazy (0x0)
CHECK: Flags [ (0x10)
CHECK: ReferencedDynamically (0x10)
CHECK: ]
CHECK32: Value: 0x1000
CHECK64: Value: 0x100000000
CHECK: }
CHECK: Symbol {
CHECK: Name: _bar (45)
CHECK: Extern
CHECK: Type: Section (0xE)
CHECK: Section: __text
CHECK: RefType: UndefinedNonLazy (0x0)
CHECK: Flags [ (0x0)
CHECK: ]
CHECK32: Value: 0x1F40
CHECK64: Value: 0x100000F40
CHECK: }
CHECK: Symbol {
CHECK: Name: _foo (50)
CHECK: Extern
CHECK: Type: Section (0xE)
CHECK: Section: __text
CHECK: RefType: UndefinedNonLazy (0x0)
CHECK: Flags [ (0x0)
CHECK: ]
CHECK32: Value: 0x1EC0
CHECK64: Value: 0x100000ED0
CHECK: }
CHECK: Symbol {
CHECK: Name: _main (55)
CHECK: Extern
CHECK: Type: Section (0xE)
CHECK: Section: __text
CHECK: RefType: UndefinedNonLazy (0x0)
CHECK: Flags [ (0x0)
CHECK: ]
CHECK32: Value: 0x1E90
CHECK64: Value: 0x100000EA0
CHECK: }
CHECK: Symbol {
CHECK: Name: _val (61)
CHECK: Extern
CHECK: Type: Section (0xE)
CHECK: Section: __common
CHECK: RefType: UndefinedNonLazy (0x0)
CHECK: Flags [ (0x0)
CHECK: ]
CHECK32: Value: 0x2008
CHECK64: Value: 0x100001004
CHECK: }
CHECK: ]