summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/DebugInfo
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-07-22 23:23:34 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-07-22 23:23:34 +0000
commit0e7ba06e82b441bcc868815c8050a32450d26fc3 (patch)
tree3994615d8e270b3025d1ae836fc22a1162935e4d /llvm/unittests/DebugInfo
parent298a1ed4add3247819650fd719b2848e6d8df4b6 (diff)
downloadbcm5719-llvm-0e7ba06e82b441bcc868815c8050a32450d26fc3.tar.gz
bcm5719-llvm-0e7ba06e82b441bcc868815c8050a32450d26fc3.zip
[DWARF] Add more error handling to debug line parser.
This patch exnteds the error handling in the debug line parser to get rid of the existing MD5 assertion. I want to reuse the debug line parser from LLVM in LLDB where we cannot crash on invalid input. Differential revision: https://reviews.llvm.org/D64544 llvm-svn: 366762
Diffstat (limited to 'llvm/unittests/DebugInfo')
-rw-r--r--llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
index ce7c252d83e..bf2dee4ce24 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
@@ -120,6 +120,16 @@ struct CommonFixture {
checkError(ExpectedMsg, ExpectedLineTable.takeError());
}
+ void checkGetOrParseLineTableEmitsError(ArrayRef<StringRef> ExpectedMsgs,
+ uint64_t Offset = 0) {
+ auto ExpectedLineTable = Line.getOrParseLineTable(
+ LineData, Offset, *Context, nullptr, RecordRecoverable);
+ EXPECT_FALSE(ExpectedLineTable);
+ EXPECT_FALSE(Recoverable);
+
+ checkError(ExpectedMsgs, ExpectedLineTable.takeError());
+ }
+
std::unique_ptr<Generator> Gen;
std::unique_ptr<DWARFContext> Context;
DWARFDataExtractor LineData;
@@ -344,8 +354,9 @@ TEST_F(DebugLineBasicFixture, ErrorForInvalidV5IncludeDirTable) {
generate();
checkGetOrParseLineTableEmitsError(
- "parsing line table prologue at 0x00000000 found an invalid directory or "
- "file table description at 0x00000014");
+ {"parsing line table prologue at 0x00000000 found an invalid directory "
+ "or file table description at 0x00000014",
+ "failed to parse entry content descriptions because no path was found"});
}
TEST_P(DebugLineParameterisedFixture, ErrorForTooLargePrologueLength) {
OpenPOWER on IntegriCloud