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.
The inconsistent capitalization of initialisms seems unfortunate. PDB but Msf.