diff options
author | James Henderson <james.henderson@sony.com> | 2020-01-29 14:45:41 +0000 |
---|---|---|
committer | James Henderson <james.henderson@sony.com> | 2020-01-30 09:35:50 +0000 |
commit | 021f531786df4a21c67eb7b238b97a84263e36c7 (patch) | |
tree | 69100f6922b270d7a566a95eb14136c762650dc1 /llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp | |
parent | 676c29694c5444ca3c63067770dfac0f37158797 (diff) | |
download | llvm-021f531786df4a21c67eb7b238b97a84263e36c7.zip llvm-021f531786df4a21c67eb7b238b97a84263e36c7.tar.gz llvm-021f531786df4a21c67eb7b238b97a84263e36c7.tar.bz2 |
[DebugInfo] Fix DebugLine::Prologue::getLength
The function a) returned 32-bits when in DWARF64, the PrologueLength
field is 64-bits in size, and b) didn't work for DWARF version 5.
Also deleted some related dead code. With this deletion, getLength is
itself dead, but another change is about to make use of it.
Reviewed by: probinson
Differential Revision: https://reviews.llvm.org/D73626
Diffstat (limited to 'llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp')
-rw-r--r-- | llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp index 89c28bc..bd2ae5c 100644 --- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp @@ -235,6 +235,29 @@ TEST_F(DebugLineBasicFixture, GetOrParseLineTableAtInvalidOffsetAfterData) { "offset 0x00000001 is not a valid debug line section offset", 1);
}
+TEST_P(DebugLineParameterisedFixture, PrologueGetLength) {
+ if (!setupGenerator(Version))
+ return;
+ LineTable < = Gen->addLineTable(Format);
+ DWARFDebugLine::Prologue Prologue = LT.createBasicPrologue();
+ LT.setPrologue(Prologue);
+ generate();
+
+ // + 10 for sizes of DWARF-32 unit length, version, prologue length.
+ uint64_t ExpectedLength = Prologue.PrologueLength + 10;
+ if (Version == 5)
+ // Add address and segment selector size fields.
+ ExpectedLength += 2;
+ if (Format == DWARF64)
+ // Unit length grows by 8, prologue length by 4.
+ ExpectedLength += 12;
+
+ auto ExpectedLineTable = Line.getOrParseLineTable(LineData, 0, *Context,
+ nullptr, RecordRecoverable);
+ ASSERT_THAT_EXPECTED(ExpectedLineTable, Succeeded());
+ EXPECT_EQ((*ExpectedLineTable)->Prologue.getLength(), ExpectedLength);
+}
+
TEST_P(DebugLineParameterisedFixture, GetOrParseLineTableValidTable) {
if (!setupGenerator(Version))
return;
|