diff options
author | Zachary Turner <zturner@google.com> | 2015-02-13 17:57:09 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-02-13 17:57:09 +0000 |
commit | 04b966d9dc4966026fd234ff33200b65fb7e5b5c (patch) | |
tree | 34a25367d802e3437ac2a364cbb848328c8bf1b7 /llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp | |
parent | 650a61a9438d3979679e19f38ad3972542cb155c (diff) | |
download | llvm-04b966d9dc4966026fd234ff33200b65fb7e5b5c.zip llvm-04b966d9dc4966026fd234ff33200b65fb7e5b5c.tar.gz llvm-04b966d9dc4966026fd234ff33200b65fb7e5b5c.tar.bz2 |
llvm-pdbdump: Improve printing of functions and signatures.
This correctly prints the function pointers, and also prints
function signatures for symbols as opposed to just types. So
actual functions in your program will now be printed with full
name and signature, as opposed to just name as before.
llvm-svn: 229129
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp index 1b52a26..0195ce3 100644 --- a/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp +++ b/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp @@ -23,6 +23,10 @@ PDBSymbolFunc::PDBSymbolFunc(const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol) : PDBSymbol(PDBSession, std::move(Symbol)) {} +std::unique_ptr<PDBSymbolTypeFunctionSig> PDBSymbolFunc::getSignature() const { + return Session.getConcreteSymbolById<PDBSymbolTypeFunctionSig>(getTypeId()); +} + void PDBSymbolFunc::dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const { OS << stream_indent(Indent); @@ -30,7 +34,7 @@ void PDBSymbolFunc::dump(raw_ostream &OS, int Indent, uint32_t FuncStart = getRelativeVirtualAddress(); uint32_t FuncEnd = FuncStart + getLength(); if (FuncStart == 0 && FuncEnd == 0) { - OS << "func [???]"; + OS << "func [???] "; } else { OS << "func "; OS << "[" << format_hex(FuncStart, 8); @@ -52,21 +56,34 @@ void PDBSymbolFunc::dump(raw_ostream &OS, int Indent, OS << " "; uint32_t FuncSigId = getTypeId(); - if (auto FuncSig = Session.getConcreteSymbolById<PDBSymbolTypeFunctionSig>( - FuncSigId)) { - OS << "(" << FuncSig->getCallingConvention() << ") "; - } + if (auto FuncSig = getSignature()) { + // If we have a signature, dump the name with the signature. + if (auto ReturnType = FuncSig->getReturnType()) { + ReturnType->dump(OS, 0, PDB_DumpLevel::Compact); + OS << " "; + } + + OS << FuncSig->getCallingConvention() << " "; - uint32_t ClassId = getClassParentId(); - if (ClassId != 0) { - if (auto Class = Session.getSymbolById(ClassId)) { - if (auto UDT = dyn_cast<PDBSymbolTypeUDT>(Class.get())) - OS << UDT->getName() << "::"; - else - OS << "{class " << Class->getSymTag() << "}::"; + if (auto ClassParent = FuncSig->getClassParent()) { + ClassParent->dump(OS, 0, PDB_DumpLevel::Compact); + OS << "::"; } + + OS << getName(); + FuncSig->dumpArgList(OS); + } else { + uint32_t ClassId = getClassParentId(); + if (ClassId != 0) { + if (auto Class = Session.getSymbolById(ClassId)) { + if (auto UDT = dyn_cast<PDBSymbolTypeUDT>(Class.get())) + OS << UDT->getName() << "::"; + else + OS << "{class " << Class->getSymTag() << "}::"; + } + } + OS << getName(); } - OS << getName(); } else { OS << getName(); } |