mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-14 06:37:33 +00:00
llvm-pdbdump: Add more comprehensive dumping of symbol types.
In particular this patch adds the ability to dump complete function signature information including argument types as correctly formatted strings. A side effect of this is that almost all symbol and meta types are now formatted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229076 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6ffd7173f2
commit
eb95a535aa
include/llvm/DebugInfo/PDB
lib/DebugInfo/PDB
DIA
PDBExtras.cppPDBSymbolCompiland.cppPDBSymbolData.cppPDBSymbolExe.cppPDBSymbolFunc.cppPDBSymbolLabel.cppPDBSymbolPublicSymbol.cppPDBSymbolThunk.cppPDBSymbolTypeArray.cppPDBSymbolTypeBaseClass.cppPDBSymbolTypeBuiltin.cppPDBSymbolTypeEnum.cppPDBSymbolTypeFunctionArg.cppPDBSymbolTypeFunctionSig.cppPDBSymbolTypePointer.cppPDBSymbolTypeTypedef.cppPDBSymbolTypeUDT.cppPDBSymbolTypeVTable.cpptools/llvm-pdbdump
@ -30,6 +30,19 @@ public:
|
||||
virtual std::unique_ptr<PDBSymbolExe> getGlobalScope() const = 0;
|
||||
virtual std::unique_ptr<PDBSymbol> getSymbolById(uint32_t SymbolId) const = 0;
|
||||
|
||||
template <typename T>
|
||||
std::unique_ptr<T> getConcreteSymbolById(uint32_t SymbolId) const {
|
||||
auto Symbol(getSymbolById(SymbolId));
|
||||
if (!Symbol)
|
||||
return nullptr;
|
||||
|
||||
T *ConcreteSymbol = dyn_cast<T>(Symbol.get());
|
||||
if (!ConcreteSymbol)
|
||||
return nullptr;
|
||||
Symbol.release();
|
||||
return std::unique_ptr<T>(ConcreteSymbol);
|
||||
}
|
||||
|
||||
virtual std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const = 0;
|
||||
virtual std::unique_ptr<IPDBEnumSourceFiles>
|
||||
getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const = 0;
|
||||
|
@ -26,6 +26,7 @@ struct stream_indent {
|
||||
raw_ostream &operator<<(raw_ostream &OS, const stream_indent &Indent);
|
||||
|
||||
raw_ostream &operator<<(raw_ostream &OS, const PDB_VariantType &Value);
|
||||
raw_ostream &operator<<(raw_ostream &OS, const PDB_CallingConv &Conv);
|
||||
raw_ostream &operator<<(raw_ostream &OS, const PDB_DataKind &Data);
|
||||
raw_ostream &operator<<(raw_ostream &OS, const PDB_RegisterId &Reg);
|
||||
raw_ostream &operator<<(raw_ostream &OS, const PDB_LocType &Loc);
|
||||
@ -33,6 +34,7 @@ raw_ostream &operator<<(raw_ostream &OS, const PDB_ThunkOrdinal &Thunk);
|
||||
raw_ostream &operator<<(raw_ostream &OS, const PDB_Checksum &Checksum);
|
||||
raw_ostream &operator<<(raw_ostream &OS, const PDB_Lang &Lang);
|
||||
raw_ostream &operator<<(raw_ostream &OS, const PDB_SymType &Tag);
|
||||
raw_ostream &operator<<(raw_ostream &OS, const PDB_BuiltinType &Type);
|
||||
raw_ostream &operator<<(raw_ostream &OS, const PDB_UniqueId &Id);
|
||||
|
||||
raw_ostream &operator<<(raw_ostream &OS, const Variant &Value);
|
||||
|
@ -11,7 +11,6 @@
|
||||
#define LLVM_DEBUGINFO_PDB_PDBSYMBOLUNKNOWN_H
|
||||
|
||||
#include "PDBSymbol.h"
|
||||
#include "PDBTypes.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
|
@ -190,7 +190,7 @@ void DIARawSymbol::dump(raw_ostream &OS, int Indent,
|
||||
RAW_METHOD_DUMP(OS, get_baseDataOffset)
|
||||
RAW_METHOD_DUMP(OS, get_baseDataSlot)
|
||||
RAW_METHOD_DUMP(OS, get_baseSymbolId)
|
||||
RAW_METHOD_DUMP(OS, get_builtInKind)
|
||||
RAW_METHOD_DUMP(OS, get_baseType)
|
||||
RAW_METHOD_DUMP(OS, get_bitPosition)
|
||||
RAW_METHOD_DUMP(OS, get_callingConvention)
|
||||
RAW_METHOD_DUMP(OS, get_classParentId)
|
||||
@ -457,8 +457,8 @@ uint32_t DIARawSymbol::getBaseSymbolId() const {
|
||||
}
|
||||
|
||||
PDB_BuiltinType DIARawSymbol::getBuiltinType() const {
|
||||
return PrivateGetDIAValue<DWORD, PDB_BuiltinType>(
|
||||
Symbol, &IDiaSymbol::get_builtInKind);
|
||||
return PrivateGetDIAValue<DWORD, PDB_BuiltinType>(Symbol,
|
||||
&IDiaSymbol::get_baseType);
|
||||
}
|
||||
|
||||
uint32_t DIARawSymbol::getBitPosition() const {
|
||||
|
@ -44,6 +44,41 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_VariantType &Type) {
|
||||
return OS;
|
||||
}
|
||||
|
||||
raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_CallingConv &Conv) {
|
||||
OS << "__";
|
||||
switch (Conv) {
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearCdecl, "cdecl", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarCdecl, "cdecl", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearPascal, "pascal", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarPascal, "pascal", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearFastcall, "fastcall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarFastcall, "fastcall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Skipped, "skippedcall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearStdcall, "stdcall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarStdcall, "stdcall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearSyscall, "syscall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarSyscall, "syscall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Thiscall, "thiscall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, MipsCall, "mipscall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Generic, "genericcall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Alphacall, "alphacall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Ppccall, "ppccall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, SuperHCall, "superhcall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Armcall, "armcall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, AM33call, "am33call", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Tricall, "tricall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Sh5call, "sh5call", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, M32R, "m32rcall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Clrcall, "clrcall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Inline, "inlinecall", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearVectorcall, "vectorcall",
|
||||
OS)
|
||||
default:
|
||||
OS << "unknowncall";
|
||||
}
|
||||
return OS;
|
||||
}
|
||||
|
||||
raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_DataKind &Data) {
|
||||
switch (Data) {
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Unknown, "unknown", OS)
|
||||
@ -216,6 +251,31 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_SymType &Tag) {
|
||||
return OS;
|
||||
}
|
||||
|
||||
raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_BuiltinType &Type) {
|
||||
switch (Type) {
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Void, "void", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Char, "char", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, WCharT, "wchar_t", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Int, "int", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, UInt, "uint", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Float, "float", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, BCD, "BCD", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Bool, "bool", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Long, "long", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, ULong, "ulong", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Currency, "CURRENCY", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Date, "DATE", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Variant, "VARIANT", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Complex, "complex", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, Bitfield, "bitfield", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, BSTR, "BSTR", OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_STR(PDB_BuiltinType, HResult, "HRESULT", OS)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return OS;
|
||||
}
|
||||
|
||||
raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_UniqueId &Id) {
|
||||
static const char *Lookup = "0123456789ABCDEF";
|
||||
|
||||
|
@ -29,70 +29,75 @@ PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession,
|
||||
|
||||
void PDBSymbolCompiland::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {
|
||||
std::string FullName = getName();
|
||||
StringRef Name = llvm::sys::path::filename(StringRef(FullName.c_str()));
|
||||
if (Level == PDB_DumpLevel::Detailed) {
|
||||
std::string FullName = getName();
|
||||
StringRef Name = llvm::sys::path::filename(StringRef(FullName.c_str()));
|
||||
|
||||
OS.indent(Indent);
|
||||
OS << "Compiland: " << Name << "\n";
|
||||
OS.indent(Indent);
|
||||
OS << "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";
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
|
||||
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));
|
||||
TagStats Stats;
|
||||
auto ChildrenEnum = getChildStats(Stats);
|
||||
OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n";
|
||||
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";
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
|
||||
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";
|
||||
|
||||
auto Files(Session.getSourceFilesForCompiland(*this));
|
||||
OS << "\n";
|
||||
OS << stream_indent(Indent + 2) << Files->getChildCount()
|
||||
<< " source files";
|
||||
}
|
||||
uint32_t Count = DetailsEnum->getChildCount();
|
||||
if (Count > 1) {
|
||||
OS << "\n";
|
||||
OS << stream_indent(Indent + 2) << "(" << Count - 1 << " more omitted)";
|
||||
}
|
||||
} else {
|
||||
std::string FullName = getName();
|
||||
OS << stream_indent(Indent) << "Compiland: " << FullName;
|
||||
}
|
||||
uint32_t Count = DetailsEnum->getChildCount();
|
||||
if (Count > 1)
|
||||
OS << stream_indent(Indent + 2) << "(" << Count - 1 << " more omitted)\n";
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ void PDBSymbolData::dump(raw_ostream &OS, int Indent,
|
||||
OS << stream_indent(Indent);
|
||||
PDB_LocType Loc = getLocationType();
|
||||
PDB_DataKind Kind = getDataKind();
|
||||
if (Level == PDB_DumpLevel::Compact) {
|
||||
if (Level >= PDB_DumpLevel::Normal) {
|
||||
switch (Loc) {
|
||||
case PDB_LocType::Static: {
|
||||
uint32_t RVA = getRelativeVirtualAddress();
|
||||
@ -75,6 +75,7 @@ void PDBSymbolData::dump(raw_ostream &OS, int Indent,
|
||||
OS << "???";
|
||||
}
|
||||
}
|
||||
|
||||
OS << "] ";
|
||||
if (Kind == PDB_DataKind::Member || Kind == PDB_DataKind::StaticMember) {
|
||||
uint32_t ClassId = getClassParentId();
|
||||
@ -86,6 +87,5 @@ void PDBSymbolData::dump(raw_ostream &OS, int Indent,
|
||||
OS << "::";
|
||||
}
|
||||
}
|
||||
OS << getName() << "\n";
|
||||
OS.flush();
|
||||
OS << getName();
|
||||
}
|
@ -27,17 +27,17 @@ void PDBSymbolExe::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {
|
||||
std::string FileName(getSymbolsFileName());
|
||||
|
||||
OS << "Summary for " << FileName << "\n";
|
||||
OS << stream_indent(Indent) << "Summary for " << FileName << "\n";
|
||||
|
||||
uint64_t FileSize = 0;
|
||||
if (!llvm::sys::fs::file_size(FileName, FileSize))
|
||||
OS << " Size: " << FileSize << " bytes\n";
|
||||
OS << stream_indent(Indent + 2) << "Size: " << FileSize << " bytes\n";
|
||||
else
|
||||
OS << " Size: (Unable to obtain file size)\n";
|
||||
OS << stream_indent(Indent + 2) << "Size: (Unable to obtain file size)\n";
|
||||
PDB_UniqueId Guid = getGuid();
|
||||
OS << " Guid: " << Guid << "\n";
|
||||
OS << " Age: " << getAge() << "\n";
|
||||
OS << " Attributes: ";
|
||||
OS << stream_indent(Indent + 2) << "Guid: " << Guid << "\n";
|
||||
OS << stream_indent(Indent + 2) << "Age: " << getAge() << "\n";
|
||||
OS << stream_indent(Indent + 2) << "Attributes: ";
|
||||
if (hasCTypes())
|
||||
OS << "HasCTypes ";
|
||||
if (hasPrivateSymbols())
|
||||
@ -48,6 +48,7 @@ void PDBSymbolExe::dump(raw_ostream &OS, int Indent,
|
||||
auto ChildrenEnum = getChildStats(Stats);
|
||||
OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n";
|
||||
while (auto Child = ChildrenEnum->getNext()) {
|
||||
Child->dump(OS, Indent+2, PDB_DumpLevel::Compact);
|
||||
Child->dump(OS, Indent + 4, PDB_DumpLevel::Normal);
|
||||
OS << "\n";
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
|
||||
|
||||
#include "llvm/Support/Format.h"
|
||||
@ -26,9 +27,8 @@ PDBSymbolFunc::PDBSymbolFunc(const IPDBSession &PDBSession,
|
||||
|
||||
void PDBSymbolFunc::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {
|
||||
if (Level == PDB_DumpLevel::Compact) {
|
||||
OS << stream_indent(Indent);
|
||||
|
||||
OS << stream_indent(Indent);
|
||||
if (Level >= PDB_DumpLevel::Normal) {
|
||||
uint32_t FuncStart = getRelativeVirtualAddress();
|
||||
uint32_t FuncEnd = FuncStart + getLength();
|
||||
if (FuncStart == 0 && FuncEnd == 0) {
|
||||
@ -53,6 +53,12 @@ void PDBSymbolFunc::dump(raw_ostream &OS, int Indent,
|
||||
OS << "(FPO)";
|
||||
|
||||
OS << " ";
|
||||
uint32_t FuncSigId = getTypeId();
|
||||
if (auto FuncSig = Session.getConcreteSymbolById<PDBSymbolTypeFunctionSig>(
|
||||
FuncSigId)) {
|
||||
OS << "(" << FuncSig->getCallingConvention() << ") ";
|
||||
}
|
||||
|
||||
uint32_t ClassId = getClassParentId();
|
||||
if (ClassId != 0) {
|
||||
if (auto Class = Session.getSymbolById(ClassId)) {
|
||||
@ -63,6 +69,7 @@ void PDBSymbolFunc::dump(raw_ostream &OS, int Indent,
|
||||
}
|
||||
}
|
||||
OS << getName();
|
||||
OS << "\n";
|
||||
} else {
|
||||
OS << getName();
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolLabel.h"
|
||||
|
||||
#include "llvm/Support/Format.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
PDBSymbolLabel::PDBSymbolLabel(const IPDBSession &PDBSession,
|
||||
@ -19,4 +21,8 @@ PDBSymbolLabel::PDBSymbolLabel(const IPDBSession &PDBSession,
|
||||
: PDBSymbol(PDBSession, std::move(Symbol)) {}
|
||||
|
||||
void PDBSymbolLabel::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {}
|
||||
PDB_DumpLevel Level) const {
|
||||
OS << stream_indent(Indent);
|
||||
OS << "label [" << format_hex(getRelativeVirtualAddress(), 10) << "] "
|
||||
<< getName();
|
||||
}
|
||||
|
@ -19,4 +19,7 @@ PDBSymbolPublicSymbol::PDBSymbolPublicSymbol(
|
||||
: PDBSymbol(PDBSession, std::move(Symbol)) {}
|
||||
|
||||
void PDBSymbolPublicSymbol::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {}
|
||||
PDB_DumpLevel Level) const {
|
||||
OS << stream_indent(Indent);
|
||||
OS << "public symbol: " << getName();
|
||||
}
|
||||
|
@ -22,23 +22,21 @@ PDBSymbolThunk::PDBSymbolThunk(const IPDBSession &PDBSession,
|
||||
|
||||
void PDBSymbolThunk::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {
|
||||
if (Level == PDB_DumpLevel::Compact) {
|
||||
OS.indent(Indent);
|
||||
PDB_ThunkOrdinal Ordinal = getThunkOrdinal();
|
||||
uint32_t RVA = getRelativeVirtualAddress();
|
||||
if (Ordinal == PDB_ThunkOrdinal::TrampIncremental) {
|
||||
OS << format_hex(RVA, 10);
|
||||
} else {
|
||||
OS << "[" << format_hex(RVA, 10);
|
||||
OS << " - " << format_hex(RVA + getLength(), 10) << "]";
|
||||
}
|
||||
OS << " thunk(" << Ordinal << ")";
|
||||
if (Ordinal == PDB_ThunkOrdinal::TrampIncremental)
|
||||
OS << " -> " << format_hex(getTargetRelativeVirtualAddress(), 10);
|
||||
OS << " ";
|
||||
std::string Name = getName();
|
||||
if (!Name.empty())
|
||||
OS << Name;
|
||||
OS << "\n";
|
||||
OS.indent(Indent);
|
||||
OS << "thunk ";
|
||||
PDB_ThunkOrdinal Ordinal = getThunkOrdinal();
|
||||
uint32_t RVA = getRelativeVirtualAddress();
|
||||
if (Ordinal == PDB_ThunkOrdinal::TrampIncremental) {
|
||||
OS << format_hex(RVA, 10);
|
||||
} else {
|
||||
OS << "[" << format_hex(RVA, 10);
|
||||
OS << " - " << format_hex(RVA + getLength(), 10) << "]";
|
||||
}
|
||||
OS << " (" << Ordinal << ")";
|
||||
if (Ordinal == PDB_ThunkOrdinal::TrampIncremental)
|
||||
OS << " -> " << format_hex(getTargetRelativeVirtualAddress(), 10);
|
||||
OS << " ";
|
||||
std::string Name = getName();
|
||||
if (!Name.empty())
|
||||
OS << Name;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "llvm/DebugInfo/PDB/IPDBSession.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeArray.h"
|
||||
|
||||
@ -19,4 +20,11 @@ PDBSymbolTypeArray::PDBSymbolTypeArray(const IPDBSession &PDBSession,
|
||||
: PDBSymbol(PDBSession, std::move(Symbol)) {}
|
||||
|
||||
void PDBSymbolTypeArray::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {}
|
||||
PDB_DumpLevel Level) const {
|
||||
OS << stream_indent(Indent);
|
||||
if (auto ElementType = Session.getSymbolById(getTypeId()))
|
||||
ElementType->dump(OS, 0, PDB_DumpLevel::Compact);
|
||||
else
|
||||
OS << "<unknown-element-type>";
|
||||
OS << "[" << getLength() << "]";
|
||||
}
|
||||
|
@ -19,4 +19,7 @@ PDBSymbolTypeBaseClass::PDBSymbolTypeBaseClass(
|
||||
: PDBSymbol(PDBSession, std::move(Symbol)) {}
|
||||
|
||||
void PDBSymbolTypeBaseClass::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {}
|
||||
PDB_DumpLevel Level) const {
|
||||
OS << stream_indent(Indent);
|
||||
OS << "<base class> " << getName();
|
||||
}
|
||||
|
@ -19,4 +19,10 @@ PDBSymbolTypeBuiltin::PDBSymbolTypeBuiltin(
|
||||
: PDBSymbol(PDBSession, std::move(Symbol)) {}
|
||||
|
||||
void PDBSymbolTypeBuiltin::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {}
|
||||
PDB_DumpLevel Level) const {
|
||||
OS << stream_indent(Indent);
|
||||
PDB_BuiltinType Type = getBuiltinType();
|
||||
OS << Type;
|
||||
if (Type == PDB_BuiltinType::UInt || Type == PDB_BuiltinType::Int)
|
||||
OS << (8 * getLength()) << "_t";
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "llvm/DebugInfo/PDB/IPDBSession.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
|
||||
|
||||
@ -19,4 +20,17 @@ PDBSymbolTypeEnum::PDBSymbolTypeEnum(const IPDBSession &PDBSession,
|
||||
: PDBSymbol(PDBSession, std::move(Symbol)) {}
|
||||
|
||||
void PDBSymbolTypeEnum::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {}
|
||||
PDB_DumpLevel Level) const {
|
||||
OS << stream_indent(Indent);
|
||||
if (Level >= PDB_DumpLevel::Normal)
|
||||
OS << "enum ";
|
||||
|
||||
uint32_t ClassId = getClassParentId();
|
||||
if (ClassId != 0) {
|
||||
if (auto ClassParent = Session.getSymbolById(ClassId)) {
|
||||
ClassParent->dump(OS, 0, Level);
|
||||
OS << "::";
|
||||
}
|
||||
}
|
||||
OS << getName();
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "llvm/DebugInfo/PDB/IPDBSession.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h"
|
||||
|
||||
@ -19,4 +20,10 @@ PDBSymbolTypeFunctionArg::PDBSymbolTypeFunctionArg(
|
||||
: PDBSymbol(PDBSession, std::move(Symbol)) {}
|
||||
|
||||
void PDBSymbolTypeFunctionArg::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {}
|
||||
PDB_DumpLevel Level) const {
|
||||
OS << stream_indent(Indent);
|
||||
uint32_t TypeId = getTypeId();
|
||||
if (auto Type = Session.getSymbolById(TypeId)) {
|
||||
Type->dump(OS, 0, Level);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,11 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBSession.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
|
||||
|
||||
using namespace llvm;
|
||||
@ -19,4 +23,36 @@ PDBSymbolTypeFunctionSig::PDBSymbolTypeFunctionSig(
|
||||
: PDBSymbol(PDBSession, std::move(Symbol)) {}
|
||||
|
||||
void PDBSymbolTypeFunctionSig::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {}
|
||||
PDB_DumpLevel Level) const {
|
||||
OS << stream_indent(Indent);
|
||||
|
||||
uint32_t ReturnTypeId = getTypeId();
|
||||
if (auto ReturnType = Session.getSymbolById(ReturnTypeId)) {
|
||||
ReturnType->dump(OS, 0, PDB_DumpLevel::Compact);
|
||||
OS << " ";
|
||||
}
|
||||
// TODO: We need a way to detect if this is a pointer to function so that we
|
||||
// can print the * between the return type and the argument list. The only
|
||||
// way to do this is to pass the parent into this function, but that will
|
||||
// require a larger interface change.
|
||||
OS << getCallingConvention() << " ";
|
||||
uint32_t ClassId = getClassParentId();
|
||||
if (ClassId != 0) {
|
||||
if (auto ClassParent = Session.getSymbolById(ClassId)) {
|
||||
OS << "(";
|
||||
ClassParent->dump(OS, 0, PDB_DumpLevel::Compact);
|
||||
OS << "::*)";
|
||||
}
|
||||
}
|
||||
OS.flush();
|
||||
OS << "(";
|
||||
if (auto ChildEnum = findAllChildren<PDBSymbolTypeFunctionArg>()) {
|
||||
uint32_t Index = 0;
|
||||
while (auto Arg = ChildEnum->getNext()) {
|
||||
Arg->dump(OS, 0, PDB_DumpLevel::Compact);
|
||||
if (++Index < ChildEnum->getChildCount())
|
||||
OS << ", ";
|
||||
}
|
||||
}
|
||||
OS << ")";
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "llvm/DebugInfo/PDB/IPDBSession.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
|
||||
|
||||
@ -20,4 +21,14 @@ PDBSymbolTypePointer::PDBSymbolTypePointer(
|
||||
: PDBSymbol(PDBSession, std::move(Symbol)) {}
|
||||
|
||||
void PDBSymbolTypePointer::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {}
|
||||
PDB_DumpLevel Level) const {
|
||||
OS << stream_indent(Indent);
|
||||
if (isConstType())
|
||||
OS << "const ";
|
||||
if (isVolatileType())
|
||||
OS << "volatile ";
|
||||
uint32_t PointeeId = getTypeId();
|
||||
if (auto PointeeType = Session.getSymbolById(PointeeId))
|
||||
PointeeType->dump(OS, 0, PDB_DumpLevel::Compact);
|
||||
OS << ((isReference()) ? "&" : "*");
|
||||
}
|
||||
|
@ -23,11 +23,16 @@ PDBSymbolTypeTypedef::PDBSymbolTypeTypedef(
|
||||
void PDBSymbolTypeTypedef::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {
|
||||
OS.indent(Indent);
|
||||
OS << "typedef:" << getName() << " -> ";
|
||||
std::string TargetTypeName;
|
||||
auto TypeSymbol = Session.getSymbolById(getTypeId());
|
||||
if (PDBSymbolTypeUDT *UDT = dyn_cast<PDBSymbolTypeUDT>(TypeSymbol.get())) {
|
||||
TargetTypeName = UDT->getName();
|
||||
if (Level >= PDB_DumpLevel::Normal) {
|
||||
std::string Name = getName();
|
||||
OS << "typedef:" << Name << " -> ";
|
||||
std::string TargetTypeName;
|
||||
uint32_t TargetId = getTypeId();
|
||||
if (auto TypeSymbol = Session.getSymbolById(TargetId)) {
|
||||
TypeSymbol->dump(OS, 0, PDB_DumpLevel::Compact);
|
||||
}
|
||||
OS << TargetTypeName;
|
||||
} else {
|
||||
OS << getName();
|
||||
}
|
||||
OS << TargetTypeName << "\n";
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "llvm/DebugInfo/PDB/IPDBSession.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
|
||||
|
||||
@ -19,4 +20,22 @@ PDBSymbolTypeUDT::PDBSymbolTypeUDT(const IPDBSession &PDBSession,
|
||||
: PDBSymbol(PDBSession, std::move(Symbol)) {}
|
||||
|
||||
void PDBSymbolTypeUDT::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {}
|
||||
PDB_DumpLevel Level) const {
|
||||
OS << stream_indent(Indent);
|
||||
if (Level >= PDB_DumpLevel::Normal)
|
||||
OS << "class ";
|
||||
|
||||
if (isNested()) {
|
||||
uint32_t ClassId = getClassParentId();
|
||||
if (ClassId != 0) {
|
||||
if (auto ClassParent = Session.getSymbolById(ClassId)) {
|
||||
ClassParent->dump(OS, 0, Level);
|
||||
OS << "::";
|
||||
}
|
||||
}
|
||||
}
|
||||
OS << getName();
|
||||
|
||||
if (Level >= PDB_DumpLevel::Normal)
|
||||
OS << " (" << getLength() << " bytes)";
|
||||
}
|
||||
|
@ -9,8 +9,11 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "llvm/DebugInfo/PDB/IPDBSession.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -19,4 +22,20 @@ PDBSymbolTypeVTable::PDBSymbolTypeVTable(const IPDBSession &PDBSession,
|
||||
: PDBSymbol(PDBSession, std::move(Symbol)) {}
|
||||
|
||||
void PDBSymbolTypeVTable::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {}
|
||||
PDB_DumpLevel Level) const {
|
||||
OS << stream_indent(Indent);
|
||||
uint32_t ClassId = getClassParentId();
|
||||
if (auto ClassParent = Session.getSymbolById(ClassId)) {
|
||||
ClassParent->dump(OS, 0, PDB_DumpLevel::Compact);
|
||||
OS << "::";
|
||||
}
|
||||
OS << "<vtbl> ";
|
||||
if (auto VtblPointer =
|
||||
Session.getConcreteSymbolById<PDBSymbolTypePointer>(getTypeId())) {
|
||||
if (auto VtblShape =
|
||||
Session.getConcreteSymbolById<PDBSymbolTypeVTableShape>(
|
||||
VtblPointer->getTypeId()))
|
||||
OS << "(" << VtblShape->getCount() << " entries)";
|
||||
}
|
||||
OS.flush();
|
||||
}
|
||||
|
@ -65,7 +65,8 @@ static void dumpInput(StringRef Path) {
|
||||
if (opts::Compilands) {
|
||||
auto Compilands = GlobalScope->findAllChildren<PDBSymbolCompiland>();
|
||||
while (auto Compiland = Compilands->getNext()) {
|
||||
Compiland->dump(outs(), 0, PDB_DumpLevel::Normal);
|
||||
Compiland->dump(outs(), 0, PDB_DumpLevel::Detailed);
|
||||
outs() << "\n";
|
||||
}
|
||||
}
|
||||
outs().flush();
|
||||
|
Loading…
x
Reference in New Issue
Block a user