[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
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user