@@ -379,42 +379,20 @@ unsigned DWARFVerifier::verifyDieRanges(const DWARFDie &Die,
379
379
// Build RI for this DIE and check that ranges within this DIE do not
380
380
// overlap.
381
381
DieRangeInfo RI (Die);
382
+ for (auto Range : Ranges) {
383
+ if (!Range.valid ()) {
384
+ ++NumErrors;
385
+ error () << " Invalid address range " << Range << " \n " ;
386
+ continue ;
387
+ }
382
388
383
- // TODO support object files better
384
- //
385
- // Some object file formats (i.e. non-MachO) support COMDAT. ELF in
386
- // particular does so by placing each function into a section. The DWARF data
387
- // for the function at that point uses a section relative DW_FORM_addrp for
388
- // the DW_AT_low_pc and a DW_FORM_data4 for the offset as the DW_AT_high_pc.
389
- // In such a case, when the Die is the CU, the ranges will overlap, and we
390
- // will flag valid conflicting ranges as invalid.
391
- //
392
- // For such targets, we should read the ranges from the CU and partition them
393
- // by the section id. The ranges within a particular section should be
394
- // disjoint, although the ranges across sections may overlap. We would map
395
- // the child die to the entity that it references and the section with which
396
- // it is associated. The child would then be checked against the range
397
- // information for the associated section.
398
- //
399
- // For now, simply elide the range verification for the CU DIEs if we are
400
- // processing an object file.
401
-
402
- if (!IsObjectFile || IsMachOObject || Die.getTag () == DW_TAG_subprogram) {
403
- for (auto Range : Ranges) {
404
- if (!Range.valid ()) {
405
- ++NumErrors;
406
- error () << " Invalid address range " << Range << " \n " ;
407
- continue ;
408
- }
409
-
410
- // Verify that ranges don't intersect.
411
- const auto IntersectingRange = RI.insert (Range);
412
- if (IntersectingRange != RI.Ranges .end ()) {
413
- ++NumErrors;
414
- error () << " DIE has overlapping address ranges: " << Range << " and "
415
- << *IntersectingRange << " \n " ;
416
- break ;
417
- }
389
+ // Verify that ranges don't intersect.
390
+ const auto IntersectingRange = RI.insert (Range);
391
+ if (IntersectingRange != RI.Ranges .end ()) {
392
+ ++NumErrors;
393
+ error () << " DIE has overlapping address ranges: " << Range << " and "
394
+ << *IntersectingRange << " \n " ;
395
+ break ;
418
396
}
419
397
}
420
398
@@ -743,15 +721,6 @@ void DWARFVerifier::verifyDebugLineRows() {
743
721
}
744
722
}
745
723
746
- DWARFVerifier::DWARFVerifier (raw_ostream &S, DWARFContext &D,
747
- DIDumpOptions DumpOpts)
748
- : OS(S), DCtx(D), DumpOpts(std::move(DumpOpts)) {
749
- if (const auto *F = DCtx.getDWARFObj ().getFile ()) {
750
- IsObjectFile = F->isRelocatableObject ();
751
- IsMachOObject = F->isMachO ();
752
- }
753
- }
754
-
755
724
bool DWARFVerifier::handleDebugLine () {
756
725
NumDebugLineErrors = 0 ;
757
726
OS << " Verifying .debug_line...\n " ;
0 commit comments