dwarfdump-str-offsets-dwp.s
13.1 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
# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
# RUN: llvm-dwarfdump -v %t.o | FileCheck %s
# Test object to verify that dwarfdump handles dwp files with DWARF v5 string
# offset tables. We have 3 CUs and 2 TUs, where it is assumed that
# CU1 and TU1 came from one object file, CU2 and TU2 from a second object
# file, and CU3 from a third object file that was compiled with
# -gdwarf-4.
#
.section .debug_str.dwo,"MSe",@progbits,1
str_producer:
.asciz "Handmade DWARF producer"
str_CU1:
.asciz "Compile_Unit_1"
str_CU1_dir:
.asciz "/home/test/CU1"
str_CU2:
.asciz "Compile_Unit_2"
str_CU2_dir:
.asciz "/home/test/CU2"
str_TU1:
.asciz "Type_Unit_1"
str_TU1_type:
.asciz "MyStruct_1"
str_TU2:
.asciz "Type_Unit_2"
str_TU2_type:
.asciz "MyStruct_2"
str_CU3:
.asciz "Compile_Unit_3"
str_CU3_dir:
.asciz "/home/test/CU3"
.section .debug_str_offsets.dwo,"e",@progbits
# Object files 1's portion of the .debug_str_offsets.dwo section.
# CU1 and TU1 share a contribution to the string offsets table.
.debug_str_offsets_object_file1_start:
.long .debug_str_offsets_object_file1_end-.debug_str_offsets_base_1
.short 5 # DWARF version
.short 0 # Padding
.debug_str_offsets_base_1:
.long str_producer-.debug_str.dwo
.long str_CU1-.debug_str.dwo
.long str_CU1_dir-.debug_str.dwo
.long str_TU1-.debug_str.dwo
.long str_TU1_type-.debug_str.dwo
.debug_str_offsets_object_file1_end:
# Object files 2's portion of the .debug_str_offsets.dwo section.
# CU2 and TU2 share a contribution to the string offsets table.
.debug_str_offsets_object_file2_start:
.long .debug_str_offsets_object_file2_end-.debug_str_offsets_base_2
.short 5 # DWARF version
.short 0 # Padding
.debug_str_offsets_base_2:
.long str_producer-.debug_str.dwo
.long str_CU2-.debug_str.dwo
.long str_CU2_dir-.debug_str.dwo
.long str_TU2-.debug_str.dwo
.long str_TU2_type-.debug_str.dwo
.debug_str_offsets_object_file2_end:
# Object files 3's portion of the .debug_str_offsets.dwo section.
# This file is assumed to have been compiled with -gdwarf-4 and
# therefore contains a version 4 CU and a GNU format contribution
# to the .debug_str_offsets section.
.debug_str_offsets_object_file3_start:
.debug_str_offsets_base_3:
.long str_producer-.debug_str.dwo
.long str_CU3-.debug_str.dwo
.long str_CU3_dir-.debug_str.dwo
.debug_str_offsets_object_file3_end:
# Abbrevs are shared for all compile and type units
.section .debug_abbrev.dwo,"e",@progbits
.byte 0x01 # Abbrev code
.byte 0x11 # DW_TAG_compile_unit
.byte 0x00 # DW_CHILDREN_no
.byte 0x25 # DW_AT_producer
.byte 0x1a # DW_FORM_strx
.byte 0x03 # DW_AT_name
.byte 0x1a # DW_FORM_strx
.byte 0x03 # DW_AT_name
.byte 0x1a # DW_FORM_strx
.byte 0x00 # EOM(1)
.byte 0x00 # EOM(2)
.byte 0x02 # Abbrev code
.byte 0x41 # DW_TAG_type_unit
.byte 0x01 # DW_CHILDREN_yes
.byte 0x03 # DW_AT_name
.byte 0x1a # DW_FORM_strx
.byte 0x00 # EOM(1)
.byte 0x00 # EOM(2)
.byte 0x03 # Abbrev code
.byte 0x13 # DW_TAG_structure_type
.byte 0x00 # DW_CHILDREN_no (no members)
.byte 0x03 # DW_AT_name
.byte 0x1a # DW_FORM_strx
.byte 0x00 # EOM(1)
.byte 0x00 # EOM(2)
.byte 0x04 # Abbrev code
.byte 0x11 # DW_TAG_compile_unit
.byte 0x00 # DW_CHILDREN_no
.byte 0x25 # DW_AT_producer
.short 0x3e82 # DW_FORM_GNU_str_index
.byte 0x03 # DW_AT_name
.short 0x3e82 # DW_FORM_GNU_str_index
.byte 0x03 # DW_AT_name
.short 0x3e82 # DW_FORM_GNU_str_index
.byte 0x00 # EOM(1)
.byte 0x00 # EOM(2)
.byte 0x00 # EOM(3)
abbrev_end:
.section .debug_info.dwo,"e",@progbits
# DWARF v5 CU header.
CU1_5_start:
.long CU1_5_end-CU1_5_version # Length of Unit
CU1_5_version:
.short 5 # DWARF version number
.byte 1 # DWARF Unit Type
.byte 8 # Address Size (in bytes)
.long .debug_abbrev.dwo # Offset Into Abbrev. Section
# The compile-unit DIE, which has a DW_AT_producer, DW_AT_name
# and DW_AT_compdir.
.byte 1 # Abbreviation code
.byte 0 # The index of the producer string
.byte 1 # The index of the CU name string
.byte 2 # The index of the comp dir string
.byte 0 # NULL
CU1_5_end:
CU2_5_start:
.long CU2_5_end-CU2_5_version # Length of Unit
CU2_5_version:
.short 5 # DWARF version number
.byte 1 # DWARF Unit Type
.byte 8 # Address Size (in bytes)
.long .debug_abbrev.dwo # Offset Into Abbrev. Section
# The compile-unit DIE, which has a DW_AT_producer, DW_AT_name
# and DW_AT_compdir.
.byte 1 # Abbreviation code
.byte 0 # The index of the producer string
.byte 1 # The index of the CU name string
.byte 2 # The index of the comp dir string
.byte 0 # NULL
CU2_5_end:
CU3_4_start:
.long CU3_4_end-CU3_4_version # Length of Unit
CU3_4_version:
.short 4 # DWARF version number
.long .debug_abbrev.dwo # Offset Into Abbrev. Section
.byte 8 # Address Size (in bytes)
# The compile-unit DIE, which has a DW_AT_producer, DW_AT_name
# and DW_AT_compdir.
.byte 4 # Abbreviation code
.byte 0 # The index of the producer string
.byte 1 # The index of the CU name string
.byte 2 # The index of the comp dir string
.byte 0 # NULL
CU3_4_end:
.section .debug_types.dwo,"e",@progbits
# DWARF v5 Type unit header.
TU1_5_start:
.long TU1_5_end-TU1_5_version # Length of Unit
TU1_5_version:
.short 5 # DWARF version number
.byte 2 # DWARF Unit Type
.byte 8 # Address Size (in bytes)
.long .debug_abbrev.dwo # Offset Into Abbrev. Section
.quad 0x0011223344556677 # Type Signature
.long TU1_5_type-TU1_5_start # Type offset
# The type-unit DIE, which has a name.
.byte 2 # Abbreviation code
.byte 3 # Index of the unit type name string
# The type DIE, which has a name.
TU1_5_type:
.byte 3 # Abbreviation code
.byte 4 # Index of the type name string
.byte 0 # NULL
.byte 0 # NULL
TU1_5_end:
TU2_5_start:
.long TU2_5_end-TU2_5_version # Length of Unit
TU2_5_version:
.short 5 # DWARF version number
.byte 2 # DWARF Unit Type
.byte 8 # Address Size (in bytes)
.long .debug_abbrev.dwo # Offset Into Abbrev. Section
.quad 0x00aabbccddeeff99 # Type Signature
.long TU2_5_type-TU2_5_start # Type offset
# The type-unit DIE, which has a name.
.byte 2 # Abbreviation code
.byte 3 # Index of the unit type name string
# The type DIE, which has a name.
TU2_5_type:
.byte 3 # Abbreviation code
.byte 4 # Index of the type name string
.byte 0 # NULL
.byte 0 # NULL
TU2_5_end:
.section .debug_cu_index,"",@progbits
# The index header
.long 2 # Version
.long 3 # Columns of contribution matrix
.long 3 # number of units
.long 3 # number of hash buckets in table
# The signatures for all CUs.
.quad 0xddeeaaddbbaabbee # signature 1
.quad 0xff00ffeeffaaff00 # signature 2
.quad 0xf00df00df00df00d # signature 2
# The indexes for both CUs.
.long 1 # index 1
.long 2 # index 2
.long 3 # index 3
# The sections to which all CUs contribute.
.long 1 # DW_SECT_INFO
.long 3 # DW_SECT_ABBREV
.long 6 # DW_SECT_STR_OFFSETS
# The starting offsets of all CU's contributions to info,
# abbrev and string offsets table.
.long CU1_5_start-.debug_info.dwo
.long 0
.long .debug_str_offsets_object_file1_start-.debug_str_offsets.dwo
.long CU2_5_start-.debug_info.dwo
.long 0
.long .debug_str_offsets_object_file2_start-.debug_str_offsets.dwo
.long CU3_4_start-.debug_info.dwo
.long 0
.long .debug_str_offsets_object_file3_start-.debug_str_offsets.dwo
# The lengths of all CU's contributions to info, abbrev and
# string offsets table.
.long CU1_5_end-CU1_5_start
.long abbrev_end-.debug_abbrev.dwo
.long .debug_str_offsets_object_file1_end-.debug_str_offsets_object_file1_start
.long CU2_5_end-CU2_5_start
.long abbrev_end-.debug_abbrev.dwo
.long .debug_str_offsets_object_file2_end-.debug_str_offsets_object_file2_start
.long CU3_4_end-CU3_4_start
.long abbrev_end-.debug_abbrev.dwo
.long .debug_str_offsets_object_file3_end-.debug_str_offsets_object_file3_start
.section .debug_tu_index,"",@progbits
# The index header
.long 2 # Version
.long 3 # Columns of contribution matrix
.long 2 # number of units
.long 2 # number of hash buckets in table
# The signatures for both TUs.
.quad 0xeeaaddbbaabbeedd # signature 1
.quad 0x00ffeeffaaff00ff # signature 2
# The indexes for both TUs.
.long 1 # index 1
.long 2 # index 2
# The sections to which both TUs contribute.
.long 2 # DW_SECT_TYPES
.long 3 # DW_SECT_ABBREV
.long 6 # DW_SECT_STR_OFFSETS
# The starting offsets of both TU's contributions to info,
# abbrev and string offsets table.
.long TU1_5_start-.debug_types.dwo
.long 0
.long .debug_str_offsets_object_file1_start-.debug_str_offsets.dwo
.long TU2_5_start-.debug_types.dwo
.long 0
.long .debug_str_offsets_object_file2_start-.debug_str_offsets.dwo
# The lengths of both TU's contributions to info, abbrev and
# string offsets table.
.long TU1_5_end-TU1_5_start
.long abbrev_end-.debug_abbrev.dwo
.long .debug_str_offsets_object_file1_end-.debug_str_offsets_object_file1_start
.long TU2_5_end-TU2_5_start
.long abbrev_end-.debug_abbrev.dwo
.long .debug_str_offsets_object_file2_end-.debug_str_offsets_object_file2_start
# Verify that the correct strings from each unit are displayed and that the
# index for the .debug_str_offsets section has the right values.
# CHECK: Compile Unit
# CHECK-NOT: NULL
# CHECK: DW_TAG_compile_unit
# CHECK-NEXT: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Handmade DWARF producer")
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "Compile_Unit_1")
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000002) string = "/home/test/CU1")
# CHECK-NOT: NULL
# CHECK: Compile Unit
# CHECK-NOT: NULL
# CHECK: DW_TAG_compile_unit
# CHECK-NEXT: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Handmade DWARF producer")
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "Compile_Unit_2")
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000002) string = "/home/test/CU2")
#
# CHECK: Type Unit
# CHECK-NOT: NULL
# CHECK: DW_TAG_type_unit
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000003) string = "Type_Unit_1")
# CHECK-NOT: NULL
# CHECK: DW_TAG_structure_type
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000004) string = "MyStruct_1")
#
# CHECK: Type Unit
# CHECK-NOT: NULL
# CHECK: DW_TAG_type_unit
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000003) string = "Type_Unit_2")
# CHECK-NOT: NULL
# CHECK: DW_TAG_structure_type
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000004) string = "MyStruct_2")
# Verify the correct offets of the compile and type units contributions in the
# index tables.
# CHECK: .debug_cu_index contents:
# CHECK-NOT: contents:
# CHECK: 1 0xddeeaaddbbaabbee [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})
# CHECK-SAME: [0x00000000
# CHECK-NEXT: 2 0xff00ffeeffaaff00 [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})
# CHECK-SAME: [0x0000001c
# CHECK: .debug_tu_index contents:
# CHECK-NOT: contents:
# CHECK: 1 0xeeaaddbbaabbeedd [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})
# CHECK-SAME: [0x00000000
# CHECK-NEXT: 2 0x00ffeeffaaff00ff [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})
# CHECK: [0x0000001c