Zachary Turner | 21473f7 | 2015-02-08 00:29:29 +0000 | [diff] [blame] | 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 <utility> |
| 11 | |
Zachary Turner | a554917 | 2015-02-10 22:43:25 +0000 | [diff] [blame^] | 12 | #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" |
| 13 | #include "llvm/DebugInfo/PDB/PDBExtras.h" |
Zachary Turner | 21473f7 | 2015-02-08 00:29:29 +0000 | [diff] [blame] | 14 | #include "llvm/DebugInfo/PDB/PDBSymbol.h" |
| 15 | #include "llvm/DebugInfo/PDB/PDBSymbolExe.h" |
| 16 | #include "llvm/Support/ConvertUTF.h" |
| 17 | #include "llvm/Support/FileSystem.h" |
| 18 | #include "llvm/Support/raw_ostream.h" |
| 19 | |
Zachary Turner | 21473f7 | 2015-02-08 00:29:29 +0000 | [diff] [blame] | 20 | using namespace llvm; |
| 21 | |
Zachary Turner | 98571ed | 2015-02-08 22:53:53 +0000 | [diff] [blame] | 22 | PDBSymbolExe::PDBSymbolExe(const IPDBSession &PDBSession, |
Zachary Turner | bae16b3 | 2015-02-08 20:58:09 +0000 | [diff] [blame] | 23 | std::unique_ptr<IPDBRawSymbol> Symbol) |
| 24 | : PDBSymbol(PDBSession, std::move(Symbol)) {} |
Zachary Turner | 21473f7 | 2015-02-08 00:29:29 +0000 | [diff] [blame] | 25 | |
Zachary Turner | a554917 | 2015-02-10 22:43:25 +0000 | [diff] [blame^] | 26 | void PDBSymbolExe::dump(raw_ostream &OS, int Indent, |
| 27 | PDB_DumpLevel Level) const { |
| 28 | std::string FileName(getSymbolsFileName()); |
| 29 | |
| 30 | OS << "Summary for " << FileName << "\n"; |
| 31 | |
| 32 | TagStats Stats; |
| 33 | auto ChildrenEnum = getChildStats(Stats); |
| 34 | OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n"; |
| 35 | |
| 36 | uint64_t FileSize = 0; |
| 37 | if (!llvm::sys::fs::file_size(FileName, FileSize)) |
| 38 | OS << " Size: " << FileSize << " bytes\n"; |
| 39 | else |
| 40 | OS << " Size: (Unable to obtain file size)\n"; |
| 41 | PDB_UniqueId Guid = getGuid(); |
| 42 | OS << " Guid: " << Guid << "\n"; |
| 43 | OS << " Age: " << getAge() << "\n"; |
| 44 | OS << " Attributes: "; |
| 45 | if (hasCTypes()) |
| 46 | OS << "HasCTypes "; |
| 47 | if (hasPrivateSymbols()) |
| 48 | OS << "HasPrivateSymbols "; |
| 49 | OS << "\n"; |
Zachary Turner | 21473f7 | 2015-02-08 00:29:29 +0000 | [diff] [blame] | 50 | } |