diff options
author | Pavel Labath <pavel@labath.sk> | 2020-02-14 15:41:38 +0100 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2020-03-02 11:14:29 +0100 |
commit | d978656fd0612d81b7bf84fc7e36e5b70592c07d (patch) | |
tree | b99595212c609717fd55ec8ebc4e619e23b44cb1 /llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp | |
parent | b52355f8a196b5040dc2e42870bf8c459306cfaa (diff) | |
download | llvm-d978656fd0612d81b7bf84fc7e36e5b70592c07d.zip llvm-d978656fd0612d81b7bf84fc7e36e5b70592c07d.tar.gz llvm-d978656fd0612d81b7bf84fc7e36e5b70592c07d.tar.bz2 |
[DWARFDebugLine] Use new DWARFDataExtractor::getInitialLength
Summary:
The error messages change somewhat, but I believe the overall
informational value remains unchanged.
Reviewers: jhenderson, dblaikie, ikudrin
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75116
Diffstat (limited to 'llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp')
-rw-r--r-- | llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp index 0ec04a7..25db5af 100644 --- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp @@ -210,6 +210,11 @@ TEST_F(DebugLineBasicFixture, GetOrParseLineTableAtInvalidOffsetAfterData) { generate(); EXPECT_THAT_EXPECTED( + getOrParseLineTableFatalErrors(0), + FailedWithMessage("parsing line table prologue at offset 0x00000000: " + "unexpected end of data at offset 0x0")); + + EXPECT_THAT_EXPECTED( getOrParseLineTableFatalErrors(1), FailedWithMessage( "offset 0x00000001 is not a valid debug line section offset")); @@ -316,8 +321,8 @@ TEST_F(DebugLineBasicFixture, ErrorForReservedLength) { EXPECT_THAT_EXPECTED( getOrParseLineTableFatalErrors(), FailedWithMessage( - "parsing line table prologue at offset 0x00000000 unsupported " - "reserved unit length found of value 0xfffffff0")); + "parsing line table prologue at offset 0x00000000: unsupported " + "reserved unit length of value 0xfffffff0")); } struct DebugLineUnsupportedVersionFixture : public TestWithParam<uint16_t>, @@ -339,8 +344,8 @@ TEST_P(DebugLineUnsupportedVersionFixture, ErrorForUnsupportedVersion) { EXPECT_THAT_EXPECTED( getOrParseLineTableFatalErrors(), - FailedWithMessage("parsing line table prologue at offset 0x00000000 " - "found unsupported version " + + FailedWithMessage("parsing line table prologue at offset 0x00000000: " + "unsupported version " + std::to_string(Version))); } @@ -807,7 +812,7 @@ TEST_F(DebugLineBasicFixture, ParserAlwaysDoneForEmptySection) { EXPECT_TRUE(Parser.done()); } -TEST_F(DebugLineBasicFixture, ParserMovesToEndForBadLengthWhenParsing) { +TEST_F(DebugLineBasicFixture, ParserMarkedAsDoneForBadLengthWhenParsing) { if (!setupGenerator()) return; @@ -819,18 +824,18 @@ TEST_F(DebugLineBasicFixture, ParserMovesToEndForBadLengthWhenParsing) { DWARFDebugLine::SectionParser Parser(LineData, *Context, CUs, TUs); Parser.parseNext(RecordRecoverable, RecordUnrecoverable); - EXPECT_EQ(Parser.getOffset(), 4u); + EXPECT_EQ(Parser.getOffset(), 0u); EXPECT_TRUE(Parser.done()); EXPECT_FALSE(Recoverable); EXPECT_THAT_ERROR( std::move(Unrecoverable), FailedWithMessage( - "parsing line table prologue at offset 0x00000000 unsupported " - "reserved unit length found of value 0xfffffff0")); + "parsing line table prologue at offset 0x00000000: unsupported " + "reserved unit length of value 0xfffffff0")); } -TEST_F(DebugLineBasicFixture, ParserMovesToEndForBadLengthWhenSkipping) { +TEST_F(DebugLineBasicFixture, ParserMarkedAsDoneForBadLengthWhenSkipping) { if (!setupGenerator()) return; @@ -842,15 +847,15 @@ TEST_F(DebugLineBasicFixture, ParserMovesToEndForBadLengthWhenSkipping) { DWARFDebugLine::SectionParser Parser(LineData, *Context, CUs, TUs); Parser.skip(RecordRecoverable, RecordUnrecoverable); - EXPECT_EQ(Parser.getOffset(), 4u); + EXPECT_EQ(Parser.getOffset(), 0u); EXPECT_TRUE(Parser.done()); EXPECT_FALSE(Recoverable); EXPECT_THAT_ERROR( std::move(Unrecoverable), FailedWithMessage( - "parsing line table prologue at offset 0x00000000 unsupported " - "reserved unit length found of value 0xfffffff0")); + "parsing line table prologue at offset 0x00000000: unsupported " + "reserved unit length of value 0xfffffff0")); } TEST_F(DebugLineBasicFixture, ParserReportsFirstErrorInEachTableWhenParsing) { @@ -873,10 +878,10 @@ TEST_F(DebugLineBasicFixture, ParserReportsFirstErrorInEachTableWhenParsing) { EXPECT_THAT_ERROR( std::move(Unrecoverable), - FailedWithMessage("parsing line table prologue at offset 0x00000000 " - "found unsupported version 0", - "parsing line table prologue at offset 0x00000006 " - "found unsupported version 1")); + FailedWithMessage("parsing line table prologue at offset 0x00000000: " + "unsupported version 0", + "parsing line table prologue at offset 0x00000006: " + "unsupported version 1")); } TEST_F(DebugLineBasicFixture, ParserReportsNonPrologueProblemsWhenParsing) { @@ -932,10 +937,10 @@ TEST_F(DebugLineBasicFixture, EXPECT_THAT_ERROR( std::move(Unrecoverable), - FailedWithMessage("parsing line table prologue at offset 0x00000000 " - "found unsupported version 0", - "parsing line table prologue at offset 0x00000006 " - "found unsupported version 1")); + FailedWithMessage("parsing line table prologue at offset 0x00000000: " + "unsupported version 0", + "parsing line table prologue at offset 0x00000006: " + "unsupported version 1")); } TEST_F(DebugLineBasicFixture, ParserIgnoresNonPrologueErrorsWhenSkipping) { |