summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
authorSpyridoula Gravani <sgravani@apple.com>2017-07-21 00:51:32 +0000
committerSpyridoula Gravani <sgravani@apple.com>2017-07-21 00:51:32 +0000
commitc6ef9873ac813556da8055c8de6d1c46a3816ef5 (patch)
tree4c81b0d76c7464a8c95d731d4a6061835a075c2d /llvm/lib/DebugInfo
parent31140ade70a995f32ff9001079be3f0e5139b521 (diff)
downloadbcm5719-llvm-c6ef9873ac813556da8055c8de6d1c46a3816ef5.tar.gz
bcm5719-llvm-c6ef9873ac813556da8055c8de6d1c46a3816ef5.zip
[DWARF] Generalized verification of .debug_abbrev to be applicable to both .debug_abbrev and .debug_abbrev.dwo sections.
Differential Revision: https://reviews.llvm.org/D35698 llvm-svn: 308703
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp38
1 files changed, 24 insertions, 14 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index d683642af02..db38b632422 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -102,17 +102,8 @@ bool DWARFVerifier::verifyUnitContents(DWARFUnit Unit) {
return NumUnitErrors == 0;
}
-bool DWARFVerifier::handleDebugAbbrev() {
- OS << "Verifying .debug_abbrev...\n";
-
- const DWARFObject &DObj = DCtx.getDWARFObj();
- if (DObj.getAbbrevSection().empty()) {
- OS << "Warning: .debug_abbrev is empty.\n";
- return true;
- }
-
+unsigned DWARFVerifier::verifyAbbrevSection(const DWARFDebugAbbrev *Abbrev) {
unsigned NumErrors = 0;
- const DWARFDebugAbbrev *Abbrev = DCtx.getDebugAbbrev();
if (Abbrev) {
const DWARFAbbreviationDeclarationSet *AbbrDecls =
Abbrev->getAbbreviationDeclarationSet(0);
@@ -121,15 +112,34 @@ bool DWARFVerifier::handleDebugAbbrev() {
for (auto Attribute : AbbrDecl.attributes()) {
auto Result = AttributeSet.insert(Attribute.Attr);
if (!Result.second) {
- OS << format("Error: Abbreviation declaration with code %d ",
- AbbrDecl.getCode());
- OS << "contains multiple " << AttributeString(Attribute.Attr)
- << " attributes.\n";
+ OS << "Error: Abbreviation declaration contains multiple "
+ << AttributeString(Attribute.Attr) << " attributes.\n";
+ AbbrDecl.dump(OS);
++NumErrors;
}
}
}
}
+ return NumErrors;
+}
+
+bool DWARFVerifier::handleDebugAbbrev() {
+ OS << "Verifying .debug_abbrev...\n";
+
+ const DWARFObject &DObj = DCtx.getDWARFObj();
+ bool noDebugAbbrev = DObj.getAbbrevSection().empty();
+ bool noDebugAbbrevDWO = DObj.getAbbrevDWOSection().empty();
+
+ if (noDebugAbbrev && noDebugAbbrevDWO) {
+ return true;
+ }
+
+ unsigned NumErrors = 0;
+ if (!noDebugAbbrev)
+ NumErrors += verifyAbbrevSection(DCtx.getDebugAbbrev());
+
+ if (!noDebugAbbrevDWO)
+ NumErrors += verifyAbbrevSection(DCtx.getDebugAbbrevDWO());
return NumErrors == 0;
}
OpenPOWER on IntegriCloud