[PATCH] D64622: [DWARF] Fix the reserved values for unit length in DWARFDebugLine.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 02:30:49 PDT 2019


ikudrin created this revision.
ikudrin added reviewers: dblaikie, probinson, emaste.
Herald added a subscriber: aprantl.
Herald added a project: LLVM.

The DWARF3 documentation had inconsistency concerning the reserved range for unit length values. The issue was fixed in DWARF4.
See http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/2008-June/003343.html


Repository:
  rL LLVM

https://reviews.llvm.org/D64622

Files:
  lib/DebugInfo/DWARF/DWARFDebugLine.cpp
  unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp


Index: unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
===================================================================
--- unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
+++ unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
@@ -291,13 +291,13 @@
     return;
 
   LineTable &LT = Gen->addLineTable();
-  LT.setCustomPrologue({{0xffffff00, LineTable::Long}});
+  LT.setCustomPrologue({{0xfffffff0, LineTable::Long}});
 
   generate();
 
   checkGetOrParseLineTableEmitsError(
       "parsing line table prologue at offset 0x00000000 unsupported reserved "
-      "unit length found of value 0xffffff00");
+      "unit length found of value 0xfffffff0");
 }
 
 TEST_F(DebugLineBasicFixture, ErrorForLowVersion) {
@@ -532,7 +532,7 @@
     return;
 
   LineTable &LT = Gen->addLineTable();
-  LT.setCustomPrologue({{0xffffff00, LineTable::Long}});
+  LT.setCustomPrologue({{0xfffffff0, LineTable::Long}});
   Gen->addLineTable();
   generate();
 
@@ -544,7 +544,7 @@
   EXPECT_FALSE(Recoverable);
 
   checkError("parsing line table prologue at offset 0x00000000 unsupported "
-             "reserved unit length found of value 0xffffff00",
+             "reserved unit length found of value 0xfffffff0",
              std::move(Unrecoverable));
 }
 
@@ -553,7 +553,7 @@
     return;
 
   LineTable &LT = Gen->addLineTable();
-  LT.setCustomPrologue({{0xffffff00, LineTable::Long}});
+  LT.setCustomPrologue({{0xfffffff0, LineTable::Long}});
   Gen->addLineTable();
   generate();
 
@@ -564,7 +564,7 @@
   EXPECT_TRUE(Parser.done());
 
   checkError("parsing line table prologue at offset 0x00000000 unsupported "
-             "reserved unit length found of value 0xffffff00",
+             "reserved unit length found of value 0xfffffff0",
              std::move(Unrecoverable));
 }
 
Index: lib/DebugInfo/DWARF/DWARFDebugLine.cpp
===================================================================
--- lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -284,7 +284,7 @@
   if (TotalLength == UINT32_MAX) {
     FormParams.Format = dwarf::DWARF64;
     TotalLength = DebugLineData.getU64(OffsetPtr);
-  } else if (TotalLength >= 0xffffff00) {
+  } else if (TotalLength >= 0xfffffff0) {
     return createStringError(errc::invalid_argument,
         "parsing line table prologue at offset 0x%8.8" PRIx64
         " unsupported reserved unit length found of value 0x%8.8" PRIx64,
@@ -1092,7 +1092,7 @@
 }
 
 bool DWARFDebugLine::Prologue::totalLengthIsValid() const {
-  return TotalLength == 0xffffffff || TotalLength < 0xffffff00;
+  return TotalLength == 0xffffffff || TotalLength < 0xfffffff0;
 }
 
 DWARFDebugLine::LineTable DWARFDebugLine::SectionParser::parseNext(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64622.209433.patch
Type: text/x-patch
Size: 2709 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190712/07055476/attachment-0001.bin>


More information about the llvm-commits mailing list