aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
index ddc8102..533242f 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
@@ -104,6 +104,7 @@ Error PDBFile::setBlockData(uint32_t BlockIndex, uint32_t Offset,
Error PDBFile::parseFileHeaders() {
StreamReader Reader(*Buffer);
+ // Initialize SB.
const msf::SuperBlock *SB = nullptr;
if (auto EC = Reader.readObject(SB)) {
consumeError(std::move(EC));
@@ -119,6 +120,16 @@ Error PDBFile::parseFileHeaders() {
"File size is not a multiple of block size");
ContainerLayout.SB = SB;
+ // Initialize Free Page Map.
+ ContainerLayout.FreePageMap.resize(getBlockSize() * 8);
+ uint64_t FPMOffset = SB->FreeBlockMapBlock * getBlockSize();
+ ArrayRef<uint8_t> FPMBlock;
+ if (auto EC = Buffer->readBytes(FPMOffset, getBlockSize(), FPMBlock))
+ return EC;
+ for (uint32_t I = 0, E = getBlockSize() * 8; I != E; ++I)
+ if (FPMBlock[I / 8] & (1 << (I % 8)))
+ ContainerLayout.FreePageMap[I] = true;
+
Reader.setOffset(getBlockMapOffset());
if (auto EC = Reader.readArray(ContainerLayout.DirectoryBlocks,
getNumDirectoryBlocks()))