Exemplo n.º 1
0
static void dumpNamedStream(ScopedPrinter &P, PDBFile &File, StringRef Stream) {
  InfoStream &IS = File.getPDBInfoStream();
  uint32_t NameStreamIndex = IS.getNamedStreamIndex(Stream);

  if (NameStreamIndex != 0) {
    std::string Name("Stream '");
    Name += Stream;
    Name += "'";
    DictScope D(P, Name);
    P.printNumber("Index", NameStreamIndex);

    MappedBlockStream NameStream(NameStreamIndex, File);
    StreamReader Reader(NameStream);

    NameHashTable NameTable;
    NameTable.load(Reader);
    P.printHex("Signature", NameTable.getSignature());
    P.printNumber("Version", NameTable.getHashVersion());
    P.printNumber("Name Count", NameTable.getNameCount());
    ListScope L(P, "Names");
    for (uint32_t ID : NameTable.name_ids()) {
      StringRef Str = NameTable.getStringForID(ID);
      if (!Str.empty())
        P.printString(Str);
    }
  }
}
Exemplo n.º 2
0
void AppleAcceleratorTable::Header::dump(ScopedPrinter &W) const {
  DictScope HeaderScope(W, "Header");
  W.printHex("Magic", Magic);
  W.printHex("Version", Version);
  W.printHex("Hash function", HashFunction);
  W.printNumber("Bucket count", BucketCount);
  W.printNumber("Hashes count", HashCount);
  W.printNumber("HeaderData length", HeaderDataLength);
}
Exemplo n.º 3
0
static void dumpInfoStream(ScopedPrinter &P, PDBFile &File) {
  InfoStream &IS = File.getPDBInfoStream();

  DictScope D(P, "PDB Stream");
  P.printNumber("Version", IS.getVersion());
  P.printHex("Signature", IS.getSignature());
  P.printNumber("Age", IS.getAge());
  P.printObject("Guid", IS.getGuid());
}
Exemplo n.º 4
0
static void dumpTpiHash(ScopedPrinter &P, TpiStream &Tpi) {
  if (!opts::raw::DumpTpiHash)
    return;
  DictScope DD(P, "Hash");
  P.printNumber("Number of Hash Buckets", Tpi.NumHashBuckets());
  P.printNumber("Hash Key Size", Tpi.getHashKeySize());
  P.printList("Values", Tpi.getHashValues());
  P.printList("Type Index Offsets", Tpi.getTypeIndexOffsets(),
              printTypeIndexOffset);
  P.printList("Hash Adjustments", Tpi.getHashAdjustments(),
              printTypeIndexOffset);
}
Exemplo n.º 5
0
static void dumpTpiStream(ScopedPrinter &P, PDBFile &File) {
  if (!opts::DumpTypeStream)
    return;

  DictScope D(P, "Type Info Stream");

  TpiStream &Tpi = File.getPDBTpiStream();
  P.printNumber("TPI Version", Tpi.getTpiVersion());
  P.printNumber("Record count", Tpi.NumTypeRecords());

  if (!opts::DumpTpiRecordBytes)
    return;

  ListScope L(P, "Records");
  for (auto &Type : Tpi.types()) {
    DictScope DD(P, "");
    P.printHex("Kind", unsigned(Type.Leaf));
    P.printBinaryBlock("Bytes", Type.LeafData);
  }
}
Exemplo n.º 6
0
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));
  }
}
Exemplo n.º 7
0
static void dumpFileHeaders(ScopedPrinter &P, PDBFile &File) {
  if (!opts::DumpHeaders)
    return;
  DictScope D(P, "FileHeaders");
  P.printNumber("BlockSize", File.getBlockSize());
  P.printNumber("Unknown0", File.getUnknown0());
  P.printNumber("NumBlocks", File.getBlockCount());
  P.printNumber("NumDirectoryBytes", File.getNumDirectoryBytes());
  P.printNumber("Unknown1", File.getUnknown1());
  P.printNumber("BlockMapAddr", File.getBlockMapIndex());
  P.printNumber("NumDirectoryBlocks", File.getNumDirectoryBlocks());
  P.printNumber("BlockMapOffset", File.getBlockMapOffset());

  // The directory is not contiguous.  Instead, the block map contains a
  // contiguous list of block numbers whose contents, when concatenated in
  // order, make up the directory.
  P.printList("DirectoryBlocks", File.getDirectoryBlockArray());
  P.printNumber("NumStreams", File.getNumStreams());
}
Exemplo n.º 8
0
void DWARFDebugNames::Header::dump(ScopedPrinter &W) const {
  DictScope HeaderScope(W, "Header");
  W.printHex("Length", UnitLength);
  W.printNumber("Version", Version);
  W.printHex("Padding", Padding);
  W.printNumber("CU count", CompUnitCount);
  W.printNumber("Local TU count", LocalTypeUnitCount);
  W.printNumber("Foreign TU count", ForeignTypeUnitCount);
  W.printNumber("Bucket count", BucketCount);
  W.printNumber("Name count", NameCount);
  W.printHex("Abbreviations table size", AbbrevTableSize);
  W.startLine() << "Augmentation: '" << AugmentationString << "'\n";
}
Exemplo n.º 9
0
static void dumpDbiStream(ScopedPrinter &P, PDBFile &File) {
  DbiStream &DS = File.getPDBDbiStream();

  DictScope D(P, "DBI Stream");
  P.printNumber("Dbi Version", DS.getDbiVersion());
  P.printNumber("Age", DS.getAge());
  P.printBoolean("Incremental Linking", DS.isIncrementallyLinked());
  P.printBoolean("Has CTypes", DS.hasCTypes());
  P.printBoolean("Is Stripped", DS.isStripped());
  P.printObject("Machine Type", DS.getMachineType());
  P.printNumber("Number of Symbols", DS.getNumberOfSymbols());

  uint16_t Major = DS.getBuildMajorVersion();
  uint16_t Minor = DS.getBuildMinorVersion();
  P.printVersion("Toolchain Version", Major, Minor);

  std::string DllName;
  raw_string_ostream DllStream(DllName);
  DllStream << "mspdb" << Major << Minor << ".dll version";
  DllStream.flush();
  P.printVersion(DllName, Major, Minor, DS.getPdbDllVersion());

  ListScope L(P, "Modules");
  for (auto &Modi : DS.modules()) {
    DictScope DD(P);
    P.printString("Name", Modi.Info.getModuleName());
    P.printNumber("Debug Stream Index", Modi.Info.getModuleStreamIndex());
    P.printString("Object File Name", Modi.Info.getObjFileName());
    P.printNumber("Num Files", Modi.Info.getNumberOfFiles());
    P.printNumber("Source File Name Idx", Modi.Info.getSourceFileNameIndex());
    P.printNumber("Pdb File Name Idx", Modi.Info.getPdbFilePathNameIndex());
    P.printNumber("Line Info Byte Size", Modi.Info.getLineInfoByteSize());
    P.printNumber("C13 Line Info Byte Size",
                  Modi.Info.getC13LineInfoByteSize());
    P.printNumber("Symbol Byte Size", Modi.Info.getSymbolDebugInfoByteSize());
    P.printNumber("Type Server Index", Modi.Info.getTypeServerIndex());
    P.printBoolean("Has EC Info", Modi.Info.hasECInfo());
    std::string FileListName =
        to_string(Modi.SourceFiles.size()) + " Contributing Source Files";
    ListScope LL(P, FileListName);
    for (auto File : Modi.SourceFiles)
      P.printString(File);
  }
}