9
9
#ifndef LLVM_DEBUGINFO_DWARF_DWARFVERIFIER_H
10
10
#define LLVM_DEBUGINFO_DWARF_DWARFVERIFIER_H
11
11
12
+ #include " llvm/ADT/StringMap.h"
12
13
#include " llvm/DebugInfo/DIContext.h"
13
14
#include " llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
14
15
#include " llvm/DebugInfo/DWARF/DWARFAddressRange.h"
15
16
#include " llvm/DebugInfo/DWARF/DWARFDie.h"
16
17
#include " llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
17
18
#include < cstdint>
18
19
#include < map>
20
+ #include < mutex>
19
21
#include < set>
20
22
21
23
namespace llvm {
@@ -37,7 +39,9 @@ struct AggregationData {
37
39
38
40
class OutputCategoryAggregator {
39
41
private:
42
+ std::mutex WriteMutex;
40
43
std::map<std::string, AggregationData, std::less<>> Aggregation;
44
+ uint64_t NumErrors = 0 ;
41
45
bool IncludeDetail;
42
46
43
47
public:
@@ -52,6 +56,8 @@ class OutputCategoryAggregator {
52
56
void EnumerateDetailedResultsFor (
53
57
StringRef category,
54
58
std::function<void (StringRef, unsigned )> handleCounts);
59
+ // / Return the number of errors that have been reported.
60
+ uint64_t GetNumErrors () const { return NumErrors; }
55
61
};
56
62
57
63
// / A class that verifies DWARF debug information given a DWARF Context.
@@ -114,6 +120,7 @@ class DWARFVerifier {
114
120
bool IsObjectFile;
115
121
bool IsMachOObject;
116
122
using ReferenceMap = std::map<uint64_t , std::set<uint64_t >>;
123
+ std::mutex AccessMutex;
117
124
118
125
raw_ostream &error () const ;
119
126
raw_ostream &warn () const ;
@@ -274,21 +281,23 @@ class DWARFVerifier {
274
281
// / \param SectionName the name of the table we're verifying
275
282
// /
276
283
// / \returns The number of errors occurred during verification
277
- unsigned verifyAppleAccelTable (const DWARFSection *AccelSection,
278
- DataExtractor *StrData,
279
- const char *SectionName);
280
-
281
- unsigned verifyDebugNamesCULists (const DWARFDebugNames &AccelTable);
282
- unsigned verifyNameIndexBuckets (const DWARFDebugNames::NameIndex &NI,
283
- const DataExtractor &StrData);
284
- unsigned verifyNameIndexAbbrevs (const DWARFDebugNames::NameIndex &NI);
285
- unsigned verifyNameIndexAttribute (const DWARFDebugNames::NameIndex &NI,
286
- const DWARFDebugNames::Abbrev &Abbr,
287
- DWARFDebugNames::AttributeEncoding AttrEnc);
288
- unsigned verifyNameIndexEntries (const DWARFDebugNames::NameIndex &NI,
289
- const DWARFDebugNames::NameTableEntry &NTE);
290
- unsigned verifyNameIndexCompleteness (const DWARFDie &Die,
291
- const DWARFDebugNames::NameIndex &NI);
284
+ void verifyAppleAccelTable (const DWARFSection *AccelSection,
285
+ DataExtractor *StrData, const char *SectionName);
286
+
287
+ void verifyDebugNamesCULists (const DWARFDebugNames &AccelTable);
288
+ void verifyNameIndexBuckets (const DWARFDebugNames::NameIndex &NI,
289
+ const DataExtractor &StrData);
290
+ void verifyNameIndexAbbrevs (const DWARFDebugNames::NameIndex &NI);
291
+ void verifyNameIndexAttribute (const DWARFDebugNames::NameIndex &NI,
292
+ const DWARFDebugNames::Abbrev &Abbr,
293
+ DWARFDebugNames::AttributeEncoding AttrEnc);
294
+ void verifyNameIndexEntries (
295
+ const DWARFDebugNames::NameIndex &NI,
296
+ const DWARFDebugNames::NameTableEntry &NTE,
297
+ const DenseMap<uint64_t , DWARFUnit *> &CUOffsetsToDUMap);
298
+ void verifyNameIndexCompleteness (
299
+ const DWARFDie &Die, const DWARFDebugNames::NameIndex &NI,
300
+ const StringMap<DenseSet<uint64_t >> &NamesToDieOffsets);
292
301
293
302
// / Verify that the DWARF v5 accelerator table is valid.
294
303
// /
@@ -307,8 +316,8 @@ class DWARFVerifier {
307
316
// / \param StrData string section
308
317
// /
309
318
// / \returns The number of errors occurred during verification
310
- unsigned verifyDebugNames (const DWARFSection &AccelSection,
311
- const DataExtractor &StrData);
319
+ void verifyDebugNames (const DWARFSection &AccelSection,
320
+ const DataExtractor &StrData);
312
321
313
322
public:
314
323
DWARFVerifier (raw_ostream &S, DWARFContext &D,
0 commit comments