[llvm] r366190 - [DWARF] Fix the reserved values for unit length in DWARFDebugLine.

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 00:01:08 PDT 2019


Author: ikudrin
Date: Tue Jul 16 00:01:08 2019
New Revision: 366190

URL: http://llvm.org/viewvc/llvm-project?rev=366190&view=rev
Log:
[DWARF] Fix the reserved values for unit length in DWARFDebugLine.

The DWARF3 documentation had inconsistency concerning the reserved range
for unit length values. The issue was fixed in DWARF4.

Differential Revision: https://reviews.llvm.org/D64622

Modified:
    llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
    llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp?rev=366190&r1=366189&r2=366190&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp Tue Jul 16 00:01:08 2019
@@ -304,7 +304,7 @@ Error DWARFDebugLine::Prologue::parse(co
   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,
@@ -1091,7 +1091,7 @@ DWARFDebugLine::SectionParser::SectionPa
 }
 
 bool DWARFDebugLine::Prologue::totalLengthIsValid() const {
-  return TotalLength == 0xffffffff || TotalLength < 0xffffff00;
+  return TotalLength == 0xffffffff || TotalLength < 0xfffffff0;
 }
 
 DWARFDebugLine::LineTable DWARFDebugLine::SectionParser::parseNext(

Modified: llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp?rev=366190&r1=366189&r2=366190&view=diff
==============================================================================
--- llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp (original)
+++ llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp Tue Jul 16 00:01:08 2019
@@ -291,13 +291,13 @@ TEST_F(DebugLineBasicFixture, ErrorForRe
     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 @@ TEST_F(DebugLineBasicFixture, ParserMove
     return;
 
   LineTable &LT = Gen->addLineTable();
-  LT.setCustomPrologue({{0xffffff00, LineTable::Long}});
+  LT.setCustomPrologue({{0xfffffff0, LineTable::Long}});
   Gen->addLineTable();
   generate();
 
@@ -544,7 +544,7 @@ TEST_F(DebugLineBasicFixture, ParserMove
   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 @@ TEST_F(DebugLineBasicFixture, ParserMove
     return;
 
   LineTable &LT = Gen->addLineTable();
-  LT.setCustomPrologue({{0xffffff00, LineTable::Long}});
+  LT.setCustomPrologue({{0xfffffff0, LineTable::Long}});
   Gen->addLineTable();
   generate();
 
@@ -564,7 +564,7 @@ TEST_F(DebugLineBasicFixture, ParserMove
   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));
 }
 




More information about the llvm-commits mailing list