From 5c0516598436ee7aad2ba950e936d8524c3ef324 Mon Sep 17 00:00:00 2001 From: James Henderson Date: Tue, 28 Jan 2020 11:49:30 +0000 Subject: Revert "[DebugInfo] Make most debug line prologue errors non-fatal to parsing" This reverts commit b94191fecdbadc18b342a27df1109754edcb8c4b. The change broke both an LLD test and the LLDB build. --- .../DebugInfo/DWARF/DWARFDebugLineTest.cpp | 56 +++++----------------- 1 file changed, 12 insertions(+), 44 deletions(-) (limited to 'llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp') diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp index 89c28bc..731afaf 100644 --- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp @@ -359,15 +359,10 @@ TEST_F(DebugLineBasicFixture, ErrorForInvalidV5IncludeDirTable) { generate(); - auto ExpectedLineTable = Line.getOrParseLineTable(LineData, 0, *Context, - nullptr, RecordRecoverable); - EXPECT_THAT_EXPECTED(ExpectedLineTable, Succeeded()); - - checkError( + checkGetOrParseLineTableEmitsFatalError( {"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"}, - std::move(Recoverable)); + "failed to parse entry content descriptions because no path was found"}); } TEST_P(DebugLineParameterisedFixture, ErrorForTooLargePrologueLength) { @@ -384,24 +379,14 @@ TEST_P(DebugLineParameterisedFixture, ErrorForTooLargePrologueLength) { generate(); - auto ExpectedLineTable = Line.getOrParseLineTable(LineData, 0, *Context, - nullptr, RecordRecoverable); - ASSERT_THAT_EXPECTED(ExpectedLineTable, Succeeded()); - DWARFDebugLine::LineTable Result(**ExpectedLineTable); - // Undo the earlier modification so that it can be compared against a - // "default" prologue. - --Result.Prologue.PrologueLength; - checkDefaultPrologue(Version, Format, Result.Prologue, 0); - uint64_t ExpectedEnd = Prologue.TotalLength + 1 + Prologue.sizeofTotalLength(); - checkError( + checkGetOrParseLineTableEmitsFatalError( (Twine("parsing line table prologue at 0x00000000 should have ended at " "0x000000") + Twine::utohexstr(ExpectedEnd) + " but it ended at 0x000000" + Twine::utohexstr(ExpectedEnd - 1)) - .str(), - std::move(Recoverable)); + .str()); } TEST_P(DebugLineParameterisedFixture, ErrorForTooShortPrologueLength) { @@ -423,29 +408,16 @@ TEST_P(DebugLineParameterisedFixture, ErrorForTooShortPrologueLength) { generate(); - auto ExpectedLineTable = Line.getOrParseLineTable(LineData, 0, *Context, - nullptr, RecordRecoverable); - ASSERT_THAT_EXPECTED(ExpectedLineTable, Succeeded()); - DWARFDebugLine::LineTable Result(**ExpectedLineTable); - // Undo the earlier modification so that it can be compared against a - // "default" prologue. - if (Version < 5) - Result.Prologue.PrologueLength += 2; - else - Result.Prologue.PrologueLength += 1; - checkDefaultPrologue(Version, Format, Result.Prologue, 0); - uint64_t ExpectedEnd = Prologue.TotalLength - 1 + Prologue.sizeofTotalLength(); if (Version < 5) --ExpectedEnd; - checkError( + checkGetOrParseLineTableEmitsFatalError( (Twine("parsing line table prologue at 0x00000000 should have ended at " "0x000000") + Twine::utohexstr(ExpectedEnd) + " but it ended at 0x000000" + Twine::utohexstr(ExpectedEnd + 1)) - .str(), - std::move(Recoverable)); + .str()); } INSTANTIATE_TEST_CASE_P( @@ -664,15 +636,14 @@ TEST_F(DebugLineBasicFixture, ParserSkipsCorrectly) { EXPECT_EQ(Parser.getOffset(), 0u); ASSERT_FALSE(Parser.done()); - Parser.skip(RecordRecoverable, RecordUnrecoverable); + Parser.skip(RecordUnrecoverable); EXPECT_EQ(Parser.getOffset(), 62u); ASSERT_FALSE(Parser.done()); - Parser.skip(RecordRecoverable, RecordUnrecoverable); + Parser.skip(RecordUnrecoverable); EXPECT_EQ(Parser.getOffset(), 136u); EXPECT_TRUE(Parser.done()); - EXPECT_FALSE(Recoverable); EXPECT_FALSE(Unrecoverable); } @@ -717,11 +688,10 @@ TEST_F(DebugLineBasicFixture, ParserMovesToEndForBadLengthWhenSkipping) { generate(); DWARFDebugLine::SectionParser Parser(LineData, *Context, CUs, TUs); - Parser.skip(RecordRecoverable, RecordUnrecoverable); + Parser.skip(RecordUnrecoverable); EXPECT_EQ(Parser.getOffset(), 4u); EXPECT_TRUE(Parser.done()); - EXPECT_FALSE(Recoverable); checkError("parsing line table prologue at offset 0x00000000 unsupported " "reserved unit length found of value 0xfffffff0", @@ -797,12 +767,11 @@ TEST_F(DebugLineBasicFixture, generate(); DWARFDebugLine::SectionParser Parser(LineData, *Context, CUs, TUs); - Parser.skip(RecordRecoverable, RecordUnrecoverable); + Parser.skip(RecordUnrecoverable); ASSERT_FALSE(Parser.done()); - Parser.skip(RecordRecoverable, RecordUnrecoverable); + Parser.skip(RecordUnrecoverable); EXPECT_TRUE(Parser.done()); - EXPECT_FALSE(Recoverable); checkError({"parsing line table prologue at offset 0x00000000 found " "unsupported version 0x00", @@ -820,10 +789,9 @@ TEST_F(DebugLineBasicFixture, ParserIgnoresNonPrologueErrorsWhenSkipping) { generate(); DWARFDebugLine::SectionParser Parser(LineData, *Context, CUs, TUs); - Parser.skip(RecordRecoverable, RecordUnrecoverable); + Parser.skip(RecordUnrecoverable); EXPECT_TRUE(Parser.done()); - EXPECT_FALSE(Recoverable); EXPECT_FALSE(Unrecoverable); } -- cgit v1.1