[PATCH] D22308: [pdb] Introduce an MsfBuilder class for laying out PDB files

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 11:24:36 PDT 2016


zturner created this revision.
zturner added reviewers: ruiu, rnk, majnemer.
zturner added a subscriber: llvm-commits.

As we get further with writing PDB files, we run into the issue of needing to lay out the PDB file, generate a valid super block, and generate the directory and stream sizes array.  Previously this was easy because we we were just reading in a PDB, and writing exactly the same directory and super block out.  But now that we're trying to write only some of a particular stream, it means that the size of the stream we output is different from the size of the original stream.  This in turn leads to different number of pages being used, which means a different stream directory, and possibly even the stream directory itself using a different number of blocks as before.

So we introduce an `MsfBuilder` class here.  You create one, add a bunch of streams to it of the size you want, optionally giving it hints about what blocks you want a particular stream to occupy, and then it handles layout at the end.  A bunch of unit tests are added to verify functionality.

I separated this out from a larger patch which actually updates the rest of the codebase to use this, and with my other patch I have confirmed that this class does produce a valid Msf layout.

http://reviews.llvm.org/D22308

Files:
  include/llvm/DebugInfo/PDB/Raw/MsfBuilder.h
  include/llvm/DebugInfo/PDB/Raw/MsfCommon.h
  lib/DebugInfo/PDB/CMakeLists.txt
  lib/DebugInfo/PDB/Raw/MsfBuilder.cpp
  lib/DebugInfo/PDB/Raw/MsfCommon.cpp
  unittests/DebugInfo/PDB/CMakeLists.txt
  unittests/DebugInfo/PDB/ErrorChecking.h
  unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp
  unittests/DebugInfo/PDB/MsfBuilderTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22308.63830.patch
Type: text/x-patch
Size: 32061 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160713/b682a8fb/attachment-0001.bin>


More information about the llvm-commits mailing list