16
16
#include " llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
17
17
#include < cstdint>
18
18
#include < map>
19
+ #include < mutex>
19
20
#include < set>
20
21
21
22
namespace llvm {
@@ -32,7 +33,9 @@ struct DWARFSection;
32
33
33
34
class OutputCategoryAggregator {
34
35
private:
36
+ std::mutex WriteMutex;
35
37
std::map<std::string, unsigned > Aggregation;
38
+ unsigned NumErrors = 0 ;
36
39
bool IncludeDetail;
37
40
38
41
public:
@@ -42,6 +45,8 @@ class OutputCategoryAggregator {
42
45
size_t GetNumCategories () const { return Aggregation.size (); }
43
46
void Report (StringRef s, std::function<void ()> detailCallback);
44
47
void EnumerateResults (std::function<void (StringRef, unsigned )> handleCounts);
48
+ // / Return the number of errors that have been reported.
49
+ unsigned GetNumErrors () const { return NumErrors; }
45
50
};
46
51
47
52
// / A class that verifies DWARF debug information given a DWARF Context.
@@ -104,6 +109,7 @@ class DWARFVerifier {
104
109
bool IsObjectFile;
105
110
bool IsMachOObject;
106
111
using ReferenceMap = std::map<uint64_t , std::set<uint64_t >>;
112
+ std::mutex AccessMutex;
107
113
108
114
raw_ostream &error () const ;
109
115
raw_ostream &warn () const ;
@@ -264,21 +270,22 @@ class DWARFVerifier {
264
270
// / \param SectionName the name of the table we're verifying
265
271
// /
266
272
// / \returns The number of errors occurred during verification
267
- unsigned verifyAppleAccelTable (const DWARFSection *AccelSection,
268
- DataExtractor *StrData,
269
- const char *SectionName);
270
-
271
- unsigned verifyDebugNamesCULists (const DWARFDebugNames &AccelTable);
272
- unsigned verifyNameIndexBuckets (const DWARFDebugNames::NameIndex &NI,
273
- const DataExtractor &StrData);
274
- unsigned verifyNameIndexAbbrevs (const DWARFDebugNames::NameIndex &NI);
275
- unsigned verifyNameIndexAttribute (const DWARFDebugNames::NameIndex &NI,
276
- const DWARFDebugNames::Abbrev &Abbr,
277
- DWARFDebugNames::AttributeEncoding AttrEnc);
278
- unsigned verifyNameIndexEntries (const DWARFDebugNames::NameIndex &NI,
279
- const DWARFDebugNames::NameTableEntry &NTE);
280
- unsigned verifyNameIndexCompleteness (const DWARFDie &Die,
281
- const DWARFDebugNames::NameIndex &NI);
273
+ void verifyAppleAccelTable (const DWARFSection *AccelSection,
274
+ DataExtractor *StrData, const char *SectionName);
275
+
276
+ void verifyDebugNamesCULists (const DWARFDebugNames &AccelTable);
277
+ void verifyNameIndexBuckets (const DWARFDebugNames::NameIndex &NI,
278
+ const DataExtractor &StrData);
279
+ void verifyNameIndexAbbrevs (const DWARFDebugNames::NameIndex &NI);
280
+ void verifyNameIndexAttribute (const DWARFDebugNames::NameIndex &NI,
281
+ const DWARFDebugNames::Abbrev &Abbr,
282
+ DWARFDebugNames::AttributeEncoding AttrEnc);
283
+ void verifyNameIndexEntries (
284
+ const DWARFDebugNames::NameIndex &NI,
285
+ const DWARFDebugNames::NameTableEntry &NTE,
286
+ const DenseMap<uint64_t , DWARFUnit *> &CUOffsetsToDUMap);
287
+ void verifyNameIndexCompleteness (const DWARFDie &Die,
288
+ const DWARFDebugNames::NameIndex &NI);
282
289
283
290
// / Verify that the DWARF v5 accelerator table is valid.
284
291
// /
@@ -297,8 +304,8 @@ class DWARFVerifier {
297
304
// / \param StrData string section
298
305
// /
299
306
// / \returns The number of errors occurred during verification
300
- unsigned verifyDebugNames (const DWARFSection &AccelSection,
301
- const DataExtractor &StrData);
307
+ void verifyDebugNames (const DWARFSection &AccelSection,
308
+ const DataExtractor &StrData);
302
309
303
310
public:
304
311
DWARFVerifier (raw_ostream &S, DWARFContext &D,
0 commit comments