diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-30 16:33:32 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-30 16:33:32 +0000 |
| commit | 51315c45ff5643a27f9c84b816db54ee870ba29b (patch) | |
| tree | 1d87443fa0e53d3e6b315ce25787e64be0906bf7 /contrib/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp | |
| parent | 6dfd050075216be8538ae375a22d30db72916f7e (diff) | |
| parent | eb11fae6d08f479c0799db45860a98af528fa6e7 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp')
| -rw-r--r-- | contrib/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/contrib/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp b/contrib/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp index 04e6664c68db..edaa783398ca 100644 --- a/contrib/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp +++ b/contrib/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)) |
