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

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 13:35:10 PDT 2016


zturner added inline comments.

================
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);
+
----------------
ruiu wrote:
> zturner wrote:
> > majnemer wrote:
> > > majnemer wrote:
> > > > majnemer wrote:
> > > > > zturner wrote:
> > > > > > majnemer wrote:
> > > > > > > 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
> > > > > > It doesn't span 2 pages.  But it's *either* page 1 or page 2.  Which one it is depends on the second field in the super block.  But whichever one it is, it's only that 1 page.  
> > > > > I don't think that's right:
> > > > > https://github.com/Microsoft/microsoft-pdb/blob/master/PDB/msf/msf.cpp#L172
> > > > Also:
> > > > https://github.com/Microsoft/microsoft-pdb/blob/master/PDB/msf/msf.cpp#L38
> > > Hmm, but there is also:
> > > > In the interest of the on-disk size of the file, the FPM has been split across the file at regular intervals, with new intervals introduced as needed.
> > > 
> > > https://github.com/Microsoft/microsoft-pdb/blob/master/PDB/msf/msf.cpp#L49
> > Yea, but read the very next line:
> > 
> > ```According to hdr.pnFpm, the first or the second free page map is valid.```
> > 
> > What I'm not sure about is this line:
> > 
> > ```In the interest of the on-disk size of the file, the FPM has been split across the file at regular intervals, with new intervals introduced as needed```
> At least, the test PDB file I was using contains a seemingly valid FPM in FPM2, and FPM1 contents doesn't seem to make sense.
Wait, I think I get it.  As you deduced, the maximum number of a single page of bits can represent is `BlockSize * 8`.  But the SuperBlock tells you exactly how many pages are in the file.  If the number of pages in the SuperBlock are more than the number that can be represented by a single page of bits, then there will be a page in the middle of the file that "continues" the Free Page Map.  It will probably be precisely the page with index `BlockSize * 8`


https://reviews.llvm.org/D22974





More information about the llvm-commits mailing list