<div dir="ltr">What was the asan bot failure? What was the fix?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 10, 2019 at 4:52 AM Igor Kudrin via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: ikudrin<br>
Date: Tue Sep 10 04:54:32 2019<br>
New Revision: 371510<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=371510&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=371510&view=rev</a><br>
Log:<br>
Reland [DWARF] Add a unit test for DWARFUnit::getLength().<br>
<br>
This is a follow-up of rL369529, where the return value of<br>
DWARFUnit::getLength() was changed from uint32_t to uint64_t.<br>
The test checks that a unit header with Length > 4G can be successfully<br>
parsed and the value of the Length field is not truncated.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D67276" rel="noreferrer" target="_blank">https://reviews.llvm.org/D67276</a><br>
<br>
Modified:<br>
    llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp<br>
<br>
Modified: llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp?rev=371510&r1=371509&r2=371510&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp?rev=371510&r1=371509&r2=371510&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp (original)<br>
+++ llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp Tue Sep 10 04:54:32 2019<br>
@@ -3158,4 +3158,46 @@ TEST(DWARFDebugInfo, TestDWARFDieRangeIn<br>
   AssertRangesIntersect(Ranges, {{0x20, 0x21}, {0x2f, 0x31}});<br>
 }<br>
<br>
+TEST(DWARFDebugInfo, TestDWARF64UnitLength) {<br>
+  static const char DebugInfoSecRaw[] =<br>
+      "\xff\xff\xff\xff"                 // DWARF64 mark<br>
+      "\x88\x77\x66\x55\x44\x33\x22\x11" // Length<br>
+      "\x05\x00"                         // Version<br>
+      "\x01"                             // DW_UT_compile<br>
+      "\x04"                             // Address size<br>
+      "\0\0\0\0\0\0\0\0";                // Offset Into Abbrev. Sec.<br>
+  StringMap<std::unique_ptr<MemoryBuffer>> Sections;<br>
+  Sections.insert(std::make_pair(<br>
+      "debug_info", MemoryBuffer::getMemBuffer(StringRef(<br>
+                        DebugInfoSecRaw, sizeof(DebugInfoSecRaw) - 1))));<br>
+  auto Context = DWARFContext::create(Sections, /* AddrSize = */ 4,<br>
+                                      /* isLittleEndian = */ true);<br>
+  const auto &Obj = Context->getDWARFObj();<br>
+  Obj.forEachInfoSections([&](const DWARFSection &Sec) {<br>
+    DWARFUnitHeader Header;<br>
+    DWARFDataExtractor Data(Obj, Sec, /* IsLittleEndian = */ true,<br>
+                            /* AddressSize = */ 4);<br>
+    uint64_t Offset = 0;<br>
+    EXPECT_FALSE(Header.extract(*Context, Data, &Offset));<br>
+    // Header.extract() returns false because there is not enough space<br>
+    // in the section for the declared length. Anyway, we can check that<br>
+    // the properties are read correctly.<br>
+    ASSERT_EQ(DwarfFormat::DWARF64, Header.getFormat());<br>
+    ASSERT_EQ(0x1122334455667788ULL, Header.getLength());<br>
+    ASSERT_EQ(5, Header.getVersion());<br>
+    ASSERT_EQ(DW_UT_compile, Header.getUnitType());<br>
+    ASSERT_EQ(4, Header.getAddressByteSize());<br>
+<br>
+    // Check that the length can be correctly read in the unit class.<br>
+    DWARFUnitVector DummyUnitVector;<br>
+    DWARFSection DummySec;<br>
+    DWARFCompileUnit CU(*Context, Sec, Header, /* DA = */ 0, /* RS = */ 0,<br>
+                        /* LocSection = */ 0, /* SS = */ StringRef(),<br>
+                        /* SOS = */ DummySec, /* AOS = */ 0,<br>
+                        /* LS = */ DummySec, /* LE = */ true,<br>
+                        /* isDWO= */ false, DummyUnitVector);<br>
+    ASSERT_EQ(0x1122334455667788ULL, CU.getLength());<br>
+  });<br>
+}<br>
+<br>
 } // end anonymous namespace<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>