static void dumpStreamData(ScopedPrinter &P, PDBFile &File) { uint32_t StreamCount = File.getNumStreams(); StringRef DumpStreamStr = opts::DumpStreamData; uint32_t DumpStreamNum; if (DumpStreamStr.getAsInteger(/*Radix=*/0U, DumpStreamNum) || DumpStreamNum >= StreamCount) return; uint32_t StreamBytesRead = 0; uint32_t StreamSize = File.getStreamByteSize(DumpStreamNum); auto StreamBlocks = File.getStreamBlockList(DumpStreamNum); for (uint32_t StreamBlockAddr : StreamBlocks) { uint32_t BytesLeftToReadInStream = StreamSize - StreamBytesRead; if (BytesLeftToReadInStream == 0) break; uint32_t BytesToReadInBlock = std::min( BytesLeftToReadInStream, static_cast<uint32_t>(File.getBlockSize())); auto StreamBlockData = File.getBlockData(StreamBlockAddr, BytesToReadInBlock); outs() << StreamBlockData; StreamBytesRead += StreamBlockData.size(); } }
static void dumpStreamSizes(ScopedPrinter &P, PDBFile &File) { if (!opts::DumpStreamSizes) return; ListScope L(P, "StreamSizes"); uint32_t StreamCount = File.getNumStreams(); for (uint32_t StreamIdx = 0; StreamIdx < StreamCount; ++StreamIdx) { std::string Name("Stream "); Name += to_string(StreamIdx); P.printNumber(Name, File.getStreamByteSize(StreamIdx)); } }