1 //===- PDBSymbolExe.cpp - ---------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" 11 #include "llvm/DebugInfo/PDB/PDBExtras.h" 12 #include "llvm/DebugInfo/PDB/PDBSymbol.h" 13 #include "llvm/DebugInfo/PDB/PDBSymbolExe.h" 14 #include "llvm/Support/ConvertUTF.h" 15 #include "llvm/Support/FileSystem.h" 16 #include "llvm/Support/raw_ostream.h" 17 #include <utility> 18 19 using namespace llvm; 20 21 PDBSymbolExe::PDBSymbolExe(const IPDBSession &PDBSession, 22 std::unique_ptr<IPDBRawSymbol> Symbol) 23 : PDBSymbol(PDBSession, std::move(Symbol)) {} 24 25 void PDBSymbolExe::dump(raw_ostream &OS, int Indent, 26 PDB_DumpLevel Level) const { 27 std::string FileName(getSymbolsFileName()); 28 29 OS << stream_indent(Indent) << "Summary for " << FileName << "\n"; 30 31 uint64_t FileSize = 0; 32 if (!llvm::sys::fs::file_size(FileName, FileSize)) 33 OS << stream_indent(Indent + 2) << "Size: " << FileSize << " bytes\n"; 34 else 35 OS << stream_indent(Indent + 2) << "Size: (Unable to obtain file size)\n"; 36 PDB_UniqueId Guid = getGuid(); 37 OS << stream_indent(Indent + 2) << "Guid: " << Guid << "\n"; 38 OS << stream_indent(Indent + 2) << "Age: " << getAge() << "\n"; 39 OS << stream_indent(Indent + 2) << "Attributes: "; 40 if (hasCTypes()) 41 OS << "HasCTypes "; 42 if (hasPrivateSymbols()) 43 OS << "HasPrivateSymbols "; 44 OS << "\n"; 45 46 TagStats Stats; 47 auto ChildrenEnum = getChildStats(Stats); 48 OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n"; 49 while (auto Child = ChildrenEnum->getNext()) { 50 Child->dump(OS, Indent + 4, PDB_DumpLevel::Normal); 51 OS << "\n"; 52 } 53 } 54