2015-02-08 08:29:29 +08:00
|
|
|
//===- PDBSymbolCompiland.cpp - compiland details --------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include <utility>
|
2015-02-11 06:43:25 +08:00
|
|
|
#include <vector>
|
2015-02-08 08:29:29 +08:00
|
|
|
|
|
|
|
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
|
2015-02-11 06:43:25 +08:00
|
|
|
#include "llvm/DebugInfo/PDB/IPDBSession.h"
|
|
|
|
#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
|
|
|
|
#include "llvm/DebugInfo/PDB/PDBExtras.h"
|
2015-02-08 08:29:29 +08:00
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
|
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
|
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
|
2015-02-11 06:43:25 +08:00
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h"
|
2015-02-08 08:29:29 +08:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2015-02-13 05:09:24 +08:00
|
|
|
#include "llvm/Support/Path.h"
|
2015-02-08 08:29:29 +08:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2015-02-09 06:53:53 +08:00
|
|
|
PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession,
|
2015-02-09 04:58:09 +08:00
|
|
|
std::unique_ptr<IPDBRawSymbol> Symbol)
|
|
|
|
: PDBSymbol(PDBSession, std::move(Symbol)) {}
|
2015-02-08 08:29:29 +08:00
|
|
|
|
2015-02-11 06:43:25 +08:00
|
|
|
void PDBSymbolCompiland::dump(raw_ostream &OS, int Indent,
|
|
|
|
PDB_DumpLevel Level) const {
|
2015-02-13 15:40:03 +08:00
|
|
|
if (Level == PDB_DumpLevel::Detailed) {
|
|
|
|
std::string FullName = getName();
|
|
|
|
StringRef Name = llvm::sys::path::filename(StringRef(FullName.c_str()));
|
2015-02-13 05:09:24 +08:00
|
|
|
|
2015-02-13 15:40:03 +08:00
|
|
|
OS.indent(Indent);
|
|
|
|
OS << "Compiland: " << Name << "\n";
|
2015-02-11 06:43:25 +08:00
|
|
|
|
2015-02-13 15:40:03 +08:00
|
|
|
std::string Source = getSourceFileName();
|
|
|
|
std::string Library = getLibraryName();
|
|
|
|
if (!Source.empty())
|
|
|
|
OS << stream_indent(Indent + 2) << "Source: " << this->getSourceFileName()
|
|
|
|
<< "\n";
|
|
|
|
if (!Library.empty())
|
|
|
|
OS << stream_indent(Indent + 2) << "Library: " << this->getLibraryName()
|
|
|
|
<< "\n";
|
2015-02-11 06:43:25 +08:00
|
|
|
|
2015-02-13 15:40:03 +08:00
|
|
|
TagStats Stats;
|
|
|
|
auto ChildrenEnum = getChildStats(Stats);
|
|
|
|
OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n";
|
|
|
|
if (Level >= PDB_DumpLevel::Detailed) {
|
|
|
|
while (auto Child = ChildrenEnum->getNext()) {
|
|
|
|
if (llvm::isa<PDBSymbolCompilandDetails>(*Child))
|
|
|
|
continue;
|
|
|
|
if (llvm::isa<PDBSymbolCompilandEnv>(*Child))
|
|
|
|
continue;
|
|
|
|
PDB_DumpLevel ChildLevel = (Level == PDB_DumpLevel::Detailed)
|
|
|
|
? PDB_DumpLevel::Normal
|
|
|
|
: PDB_DumpLevel::Compact;
|
|
|
|
Child->dump(OS, Indent + 4, ChildLevel);
|
|
|
|
OS << "\n";
|
|
|
|
}
|
2015-02-11 06:43:25 +08:00
|
|
|
}
|
|
|
|
|
2015-02-13 15:40:03 +08:00
|
|
|
auto DetailsEnum(findAllChildren<PDBSymbolCompilandDetails>());
|
|
|
|
if (auto CD = DetailsEnum->getNext()) {
|
|
|
|
VersionInfo FE;
|
|
|
|
VersionInfo BE;
|
|
|
|
CD->getFrontEndVersion(FE);
|
|
|
|
CD->getBackEndVersion(BE);
|
|
|
|
OS << stream_indent(Indent + 2) << "Compiler: " << CD->getCompilerName()
|
|
|
|
<< "\n";
|
|
|
|
OS << stream_indent(Indent + 2) << "Version: " << FE << ", " << BE
|
|
|
|
<< "\n";
|
2015-02-11 06:43:25 +08:00
|
|
|
|
2015-02-13 15:40:03 +08:00
|
|
|
OS << stream_indent(Indent + 2) << "Lang: " << CD->getLanguage() << "\n";
|
|
|
|
OS << stream_indent(Indent + 2) << "Attributes: ";
|
|
|
|
if (CD->hasDebugInfo())
|
|
|
|
OS << "DebugInfo ";
|
|
|
|
if (CD->isDataAligned())
|
|
|
|
OS << "DataAligned ";
|
|
|
|
if (CD->isLTCG())
|
|
|
|
OS << "LTCG ";
|
|
|
|
if (CD->hasSecurityChecks())
|
|
|
|
OS << "SecurityChecks ";
|
|
|
|
if (CD->isHotpatchable())
|
|
|
|
OS << "HotPatchable";
|
2015-02-11 06:43:25 +08:00
|
|
|
|
2015-02-13 15:40:03 +08:00
|
|
|
auto Files(Session.getSourceFilesForCompiland(*this));
|
|
|
|
OS << "\n";
|
2015-02-11 06:43:25 +08:00
|
|
|
OS << stream_indent(Indent + 2) << Files->getChildCount()
|
2015-02-13 15:40:03 +08:00
|
|
|
<< " source files";
|
|
|
|
}
|
|
|
|
uint32_t Count = DetailsEnum->getChildCount();
|
|
|
|
if (Count > 1) {
|
|
|
|
OS << "\n";
|
|
|
|
OS << stream_indent(Indent + 2) << "(" << Count - 1 << " more omitted)";
|
2015-02-11 06:43:25 +08:00
|
|
|
}
|
2015-02-13 15:40:03 +08:00
|
|
|
} else {
|
|
|
|
std::string FullName = getName();
|
|
|
|
OS << stream_indent(Indent) << "Compiland: " << FullName;
|
2015-02-11 06:43:25 +08:00
|
|
|
}
|
2015-02-08 08:29:29 +08:00
|
|
|
}
|