Skip to content

Commit 389ff8a

Browse files
author
Kevin Frei
committed
Not formatted, mostly to keep the current model easy to see
1 parent a356e6c commit 389ff8a

File tree

4 files changed

+129
-44
lines changed

4 files changed

+129
-44
lines changed

llvm/include/llvm/DebugInfo/DIContext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ struct DIDumpOptions {
205205
bool DisplayRawContents = false;
206206
bool IsEH = false;
207207
bool DumpNonSkeleton = false;
208+
bool DumpAggregateErrors = true;
208209
std::function<llvm::StringRef(uint64_t DwarfRegNum, bool IsEH)>
209210
GetNameForDWARFReg;
210211

llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,32 @@ class DWARFVerifier {
7777
};
7878

7979
private:
80+
class ErrorAggregator {
81+
private:
82+
DWARFVerifier &Verifier;
83+
std::map<std::string, int> UniqueErrors;
84+
static std::string Clean(const char *s);
85+
86+
public:
87+
ErrorAggregator(DWARFVerifier &v) : Verifier(v) {}
88+
raw_ostream &operator<<(const char *s);
89+
void Collect(const std::string &s);
90+
void Dump();
91+
};
92+
friend class ErrorAggregator;
93+
8094
raw_ostream &OS;
8195
DWARFContext &DCtx;
96+
ErrorAggregator ErrAggregation;
8297
DIDumpOptions DumpOpts;
8398
uint32_t NumDebugLineErrors = 0;
8499
// Used to relax some checks that do not currently work portably
85100
bool IsObjectFile;
86101
bool IsMachOObject;
87102
using ReferenceMap = std::map<uint64_t, std::set<uint64_t>>;
88103

104+
raw_ostream &aggregate(const char *);
105+
ErrorAggregator &aggregate();
89106
raw_ostream &error() const;
90107
raw_ostream &warn() const;
91108
raw_ostream &note() const;
@@ -348,6 +365,9 @@ class DWARFVerifier {
348365
bool verifyDebugStrOffsets(
349366
StringRef SectionName, const DWARFSection &Section, StringRef StrData,
350367
void (DWARFObject::*)(function_ref<void(const DWARFSection &)>) const);
368+
369+
/// Emits any aggregate information collection, depending on the dump options
370+
void finish();
351371
};
352372

353373
static inline bool operator<(const DWARFVerifier::DieRangeInfo &LHS,

llvm/lib/DebugInfo/DWARF/DWARFContext.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,7 @@ bool DWARFContext::verify(raw_ostream &OS, DIDumpOptions DumpOpts) {
14081408
if (DumpOpts.DumpType & DIDT_DebugStrOffsets)
14091409
Success &= verifier.handleDebugStrOffsets();
14101410
Success &= verifier.handleAccelTables();
1411+
verifier.finish();
14111412
return Success;
14121413
}
14131414

0 commit comments

Comments
 (0)