[PATCH] D22974: pdbdump: Dump Free Page Map contents.

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 13:25:19 PDT 2016


majnemer added a subscriber: majnemer.

================
Comment at: lib/DebugInfo/PDB/Raw/PDBFile.cpp:49-52
@@ -48,1 +48,6 @@
 
+// Returns a vector of used page indices, which is a complement of Free
+// Page Map contents. (The reason why we are returning a complement is
+// because otherwise the result would be large, as most pages are unused.)
+Expected<std::vector<uint32_t>> PDBFile::getUsedBlockList() const {
+  uint64_t Offset = ContainerLayout.SB->FreeBlockMapBlock * getBlockSize();
----------------
Would SparseBitVector be a more appropriate API to use?

================
Comment at: lib/DebugInfo/PDB/Raw/PDBFile.cpp:53-56
@@ +52,6 @@
+Expected<std::vector<uint32_t>> PDBFile::getUsedBlockList() const {
+  uint64_t Offset = ContainerLayout.SB->FreeBlockMapBlock * getBlockSize();
+  ArrayRef<uint8_t> Result;
+  if (auto EC = Buffer->readBytes(Offset, getBlockSize(), Result))
+    return std::move(EC);
+
----------------
This will only read a single block right?
If the block size was 4 KB, would that mean that the FPM can only account for 128 MB?
This seems small.

Microsoft's code suggests that the FPM could span two blocks:
https://github.com/Microsoft/microsoft-pdb/blob/master/PDB/msf/msf.cpp#L222


https://reviews.llvm.org/D22974





More information about the llvm-commits mailing list