blob: 69f928415f1c52ce525136dc23610b3d393a7e5e [file] [log] [blame]
Zachary Turner21473f72015-02-08 00:29:29 +00001//===- 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
Zachary Turnera5549172015-02-10 22:43:25 +000010#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
11#include "llvm/DebugInfo/PDB/PDBExtras.h"
Zachary Turner21473f72015-02-08 00:29:29 +000012#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"
Chandler Carruth71f308a2015-02-13 09:09:03 +000017#include <utility>
Zachary Turner21473f72015-02-08 00:29:29 +000018
Zachary Turner21473f72015-02-08 00:29:29 +000019using namespace llvm;
20
Zachary Turner98571ed2015-02-08 22:53:53 +000021PDBSymbolExe::PDBSymbolExe(const IPDBSession &PDBSession,
Zachary Turnerbae16b32015-02-08 20:58:09 +000022 std::unique_ptr<IPDBRawSymbol> Symbol)
23 : PDBSymbol(PDBSession, std::move(Symbol)) {}
Zachary Turner21473f72015-02-08 00:29:29 +000024
Zachary Turnera5549172015-02-10 22:43:25 +000025void PDBSymbolExe::dump(raw_ostream &OS, int Indent,
26 PDB_DumpLevel Level) const {
27 std::string FileName(getSymbolsFileName());
28
Zachary Turnera952c492015-02-13 07:40:03 +000029 OS << stream_indent(Indent) << "Summary for " << FileName << "\n";
Zachary Turnera5549172015-02-10 22:43:25 +000030
Zachary Turnera5549172015-02-10 22:43:25 +000031 uint64_t FileSize = 0;
32 if (!llvm::sys::fs::file_size(FileName, FileSize))
Zachary Turnera952c492015-02-13 07:40:03 +000033 OS << stream_indent(Indent + 2) << "Size: " << FileSize << " bytes\n";
Zachary Turnera5549172015-02-10 22:43:25 +000034 else
Zachary Turnera952c492015-02-13 07:40:03 +000035 OS << stream_indent(Indent + 2) << "Size: (Unable to obtain file size)\n";
Zachary Turnera5549172015-02-10 22:43:25 +000036 PDB_UniqueId Guid = getGuid();
Zachary Turnera952c492015-02-13 07:40:03 +000037 OS << stream_indent(Indent + 2) << "Guid: " << Guid << "\n";
38 OS << stream_indent(Indent + 2) << "Age: " << getAge() << "\n";
39 OS << stream_indent(Indent + 2) << "Attributes: ";
Zachary Turnera5549172015-02-10 22:43:25 +000040 if (hasCTypes())
41 OS << "HasCTypes ";
42 if (hasPrivateSymbols())
43 OS << "HasPrivateSymbols ";
44 OS << "\n";
Zachary Turner2a5c0a22015-02-13 01:23:51 +000045
46 TagStats Stats;
47 auto ChildrenEnum = getChildStats(Stats);
48 OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n";
49 while (auto Child = ChildrenEnum->getNext()) {
Zachary Turnera952c492015-02-13 07:40:03 +000050 Child->dump(OS, Indent + 4, PDB_DumpLevel::Normal);
51 OS << "\n";
Zachary Turner2a5c0a22015-02-13 01:23:51 +000052 }
Zachary Turner21473f72015-02-08 00:29:29 +000053}