[pdbutil] Add a command to dump the FPM.
Recently problems have been discovered in the way we write the FPM
(free page map). In order to fix this, we first need to establish
a baseline about what a correct FPM looks like using an MSVC
generated PDB, so that we can then make our own generated PDBs
match. And in order to do this, the dumper needs a mode where it
can dump an FPM so that we can write tests for it.
This patch adds a command to dump the FPM, as well as a test against
a known-good PDB.
llvm-svn: 309894
diff --git a/llvm/lib/DebugInfo/MSF/MSFCommon.cpp b/llvm/lib/DebugInfo/MSF/MSFCommon.cpp
index 1facf5e..484e184 100644
--- a/llvm/lib/DebugInfo/MSF/MSFCommon.cpp
+++ b/llvm/lib/DebugInfo/MSF/MSFCommon.cpp
@@ -59,3 +59,18 @@
return Error::success();
}
+
+MSFStreamLayout llvm::msf::getFpmStreamLayout(const MSFLayout &Msf) {
+ MSFStreamLayout FL;
+ uint32_t NumFpmIntervals = getNumFpmIntervals(Msf);
+ support::ulittle32_t FpmBlock = Msf.SB->FreeBlockMapBlock;
+ assert(FpmBlock == 1 || FpmBlock == 2);
+ while (NumFpmIntervals > 0) {
+ FL.Blocks.push_back(FpmBlock);
+ FpmBlock += msf::getFpmIntervalLength(Msf);
+ --NumFpmIntervals;
+ }
+ FL.Length = getFullFpmByteSize(Msf);
+
+ return FL;
+}