[llvm] 1271cde - [DebugInfo][test] Adjust line table unit length to account for contents
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 3 04:17:12 PST 2020
Author: James Henderson
Date: 2020-02-03T12:16:36Z
New Revision: 1271cde47456a1201c085d0402a351f722a96f2d
URL: https://github.com/llvm/llvm-project/commit/1271cde47456a1201c085d0402a351f722a96f2d
DIFF: https://github.com/llvm/llvm-project/commit/1271cde47456a1201c085d0402a351f722a96f2d.diff
LOG: [DebugInfo][test] Adjust line table unit length to account for contents
Previously, if a debug line Prologue was created via
createBasicPrologue, its TotalLength field did not account for any
contents in the table itself. This change fixes this issue.
Reviewed by: probinson
Differential Revision: https://reviews.llvm.org/D73772
Added:
Modified:
llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
index bd2ae5c9b5e6..ba3bb5403762 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
@@ -549,9 +549,8 @@ TEST_F(DebugLineBasicFixture, ErrorForUnitLengthTooLarge) {
LT.addStandardOpcode(DW_LNS_const_add_pc, {});
LT.addExtendedOpcode(1, DW_LNE_end_sequence, {});
DWARFDebugLine::Prologue Prologue = LT.createBasicPrologue();
- // Set the total length to 1 higher than the actual length. The program body
- // has size 5.
- Prologue.TotalLength += 6;
+ // Set the total length to 1 higher than the actual length.
+ ++Prologue.TotalLength;
LT.setPrologue(Prologue);
generate();
diff --git a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
index 472d4dd6ad1e..f11e7c3a8407 100644
--- a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
@@ -175,6 +175,7 @@ DWARFDebugLine::Prologue dwarfgen::LineTable::createBasicPrologue() const {
P.TotalLength += 4;
P.FormParams.Format = DWARF64;
}
+ P.TotalLength += Contents.size();
P.FormParams.Version = Version;
P.MinInstLength = 1;
P.MaxOpsPerInst = 1;
More information about the llvm-commits
mailing list