aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2016-07-29 21:38:00 +0000
committerRui Ueyama <ruiu@google.com>2016-07-29 21:38:00 +0000
commit7a5cdc6225b9dec81d1e696c7904ed61d541b48d (patch)
treeaf487d899585f2a2ad0eca419417db241118983a /llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
parent1ed39291a5e87082461cf6c93b7516ccd0f20c96 (diff)
downloadllvm-7a5cdc6225b9dec81d1e696c7904ed61d541b48d.zip
llvm-7a5cdc6225b9dec81d1e696c7904ed61d541b48d.tar.gz
llvm-7a5cdc6225b9dec81d1e696c7904ed61d541b48d.tar.bz2
pdbdump: Dump Free Page Map contents.
Differential Revision: https://reviews.llvm.org/D22974 llvm-svn: 277216
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()))