[llvm] r269913 - Try again to fix pdbdump-headers.test on big-endian hosts after r269861.

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Wed May 18 05:36:25 PDT 2016


Author: dsanders
Date: Wed May 18 07:36:25 2016
New Revision: 269913

URL: http://llvm.org/viewvc/llvm-project?rev=269913&view=rev
Log:
Try again to fix pdbdump-headers.test on big-endian hosts after r269861.

r269898 fixed the problem with HashBuckets but the same issue occurred with
AddressMap and ThunkMap too.

Modified:
    llvm/trunk/lib/DebugInfo/PDB/Raw/PublicsStream.cpp

Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/PublicsStream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/PublicsStream.cpp?rev=269913&r1=269912&r2=269913&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/PublicsStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/PublicsStream.cpp Wed May 18 07:36:25 2016
@@ -138,8 +138,7 @@ Error PublicsStream::reload() {
   // corrupted streams.
 
   // Hash buckets follow.
-  std::vector<ulittle32_t> TempHashBuckets;
-  TempHashBuckets.resize(NumBuckets);
+  std::vector<ulittle32_t> TempHashBuckets(NumBuckets);
   if (auto EC = Reader.readArray<ulittle32_t>(TempHashBuckets))
     return make_error<RawError>(raw_error_code::corrupt_file,
                                 "Hash buckets corrupted.");
@@ -148,16 +147,21 @@ Error PublicsStream::reload() {
             HashBuckets.begin());
 
   // Something called "address map" follows.
-  AddressMap.resize(Header->AddrMap / sizeof(uint32_t));
-  if (auto EC = Reader.readArray<uint32_t>(AddressMap))
+  std::vector<ulittle32_t> TempAddressMap(Header->AddrMap / sizeof(uint32_t));
+  if (auto EC = Reader.readArray<ulittle32_t>(TempAddressMap))
     return make_error<RawError>(raw_error_code::corrupt_file,
                                 "Could not read an address map.");
+  AddressMap.resize(Header->AddrMap / sizeof(uint32_t));
+  std::copy(TempAddressMap.begin(), TempAddressMap.end(), AddressMap.begin());
 
   // Something called "thunk map" follows.
+  std::vector<ulittle32_t> TempThunkMap(Header->NumThunks);
   ThunkMap.resize(Header->NumThunks);
-  if (auto EC = Reader.readArray<uint32_t>(ThunkMap))
+  if (auto EC = Reader.readArray<ulittle32_t>(TempThunkMap))
     return make_error<RawError>(raw_error_code::corrupt_file,
                                 "Could not read a thunk map.");
+  ThunkMap.resize(Header->NumThunks);
+  std::copy(TempThunkMap.begin(), TempThunkMap.end(), ThunkMap.begin());
 
   // Something called "section map" follows.
   std::vector<SectionOffset> SectionMap(Header->NumSections);




More information about the llvm-commits mailing list