diff options
author | Zachary Turner <zturner@google.com> | 2015-02-14 03:54:28 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-02-14 03:54:28 +0000 |
commit | 26ebe3fbcd1518c1acb26efcf2b8e89e3c031bea (patch) | |
tree | 1a73305ac95c4d5a4c8fcc234711efeb065089d5 /llvm/lib/DebugInfo | |
parent | 52c9f881ded240536047784b005b01e8242dddad (diff) | |
download | bcm5719-llvm-26ebe3fbcd1518c1acb26efcf2b8e89e3c031bea.tar.gz bcm5719-llvm-26ebe3fbcd1518c1acb26efcf2b8e89e3c031bea.zip |
llvm-pdbdump: Only dump whitelisted global symbols.
Dumping the global scope contains a lot of very uninteresting
things and is generally polluted with a lot of random junk.
Furthermore, it dumps values unsorted, making it hard to read.
This patch dumps known interesting types only, and as a side
effect sorts the list by symbol type.
llvm-svn: 229232
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/PDBSymbol.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/PDBSymbolExe.cpp | 51 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp | 4 |
3 files changed, 37 insertions, 25 deletions
diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp index 358de799328..9ab8b936a5d 100644 --- a/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp +++ b/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp @@ -108,7 +108,12 @@ void PDBSymbol::defaultDump(raw_ostream &OS, int Indent, PDB_SymType PDBSymbol::getSymTag() const { return RawSymbol->getSymTag(); } std::unique_ptr<IPDBEnumSymbols> PDBSymbol::findAllChildren() const { - return RawSymbol->findChildren(PDB_SymType::None); + return findAllChildren(PDB_SymType::None); +} + +std::unique_ptr<IPDBEnumSymbols> +PDBSymbol::findAllChildren(PDB_SymType Type) const { + return RawSymbol->findChildren(Type); } std::unique_ptr<IPDBEnumSymbols> diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolExe.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolExe.cpp index e7871e3bd40..6555b814a68 100644 --- a/llvm/lib/DebugInfo/PDB/PDBSymbolExe.cpp +++ b/llvm/lib/DebugInfo/PDB/PDBSymbolExe.cpp @@ -46,31 +46,34 @@ void PDBSymbolExe::dump(raw_ostream &OS, int Indent, OS << "HasPrivateSymbols "; OS << "\n"; - TagStats Stats; - auto ChildrenEnum = getChildStats(Stats); - OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n"; + auto ChildrenEnum = findAllChildren(); + OS << stream_indent(Indent + 2) << ChildrenEnum->getChildCount() + << " children\n"; +#if 0 + dumpChildren(OS, PDB_SymType::None, Indent+4); +#else + dumpChildren(OS, "Compilands", PDB_SymType::Compiland, Indent + 4); + dumpChildren(OS, "Functions", PDB_SymType::Function, Indent + 4); + dumpChildren(OS, "Blocks", PDB_SymType::Block, Indent + 4); + dumpChildren(OS, "Data", PDB_SymType::Data, Indent + 4); + dumpChildren(OS, "Labels", PDB_SymType::Label, Indent + 4); + dumpChildren(OS, "Public Symbols", PDB_SymType::PublicSymbol, Indent + 4); + dumpChildren(OS, "UDTs", PDB_SymType::UDT, Indent + 4); + dumpChildren(OS, "Enums", PDB_SymType::Enum, Indent + 4); + dumpChildren(OS, "Function Signatures", PDB_SymType::FunctionSig, Indent + 4); + dumpChildren(OS, "Typedefs", PDB_SymType::Typedef, Indent + 4); + dumpChildren(OS, "VTables", PDB_SymType::VTable, Indent + 4); + dumpChildren(OS, "Thunks", PDB_SymType::Thunk, Indent + 4); +#endif +} + +void PDBSymbolExe::dumpChildren(raw_ostream &OS, StringRef Label, + PDB_SymType ChildType, int Indent) const { + auto ChildrenEnum = findAllChildren(ChildType); + OS << stream_indent(Indent) << Label << ": (" << ChildrenEnum->getChildCount() + << " items)\n"; while (auto Child = ChildrenEnum->getNext()) { - // Skip uninteresting types. These are useful to print as part of type - // hierarchies, but as general children of the global scope, they are - // not very interesting. - switch (Child->getSymTag()) { - case PDB_SymType::ArrayType: - case PDB_SymType::BaseClass: - case PDB_SymType::BuiltinType: - case PDB_SymType::CompilandEnv: - case PDB_SymType::CustomType: - case PDB_SymType::Dimension: - case PDB_SymType::Friend: - case PDB_SymType::ManagedType: - case PDB_SymType::VTableShape: - case PDB_SymType::PointerType: - case PDB_SymType::FunctionSig: - case PDB_SymType::FunctionArg: - continue; - default: - break; - } - Child->dump(OS, Indent + 4, PDB_DumpLevel::Normal); + Child->dump(OS, Indent + 2, PDB_DumpLevel::Normal); OS << "\n"; } } diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp index 49caedc719a..817279bc3db 100644 --- a/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp +++ b/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp @@ -31,6 +31,10 @@ std::unique_ptr<PDBSymbolTypeFunctionSig> PDBSymbolFunc::getSignature() const { void PDBSymbolFunc::dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const { OS << stream_indent(Indent); + // if (getName() == "__crtCreateThreadpoolWait") { + // RawSymbol->dump(OS, Indent+2, Level); + // OS.flush(); + //} if (Level >= PDB_DumpLevel::Normal) { uint32_t FuncStart = getRelativeVirtualAddress(); uint32_t FuncEnd = FuncStart + getLength(); |