summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Raw/DbiStream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/DbiStream.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/DbiStream.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/DbiStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/DbiStream.cpp
index e79d6572be1..b1c571bf78c 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/DbiStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/DbiStream.cpp
@@ -186,9 +186,10 @@ Error DbiStream::reload() {
return EC;
if (auto EC = initializeSectionMapData())
return EC;
-
if (auto EC = initializeFileInfo())
return EC;
+ if (auto EC = initializeFpoRecords())
+ return EC;
if (Reader.bytesRemaining() > 0)
return make_error<RawError>(raw_error_code::corrupt_file,
@@ -252,6 +253,10 @@ DbiStream::getSectionHeaders() {
return SectionHeaders;
}
+codeview::FixedStreamArray<object::FpoData> DbiStream::getFpoRecords() {
+ return FpoRecords;
+}
+
ArrayRef<ModuleInfoEx> DbiStream::modules() const { return ModuleInfos; }
codeview::FixedStreamArray<SecMapEntry> DbiStream::getSectionMap() const {
return SectionMap;
@@ -300,6 +305,24 @@ Error DbiStream::initializeSectionHeadersData() {
return Error::success();
}
+// Initializes this->Fpos.
+Error DbiStream::initializeFpoRecords() {
+ uint32_t StreamNum = getDebugStreamIndex(DbgHeaderType::NewFPO);
+ FpoStream.reset(new MappedBlockStream(StreamNum, Pdb));
+
+ size_t StreamLen = FpoStream->getLength();
+ if (StreamLen % sizeof(object::FpoData))
+ return make_error<RawError>(raw_error_code::corrupt_file,
+ "Corrupted New FPO stream.");
+
+ size_t NumRecords = StreamLen / sizeof(object::FpoData);
+ codeview::StreamReader Reader(*FpoStream);
+ if (auto EC = Reader.readArray(FpoRecords, NumRecords))
+ return make_error<RawError>(raw_error_code::corrupt_file,
+ "Corrupted New FPO stream.");
+ return Error::success();
+}
+
Error DbiStream::initializeSectionMapData() {
StreamReader SMReader(SecMapSubstream);
const SecMapHeader *Header;
OpenPOWER on IntegriCloud