summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-04-19 03:34:28 +0000
committerFangrui Song <maskray@google.com>2019-04-19 03:34:28 +0000
commit9a331bba2a26c47a2e55fe397b3da85d8f119eb7 (patch)
tree4c74db78f5992bdd88278aeccc212bf32b62654c /llvm/lib/DebugInfo/DWARF
parent96451e3a2cab2d92159941866f786eac7414a493 (diff)
downloadbcm5719-llvm-9a331bba2a26c47a2e55fe397b3da85d8f119eb7.tar.gz
bcm5719-llvm-9a331bba2a26c47a2e55fe397b3da85d8f119eb7.zip
[DWARF] Use hasFileAtIndex to properly verify DWARF 5 after rL358732
llvm-svn: 358734
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index 5ff25b5209e..8fea97aa3c2 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -705,7 +705,6 @@ void DWARFVerifier::verifyDebugLineRows() {
continue;
// Verify prologue.
- uint32_t MaxFileIndex = LineTable->Prologue.FileNames.size();
uint32_t MaxDirIndex = LineTable->Prologue.IncludeDirectories.size();
uint32_t FileIndex = 1;
StringMap<uint16_t> FullPathMap;
@@ -763,13 +762,16 @@ void DWARFVerifier::verifyDebugLineRows() {
}
// Verify file index.
- if (Row.File > MaxFileIndex) {
+ if (!LineTable->hasFileAtIndex(Row.File)) {
++NumDebugLineErrors;
+ bool isDWARF5 = LineTable->Prologue.getVersion() >= 5;
error() << ".debug_line["
<< format("0x%08" PRIx64,
*toSectionOffset(Die.find(DW_AT_stmt_list)))
<< "][" << RowIndex << "] has invalid file index " << Row.File
- << " (valid values are [1," << MaxFileIndex << "]):\n";
+ << " (valid values are [" << (isDWARF5 ? "0," : "1,")
+ << LineTable->Prologue.FileNames.size()
+ << (isDWARF5 ? ")" : "]") << "):\n";
DWARFDebugLine::Row::dumpTableHeader(OS);
Row.dump(OS);
OS << '\n';
OpenPOWER on IntegriCloud