[PATCH] D73772: [DebugInfo][test] Adjust line table unit length to account for contents

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 02:56:19 PST 2020


jhenderson created this revision.
jhenderson added reviewers: ikudrin, dblaikie, probinson, JDevlieghere.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73772

Files:
  llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
  llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp


Index: llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
===================================================================
--- llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
+++ llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
@@ -175,6 +175,7 @@
     P.TotalLength += 4;
     P.FormParams.Format = DWARF64;
   }
+  P.TotalLength += Contents.size();
   P.FormParams.Version = Version;
   P.MinInstLength = 1;
   P.MaxOpsPerInst = 1;
Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
===================================================================
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
@@ -549,9 +549,8 @@
   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();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73772.241667.patch
Type: text/x-patch
Size: 1136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200131/5a18e13f/attachment.bin>


More information about the llvm-commits mailing list