@@ -200,60 +200,60 @@ static void dumpStringOffsetsSection(raw_ostream &OS, StringRef SectionName,
200
200
}
201
201
202
202
void DWARFContext::dump (raw_ostream &OS, DIDumpOptions DumpOpts) {
203
- DIDumpType DumpType = DumpOpts.DumpType ;
203
+ uint64_t DumpType = DumpOpts.DumpType ;
204
204
bool DumpEH = DumpOpts.DumpEH ;
205
205
bool SummarizeTypes = DumpOpts.SummarizeTypes ;
206
206
207
- if (DumpType == DIDT_All || DumpType == DIDT_Abbrev ) {
207
+ if (DumpType & DIDT_DebugAbbrev ) {
208
208
OS << " .debug_abbrev contents:\n " ;
209
209
getDebugAbbrev ()->dump (OS);
210
210
}
211
211
212
- if (DumpType == DIDT_All || DumpType == DIDT_AbbrevDwo )
212
+ if (DumpType & DIDT_DebugAbbrevDwo )
213
213
if (const DWARFDebugAbbrev *D = getDebugAbbrevDWO ()) {
214
214
OS << " \n .debug_abbrev.dwo contents:\n " ;
215
215
D->dump (OS);
216
216
}
217
217
218
- if (DumpType == DIDT_All || DumpType == DIDT_Info ) {
218
+ if (DumpType & DIDT_DebugInfo ) {
219
219
OS << " \n .debug_info contents:\n " ;
220
220
for (const auto &CU : compile_units ())
221
221
CU->dump (OS, DumpOpts);
222
222
}
223
223
224
- if ((DumpType == DIDT_All || DumpType == DIDT_InfoDwo ) &&
224
+ if ((DumpType & DIDT_DebugInfoDwo ) &&
225
225
getNumDWOCompileUnits ()) {
226
226
OS << " \n .debug_info.dwo contents:\n " ;
227
227
for (const auto &DWOCU : dwo_compile_units ())
228
228
DWOCU->dump (OS, DumpOpts);
229
229
}
230
230
231
- if ((DumpType == DIDT_All || DumpType == DIDT_Types ) && getNumTypeUnits ()) {
231
+ if ((DumpType & DIDT_DebugTypes ) && getNumTypeUnits ()) {
232
232
OS << " \n .debug_types contents:\n " ;
233
233
for (const auto &TUS : type_unit_sections ())
234
234
for (const auto &TU : TUS)
235
235
TU->dump (OS, SummarizeTypes);
236
236
}
237
237
238
- if ((DumpType == DIDT_All || DumpType == DIDT_TypesDwo ) &&
238
+ if ((DumpType & DIDT_DebugTypesDwo ) &&
239
239
getNumDWOTypeUnits ()) {
240
240
OS << " \n .debug_types.dwo contents:\n " ;
241
241
for (const auto &DWOTUS : dwo_type_unit_sections ())
242
242
for (const auto &DWOTU : DWOTUS)
243
243
DWOTU->dump (OS, SummarizeTypes);
244
244
}
245
245
246
- if (DumpType == DIDT_All || DumpType == DIDT_Loc ) {
246
+ if (DumpType & DIDT_DebugLoc ) {
247
247
OS << " \n .debug_loc contents:\n " ;
248
248
getDebugLoc ()->dump (OS, getRegisterInfo ());
249
249
}
250
250
251
- if (DumpType == DIDT_All || DumpType == DIDT_LocDwo ) {
251
+ if (DumpType & DIDT_DebugLocDwo ) {
252
252
OS << " \n .debug_loc.dwo contents:\n " ;
253
253
getDebugLocDWO ()->dump (OS, getRegisterInfo ());
254
254
}
255
255
256
- if (DumpType == DIDT_All || DumpType == DIDT_Frames ) {
256
+ if (DumpType & DIDT_DebugFrames ) {
257
257
OS << " \n .debug_frame contents:\n " ;
258
258
getDebugFrame ()->dump (OS);
259
259
if (DumpEH) {
@@ -262,13 +262,13 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
262
262
}
263
263
}
264
264
265
- if (DumpType == DIDT_All || DumpType == DIDT_Macro ) {
265
+ if (DumpType & DIDT_DebugMacro ) {
266
266
OS << " \n .debug_macinfo contents:\n " ;
267
267
getDebugMacro ()->dump (OS);
268
268
}
269
269
270
270
uint32_t offset = 0 ;
271
- if (DumpType == DIDT_All || DumpType == DIDT_Aranges ) {
271
+ if (DumpType & DIDT_DebugAranges ) {
272
272
OS << " \n .debug_aranges contents:\n " ;
273
273
DataExtractor arangesData (DObj->getARangeSection (), isLittleEndian (), 0 );
274
274
DWARFDebugArangeSet set;
@@ -277,7 +277,7 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
277
277
}
278
278
279
279
uint8_t savedAddressByteSize = 0 ;
280
- if (DumpType == DIDT_All || DumpType == DIDT_Line ) {
280
+ if (DumpType & DIDT_DebugLine ) {
281
281
OS << " \n .debug_line contents:\n " ;
282
282
for (const auto &CU : compile_units ()) {
283
283
savedAddressByteSize = CU->getAddressByteSize ();
@@ -295,17 +295,17 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
295
295
}
296
296
}
297
297
298
- if (DumpType == DIDT_All || DumpType == DIDT_CUIndex ) {
298
+ if (DumpType & DIDT_DebugCUIndex ) {
299
299
OS << " \n .debug_cu_index contents:\n " ;
300
300
getCUIndex ().dump (OS);
301
301
}
302
302
303
- if (DumpType == DIDT_All || DumpType == DIDT_TUIndex ) {
303
+ if (DumpType & DIDT_DebugTUIndex ) {
304
304
OS << " \n .debug_tu_index contents:\n " ;
305
305
getTUIndex ().dump (OS);
306
306
}
307
307
308
- if (DumpType == DIDT_All || DumpType == DIDT_LineDwo ) {
308
+ if (DumpType & DIDT_DebugLineDwo ) {
309
309
OS << " \n .debug_line.dwo contents:\n " ;
310
310
unsigned stmtOffset = 0 ;
311
311
DWARFDataExtractor lineData (*DObj, DObj->getLineDWOSection (),
@@ -317,7 +317,7 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
317
317
}
318
318
}
319
319
320
- if (DumpType == DIDT_All || DumpType == DIDT_Str ) {
320
+ if (DumpType & DIDT_DebugStr ) {
321
321
OS << " \n .debug_str contents:\n " ;
322
322
DataExtractor strData (DObj->getStringSection (), isLittleEndian (), 0 );
323
323
offset = 0 ;
@@ -328,7 +328,7 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
328
328
}
329
329
}
330
330
331
- if ((DumpType == DIDT_All || DumpType == DIDT_StrDwo ) &&
331
+ if ((DumpType & DIDT_DebugStrDwo ) &&
332
332
!DObj->getStringDWOSection ().empty ()) {
333
333
OS << " \n .debug_str.dwo contents:\n " ;
334
334
DataExtractor strDWOData (DObj->getStringDWOSection (), isLittleEndian (), 0 );
@@ -340,7 +340,7 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
340
340
}
341
341
}
342
342
343
- if (DumpType == DIDT_All || DumpType == DIDT_Ranges ) {
343
+ if (DumpType & DIDT_DebugRanges ) {
344
344
OS << " \n .debug_ranges contents:\n " ;
345
345
// In fact, different compile units may have different address byte
346
346
// sizes, but for simplicity we just use the address byte size of the last
@@ -354,55 +354,55 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
354
354
rangeList.dump (OS);
355
355
}
356
356
357
- if (DumpType == DIDT_All || DumpType == DIDT_Pubnames )
357
+ if (DumpType & DIDT_DebugPubnames )
358
358
DWARFDebugPubTable (DObj->getPubNamesSection (), isLittleEndian (), false )
359
359
.dump (" debug_pubnames" , OS);
360
360
361
- if (DumpType == DIDT_All || DumpType == DIDT_Pubtypes )
361
+ if (DumpType & DIDT_DebugPubtypes )
362
362
DWARFDebugPubTable (DObj->getPubTypesSection (), isLittleEndian (), false )
363
363
.dump (" debug_pubtypes" , OS);
364
364
365
- if (DumpType == DIDT_All || DumpType == DIDT_GnuPubnames )
365
+ if (DumpType & DIDT_DebugGnuPubnames )
366
366
DWARFDebugPubTable (DObj->getGnuPubNamesSection (), isLittleEndian (),
367
367
true /* GnuStyle */ )
368
368
.dump (" debug_gnu_pubnames" , OS);
369
369
370
- if (DumpType == DIDT_All || DumpType == DIDT_GnuPubtypes )
370
+ if (DumpType & DIDT_DebugGnuPubtypes )
371
371
DWARFDebugPubTable (DObj->getGnuPubTypesSection (), isLittleEndian (),
372
372
true /* GnuStyle */ )
373
373
.dump (" debug_gnu_pubtypes" , OS);
374
374
375
- if (DumpType == DIDT_All || DumpType == DIDT_StrOffsets )
375
+ if (DumpType & DIDT_DebugStrOffsets )
376
376
dumpStringOffsetsSection (
377
377
OS, " debug_str_offsets" , *DObj, DObj->getStringOffsetSection (),
378
378
DObj->getStringSection (), isLittleEndian (), getMaxVersion ());
379
379
380
- if (DumpType == DIDT_All || DumpType == DIDT_StrOffsetsDwo ) {
380
+ if (DumpType & DIDT_DebugStrOffsetsDwo ) {
381
381
dumpStringOffsetsSection (
382
382
OS, " debug_str_offsets.dwo" , *DObj, DObj->getStringOffsetDWOSection (),
383
383
DObj->getStringDWOSection (), isLittleEndian (), getMaxVersion ());
384
384
}
385
385
386
- if ((DumpType == DIDT_All || DumpType == DIDT_GdbIndex) &&
386
+ if ((DumpType & DIDT_GdbIndex) &&
387
387
!DObj->getGdbIndexSection ().empty ()) {
388
388
OS << " \n .gnu_index contents:\n " ;
389
389
getGdbIndex ().dump (OS);
390
390
}
391
391
392
- if (DumpType == DIDT_All || DumpType == DIDT_AppleNames)
392
+ if (DumpType & DIDT_AppleNames)
393
393
dumpAccelSection (OS, " apple_names" , *DObj, DObj->getAppleNamesSection (),
394
394
DObj->getStringSection (), isLittleEndian ());
395
395
396
- if (DumpType == DIDT_All || DumpType == DIDT_AppleTypes)
396
+ if (DumpType & DIDT_AppleTypes)
397
397
dumpAccelSection (OS, " apple_types" , *DObj, DObj->getAppleTypesSection (),
398
398
DObj->getStringSection (), isLittleEndian ());
399
399
400
- if (DumpType == DIDT_All || DumpType == DIDT_AppleNamespaces)
400
+ if (DumpType & DIDT_AppleNamespaces)
401
401
dumpAccelSection (OS, " apple_namespaces" , *DObj,
402
402
DObj->getAppleNamespacesSection (),
403
403
DObj->getStringSection (), isLittleEndian ());
404
404
405
- if (DumpType == DIDT_All || DumpType == DIDT_AppleObjC)
405
+ if (DumpType & DIDT_AppleObjC)
406
406
dumpAccelSection (OS, " apple_objc" , *DObj, DObj->getAppleObjCSection (),
407
407
DObj->getStringSection (), isLittleEndian ());
408
408
}
@@ -434,14 +434,14 @@ DWARFDie DWARFContext::getDIEForOffset(uint32_t Offset) {
434
434
return DWARFDie ();
435
435
}
436
436
437
- bool DWARFContext::verify (raw_ostream &OS, DIDumpType DumpType) {
437
+ bool DWARFContext::verify (raw_ostream &OS, uint64_t DumpType) {
438
438
bool Success = true ;
439
439
DWARFVerifier verifier (OS, *this );
440
440
441
441
Success &= verifier.handleDebugAbbrev ();
442
- if (DumpType == DIDT_All || DumpType == DIDT_Info )
442
+ if (DumpType & DIDT_DebugInfo )
443
443
Success &= verifier.handleDebugInfo ();
444
- if (DumpType == DIDT_All || DumpType == DIDT_Line )
444
+ if (DumpType & DIDT_DebugLine )
445
445
Success &= verifier.handleDebugLine ();
446
446
Success &= verifier.handleAccelTables ();
447
447
return Success;
0 commit comments