diff options
| author | 2019-01-27 16:42:12 +0000 | |
|---|---|---|
| committer | 2019-01-27 16:42:12 +0000 | |
| commit | b773203fb58f3ef282fb69c832d8710cab5bc82d (patch) | |
| tree | e75913f147570fbd75169647b144df85b88a038c /gnu/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp | |
| parent | tweak errno in previous (diff) | |
| download | wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.tar.xz wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.zip | |
Import LLVM 7.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp')
| -rw-r--r-- | gnu/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/gnu/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp b/gnu/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp index 04e6664c68d..edaa783398c 100644 --- a/gnu/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp +++ b/gnu/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp @@ -45,12 +45,12 @@ static Error loadSectionContribs(FixedStreamArray<ContribType> &Output, return Error::success(); } -DbiStream::DbiStream(PDBFile &File, std::unique_ptr<MappedBlockStream> Stream) - : Pdb(File), Stream(std::move(Stream)), Header(nullptr) {} +DbiStream::DbiStream(std::unique_ptr<BinaryStream> Stream) + : Stream(std::move(Stream)), Header(nullptr) {} DbiStream::~DbiStream() = default; -Error DbiStream::reload() { +Error DbiStream::reload(PDBFile *Pdb) { BinaryStreamReader Reader(*Stream); if (Stream->getLength() < sizeof(DbiStreamHeader)) @@ -123,11 +123,11 @@ Error DbiStream::reload() { if (auto EC = initializeSectionContributionData()) return EC; - if (auto EC = initializeSectionHeadersData()) + if (auto EC = initializeSectionHeadersData(Pdb)) return EC; if (auto EC = initializeSectionMapData()) return EC; - if (auto EC = initializeFpoRecords()) + if (auto EC = initializeFpoRecords(Pdb)) return EC; if (Reader.bytesRemaining() > 0) @@ -246,7 +246,10 @@ Error DbiStream::initializeSectionContributionData() { } // Initializes this->SectionHeaders. -Error DbiStream::initializeSectionHeadersData() { +Error DbiStream::initializeSectionHeadersData(PDBFile *Pdb) { + if (!Pdb) + return Error::success(); + if (DbgStreams.size() == 0) return Error::success(); @@ -254,11 +257,11 @@ Error DbiStream::initializeSectionHeadersData() { if (StreamNum == kInvalidStreamIndex) return Error::success(); - if (StreamNum >= Pdb.getNumStreams()) + if (StreamNum >= Pdb->getNumStreams()) return make_error<RawError>(raw_error_code::no_stream); auto SHS = MappedBlockStream::createIndexedStream( - Pdb.getMsfLayout(), Pdb.getMsfBuffer(), StreamNum, Pdb.getAllocator()); + Pdb->getMsfLayout(), Pdb->getMsfBuffer(), StreamNum, Pdb->getAllocator()); size_t StreamLen = SHS->getLength(); if (StreamLen % sizeof(object::coff_section)) @@ -276,7 +279,10 @@ Error DbiStream::initializeSectionHeadersData() { } // Initializes this->Fpos. -Error DbiStream::initializeFpoRecords() { +Error DbiStream::initializeFpoRecords(PDBFile *Pdb) { + if (!Pdb) + return Error::success(); + if (DbgStreams.size() == 0) return Error::success(); @@ -286,11 +292,11 @@ Error DbiStream::initializeFpoRecords() { if (StreamNum == kInvalidStreamIndex) return Error::success(); - if (StreamNum >= Pdb.getNumStreams()) + if (StreamNum >= Pdb->getNumStreams()) return make_error<RawError>(raw_error_code::no_stream); auto FS = MappedBlockStream::createIndexedStream( - Pdb.getMsfLayout(), Pdb.getMsfBuffer(), StreamNum, Pdb.getAllocator()); + Pdb->getMsfLayout(), Pdb->getMsfBuffer(), StreamNum, Pdb->getAllocator()); size_t StreamLen = FS->getLength(); if (StreamLen % sizeof(object::FpoData)) |
