Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit c8d253a

Browse files
committed
Revert "DebugInfo: reduce DIE range verification on object files"
This reverts commit 2b4cee4.
1 parent fc43d7e commit c8d253a

File tree

3 files changed

+15
-106
lines changed

3 files changed

+15
-106
lines changed

include/llvm/DebugInfo/DWARF/DWARFVerifier.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ class DWARFVerifier {
9797
/// lies between to valid DIEs.
9898
std::map<uint64_t, std::set<uint32_t>> ReferenceToDIEOffsets;
9999
uint32_t NumDebugLineErrors = 0;
100-
// Used to relax some checks that do not currently work portably
101-
bool IsObjectFile;
102-
bool IsMachOObject;
103100

104101
raw_ostream &error() const;
105102
raw_ostream &warn() const;
@@ -289,8 +286,8 @@ class DWARFVerifier {
289286

290287
public:
291288
DWARFVerifier(raw_ostream &S, DWARFContext &D,
292-
DIDumpOptions DumpOpts = DIDumpOptions::getForSingleDIE());
293-
289+
DIDumpOptions DumpOpts = DIDumpOptions::getForSingleDIE())
290+
: OS(S), DCtx(D), DumpOpts(std::move(DumpOpts)) {}
294291
/// Verify the information in any of the following sections, if available:
295292
/// .debug_abbrev, debug_abbrev.dwo
296293
///

lib/DebugInfo/DWARF/DWARFVerifier.cpp

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -379,42 +379,20 @@ unsigned DWARFVerifier::verifyDieRanges(const DWARFDie &Die,
379379
// Build RI for this DIE and check that ranges within this DIE do not
380380
// overlap.
381381
DieRangeInfo RI(Die);
382+
for (auto Range : Ranges) {
383+
if (!Range.valid()) {
384+
++NumErrors;
385+
error() << "Invalid address range " << Range << "\n";
386+
continue;
387+
}
382388

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;
418396
}
419397
}
420398

@@ -743,15 +721,6 @@ void DWARFVerifier::verifyDebugLineRows() {
743721
}
744722
}
745723

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-
755724
bool DWARFVerifier::handleDebugLine() {
756725
NumDebugLineErrors = 0;
757726
OS << "Verifying .debug_line...\n";

test/tools/llvm-dwarfdump/X86/debug-verify-object.s

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)