DWARF-pubsections.yaml
6.83 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
## This file contains test cases for generating .debug_pubnames/.debug_pubtypes
## section in object files from the DWARF entry of Mach-O YAML inputs
## a) Test that yaml2obj emits the .debug_pubnames and .debug_pubtypes sections and
## obj2yaml converts them back.
# RUN: yaml2obj %s | obj2yaml | FileCheck %s
--- !mach-o
FileHeader:
magic: 0xFEEDFACF
cputype: 0x01000007
cpusubtype: 0x00000003
filetype: 0x0000000A
ncmds: 1
sizeofcmds: 1800
flags: 0x00000000
reserved: 0x00000000
LoadCommands:
- cmd: LC_SEGMENT_64
cmdsize: 232
segname: __DWARF
vmaddr: 0
vmsize: 0
fileoff: 152
filesize: 0xffff
maxprot: 0
initprot: 0
nsects: 2
flags: 0
Sections:
- sectname: __debug_pubnames
segname: __DWARF
addr: 0x0000000000000000
size: 27
offset: 0x00000152
align: 0
reloff: 0x00000000
nreloc: 0
flags: 0x00000000
reserved1: 0x00000000
reserved2: 0x00000000
reserved3: 0x00000000
- sectname: __debug_pubtypes
segname: __DWARF
addr: 0x0000000000000000
size: 35
offset: 0x00000720
align: 0
reloff: 0x00000000
nreloc: 0
flags: 0x00000000
reserved1: 0x00000000
reserved2: 0x00000000
reserved3: 0x00000000
DWARF:
debug_pubnames:
Length: 23
Version: 2
UnitOffset: 0
UnitSize: 121
Entries:
- DieOffset: 0x0000002A
Name: main
debug_pubtypes:
Length: 31
Version: 2
UnitOffset: 0
UnitSize: 121
Entries:
- DieOffset: 0x00000060
Name: int
- DieOffset: 0x00000071
Name: char
# CHECK: DWARF:
# CHECK: debug_pubnames:
# CHECK-NEXT: Length: 0x0000000000000017
# CHECK-NEXT: Version: 2
# CHECK-NEXT: UnitOffset: 0
# CHECK-NEXT: UnitSize: 121
# CHECK-NEXT: Entries:
# CHECK-NEXT: - DieOffset: 0x0000002A
# CHECK-NEXT: Name: main
# CHECK-NEXT: debug_pubtypes:
# CHECK-NEXT: Length: 0x000000000000001F
# CHECK-NEXT: Version: 2
# CHECK-NEXT: UnitOffset: 0
# CHECK-NEXT: UnitSize: 121
# CHECK-NEXT: Entries:
# CHECK-NEXT: - DieOffset: 0x00000060
# CHECK-NEXT: Name: int
# CHECK-NEXT: - DieOffset: 0x00000071
# CHECK-NEXT: Name: char
# CHECK-NEXT: ...
## b) Test that yaml2obj will not emit the .debug_pubnames/.debug_pubtypes section's
## contents, if the "debug_pubnames"/"debug_pubtypes" entry doesn't exist in the
## "DWARF" entry.
# RUN: yaml2obj --docnum=2 %s -o %t2
# RUN: obj2yaml %t2 | FileCheck %s --check-prefix=EMPTY
# EMPTY: Sections:
# EMPTY-NEXT: - sectname: __debug_pubnames
# EMPTY-NEXT: segname: __DWARF
# EMPTY-NEXT: addr: 0x0000000000000000
# EMPTY-NEXT: size: 0
# EMPTY-NEXT: offset: 0x00000000
# EMPTY-NEXT: align: 0
# EMPTY-NEXT: reloff: 0x00000000
# EMPTY-NEXT: nreloc: 0
# EMPTY-NEXT: flags: 0x00000000
# EMPTY-NEXT: reserved1: 0x00000000
# EMPTY-NEXT: reserved2: 0x00000000
# EMPTY-NEXT: reserved3: 0x00000000
# EMPTY-NEXT: - sectname: __debug_pubtypes
# EMPTY-NEXT: segname: __DWARF
# EMPTY-NEXT: addr: 0x0000000000000000
# EMPTY-NEXT: size: 0
# EMPTY-NEXT: offset: 0x00000720
# EMPTY-NEXT: align: 0
# EMPTY-NEXT: reloff: 0x00000000
# EMPTY-NEXT: nreloc: 0
# EMPTY-NEXT: flags: 0x00000000
# EMPTY-NEXT: reserved1: 0x00000000
# EMPTY-NEXT: reserved2: 0x00000000
# EMPTY-NEXT: reserved3: 0x00000000
# EMPTY-NEXT: ...
--- !mach-o
FileHeader:
magic: 0xFEEDFACF
cputype: 0x01000007
cpusubtype: 0x00000003
filetype: 0x0000000A
ncmds: 1
sizeofcmds: 1772
flags: 0x00000000
reserved: 0x00000000
LoadCommands:
- cmd: LC_SEGMENT_64
cmdsize: 232
segname: __DWARF
vmaddr: 0x00000000
vmsize: 0x00000000
fileoff: 0
filesize: 0
maxprot: 0
initprot: 0
nsects: 2
flags: 0
Sections:
- sectname: __debug_pubnames
segname: __DWARF
addr: 0x0000000000000000
size: 0
offset: 0x00000000
align: 0
reloff: 0x00000000
nreloc: 0
flags: 0x00000000
reserved1: 0x00000000
reserved2: 0x00000000
reserved3: 0x00000000
- sectname: __debug_pubtypes
segname: __DWARF
addr: 0x0000000000000000
size: 0
offset: 0x00000720
align: 0
reloff: 0x00000000
nreloc: 0
flags: 0x00000000
reserved1: 0x00000000
reserved2: 0x00000000
reserved3: 0x00000000
DWARF:
## c) Test that obj2yaml is able to dump a __debug_pubnames section whose length field is greater than the section size.
# RUN: yaml2obj --docnum=3 %s | obj2yaml | FileCheck %s --check-prefix=INVALID-LENGTH
# INVALID-LENGTH: DWARF:
# INVALID-LENGTH-NEXT: debug_pubnames:
# INVALID-LENGTH-NEXT: Length: 0x00000000DEADBEEF
# INVALID-LENGTH-NEXT: Version: 2
# INVALID-LENGTH-NEXT: UnitOffset: 0
# INVALID-LENGTH-NEXT: UnitSize: 121
# INVALID-LENGTH-NEXT: Entries:
# INVALID-LENGTH-NEXT: - DieOffset: 0x0000002A
# INVALID-LENGTH-NEXT: Name: main
--- !mach-o
FileHeader:
magic: 0xFEEDFACF
cputype: 0x01000007
cpusubtype: 0x00000003
filetype: 0x0000000A
ncmds: 1
sizeofcmds: 1888
flags: 0x00000000
reserved: 0x00000000
LoadCommands:
- cmd: LC_SEGMENT_64
cmdsize: 152
segname: __DWARF
vmaddr: 0x00000000
vmsize: 0x00000000
fileoff: 0
filesize: 0xffff
maxprot: 0
initprot: 0
nsects: 1
flags: 0
Sections:
- sectname: __debug_pubnames
segname: __DWARF
addr: 0x0000000000000000
size: 24
offset: 0x000000b8
align: 0
reloff: 0x00000000
nreloc: 0
flags: 0x00000000
reserved1: 0x00000000
reserved2: 0x00000000
reserved3: 0x00000000
DWARF:
debug_pubnames:
Length: 0xdeadbeef
Version: 2
UnitOffset: 0
UnitSize: 121
Entries:
- DieOffset: 0x0000002A
Name: main