コード例 #1
0
ファイル: llvm-pdbdump.cpp プロジェクト: wgbwgb/llvm
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();
  }
}
コード例 #2
0
ファイル: llvm-pdbdump.cpp プロジェクト: wgbwgb/llvm
static void dumpStreamBlocks(ScopedPrinter &P, PDBFile &File) {
  if (!opts::DumpStreamBlocks)
    return;

  ListScope L(P, "StreamBlocks");
  uint32_t StreamCount = File.getNumStreams();
  for (uint32_t StreamIdx = 0; StreamIdx < StreamCount; ++StreamIdx) {
    std::string Name("Stream ");
    Name += to_string(StreamIdx);
    auto StreamBlocks = File.getStreamBlockList(StreamIdx);
    P.printList(Name, StreamBlocks);
  }
}