mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229232 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f94896ffa0
commit
73a1e454d7
@ -68,8 +68,9 @@ public:
|
||||
auto BaseIter = RawSymbol->findChildren(T::Tag);
|
||||
return llvm::make_unique<ConcreteSymbolEnumerator<T>>(std::move(BaseIter));
|
||||
}
|
||||
|
||||
std::unique_ptr<IPDBEnumSymbols> findAllChildren(PDB_SymType Type) const;
|
||||
std::unique_ptr<IPDBEnumSymbols> findAllChildren() const;
|
||||
|
||||
std::unique_ptr<IPDBEnumSymbols>
|
||||
findChildren(PDB_SymType Type, StringRef Name,
|
||||
PDB_NameSearchFlags Flags) const;
|
||||
|
@ -36,6 +36,10 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getSignature)
|
||||
FORWARD_SYMBOL_METHOD(getSymbolsFileName)
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
|
||||
private:
|
||||
void dumpChildren(raw_ostream &OS, StringRef Label, PDB_SymType ChildType,
|
||||
int Indent) const;
|
||||
};
|
||||
} // namespace llvm
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user