aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-02-10 22:43:25 +0000
committerZachary Turner <zturner@google.com>2015-02-10 22:43:25 +0000
commita5549178f12d3d4dad72e1ab8efbb6fc9ed0d2c9 (patch)
tree9012681968824b47f3c3f208cd91fa82cf48aa5d /llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
parentca19485f08fc41bb7de5be925c06735937b3ea50 (diff)
downloadllvm-a5549178f12d3d4dad72e1ab8efbb6fc9ed0d2c9.zip
llvm-a5549178f12d3d4dad72e1ab8efbb6fc9ed0d2c9.tar.gz
llvm-a5549178f12d3d4dad72e1ab8efbb6fc9ed0d2c9.tar.bz2
Rewrite llvm-pdbdump in terms of LLVMDebugInfoPDB.
This makes llvm-pdbdump available on all platforms, although it will currently fail to create a dumper if there is no PDB reader implementation for the current platform. It implements dumping of compilands and children, which is less information than was previously available, but it has to be rewritten from scratch using the new set of interfaces, so the rest of the functionality will be added back in subsequent commits. llvm-svn: 228755
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp75
1 files changed, 74 insertions, 1 deletions
diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
index 02a48fd..13f6ccc 100644
--- a/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
@@ -8,11 +8,16 @@
//===----------------------------------------------------------------------===//
#include <utility>
+#include <vector>
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -21,5 +26,73 @@ PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession,
std::unique_ptr<IPDBRawSymbol> Symbol)
: PDBSymbol(PDBSession, std::move(Symbol)) {}
-void PDBSymbolCompiland::dump(llvm::raw_ostream &OS) const {
+void PDBSymbolCompiland::dump(raw_ostream &OS, int Indent,
+ PDB_DumpLevel Level) const {
+ std::string Name = getName();
+ OS << "---- [IDX: " << getSymIndexId() << "] Compiland: " << Name
+ << " ----\n";
+
+ 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";
+
+ TagStats Stats;
+ auto ChildrenEnum = getChildStats(Stats);
+ OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n";
+ if (Level >= PDB_DumpLevel::Normal) {
+ while (auto Child = ChildrenEnum->getNext()) {
+ if (llvm::isa<PDBSymbolCompilandDetails>(*Child))
+ continue;
+ if (llvm::isa<PDBSymbolCompilandEnv>(*Child))
+ continue;
+ Child->dump(OS, Indent + 4, PDB_DumpLevel::Compact);
+ }
+ }
+
+ std::unique_ptr<IPDBEnumSymbols> DetailsEnum(
+ findChildren(PDB_SymType::CompilandDetails));
+ if (auto DetailsPtr = DetailsEnum->getNext()) {
+ const auto *CD = dyn_cast<PDBSymbolCompilandDetails>(DetailsPtr.get());
+ assert(CD && "We only asked for compilands, but got something else!");
+ 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";
+
+ 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";
+
+ OS << "\n";
+ auto Files(Session.getSourceFilesForCompiland(*this));
+ if (Level >= PDB_DumpLevel::Detailed) {
+ OS << stream_indent(Indent + 2) << Files->getChildCount()
+ << " source files:\n";
+ while (auto File = Files->getNext())
+ File->dump(OS, Indent + 4, PDB_DumpLevel::Compact);
+ } else {
+ OS << stream_indent(Indent + 2) << Files->getChildCount()
+ << " source files\n";
+ }
+ }
+ uint32_t Count = DetailsEnum->getChildCount();
+ if (Count > 1)
+ OS << stream_indent(Indent + 2) << "(" << Count - 1 << " more omitted)\n";
}