blob: ddf6efc846ff33e7eb9124a805c2145431336612 [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
10#include <utility>
11
Zachary Turnera5549172015-02-10 22:43:25 +000012#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
13#include "llvm/DebugInfo/PDB/PDBExtras.h"
Zachary Turner21473f72015-02-08 00:29:29 +000014#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 Turner21473f72015-02-08 00:29:29 +000020using namespace llvm;
21
Zachary Turner98571ed2015-02-08 22:53:53 +000022PDBSymbolExe::PDBSymbolExe(const IPDBSession &PDBSession,
Zachary Turnerbae16b32015-02-08 20:58:09 +000023 std::unique_ptr<IPDBRawSymbol> Symbol)
24 : PDBSymbol(PDBSession, std::move(Symbol)) {}
Zachary Turner21473f72015-02-08 00:29:29 +000025
Zachary Turnera5549172015-02-10 22:43:25 +000026void PDBSymbolExe::dump(raw_ostream &OS, int Indent,
27 PDB_DumpLevel Level) const {
28 std::string FileName(getSymbolsFileName());
29
Zachary Turnera952c492015-02-13 07:40:03 +000030 OS << stream_indent(Indent) << "Summary for " << FileName << "\n";
Zachary Turnera5549172015-02-10 22:43:25 +000031
Zachary Turnera5549172015-02-10 22:43:25 +000032 uint64_t FileSize = 0;
33 if (!llvm::sys::fs::file_size(FileName, FileSize))
Zachary Turnera952c492015-02-13 07:40:03 +000034 OS << stream_indent(Indent + 2) << "Size: " << FileSize << " bytes\n";
Zachary Turnera5549172015-02-10 22:43:25 +000035 else
Zachary Turnera952c492015-02-13 07:40:03 +000036 OS << stream_indent(Indent + 2) << "Size: (Unable to obtain file size)\n";
Zachary Turnera5549172015-02-10 22:43:25 +000037 PDB_UniqueId Guid = getGuid();
Zachary Turnera952c492015-02-13 07:40:03 +000038 OS << stream_indent(Indent + 2) << "Guid: " << Guid << "\n";
39 OS << stream_indent(Indent + 2) << "Age: " << getAge() << "\n";
40 OS << stream_indent(Indent + 2) << "Attributes: ";
Zachary Turnera5549172015-02-10 22:43:25 +000041 if (hasCTypes())
42 OS << "HasCTypes ";
43 if (hasPrivateSymbols())
44 OS << "HasPrivateSymbols ";
45 OS << "\n";
Zachary Turner2a5c0a22015-02-13 01:23:51 +000046
47 TagStats Stats;
48 auto ChildrenEnum = getChildStats(Stats);
49 OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n";
50 while (auto Child = ChildrenEnum->getNext()) {
Zachary Turnera952c492015-02-13 07:40:03 +000051 Child->dump(OS, Indent + 4, PDB_DumpLevel::Normal);
52 OS << "\n";
Zachary Turner2a5c0a22015-02-13 01:23:51 +000053 }
Zachary Turner21473f72015-02-08 00:29:29 +000054}