Previously, there is no way to create a stream other than
pre-defined special stream such as DBI or IPI. This patch
adds a new method, addStream, to add a stream of arbitrary
bytes to a PDB file. The new function takes a byte array
and returns the index of the new stream.
Details
Diff Detail
- Build Status
Buildable 235 Build 235: arc lint + arc unit
Event Timeline
- rename PDBFileBuilder::addStream to addDbgStream
- make addDbgStream to set the directory entry for a new debug stream.
include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h | ||
---|---|---|
97–98 | I believe these should be initialized to kInvalidStreamIndex. | |
97–99 | I wonder if this could just be a llvm::SmallVector<ArrayRef<uint8_t>, DbgHeaderType::Max>. This way you don't need one array which indexes into another array, but rather you just have one array altogether that contains all the data. | |
lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp | ||
239–242 | Here you will need to loop through the various optional debug streams and call setStreamSize() on each one. | |
288–289 | Here you should check if Idx == kInvalidStreamIndex, and continue if so. | |
290 | Can you use a different variable name here? This Writer shadows the previous Writer, which could be confusing. Maybe calling it DbgStreamWriter. |
include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h | ||
---|---|---|
97–99 | We need to distinguish an empty stream from nonexistent stream, so we need to store the stream number somewhere. I defined a new class for that purpose. | |
lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp | ||
239–242 | I don't think so. We create a new stream like this auto ExpectedIndex = Msf.addStream(Data.size()); and because the size will never change, we don't need to adjust the size afterwards. |
lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp | ||
---|---|---|
49 | I think we shouldn't call addStream here. Suppose someone called addDbgStream more than once for the same value of Type. Then you would end up with unreferenced streams in the file. Maybe instead we can just store the ArrayRef, overwriting any previous value of the ArrayRef that was there before. Then in finalizeMsfLayout we can add all the streams. This way everything is semantically "atomic". No modification to the underlying file happens until you call finalize(), so you can do whatever you want until then without risk of messing anything up. | |
239–242 | Ahh, I didn't see that before. I will go back and comment up there. |
lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp | ||
---|---|---|
49 | How about this? I think this is atomic because we check everything that can fail before calling addStream in this function. |
I believe these should be initialized to kInvalidStreamIndex.