From: Zachary Turner Date: Sun, 15 Feb 2015 20:27:53 +0000 (+0000) Subject: llvm-pdbdump: Add flags controlling the type of values to dump. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=7f6d93f71874c558577cbee9737d7e2867eb3cca;p=oota-llvm.git llvm-pdbdump: Add flags controlling the type of values to dump. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229330 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/DebugInfo/PDB/PDBSymbol.h b/include/llvm/DebugInfo/PDB/PDBSymbol.h index 500fa7a4567..4f1ca5f627d 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbol.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbol.h @@ -53,7 +53,7 @@ public: /// call dump() on the underlying RawSymbol, which allows us to discover /// unknown properties, but individual implementations of PDBSymbol may /// override the behavior to only dump known fields. - virtual void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const = 0; + virtual void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const = 0; void defaultDump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const; PDB_SymType getSymTag() const; diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolAnnotation.h b/include/llvm/DebugInfo/PDB/PDBSymbolAnnotation.h index e5ba65ff63e..b931b0780d8 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolAnnotation.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolAnnotation.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Annotation) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getAddressOffset) FORWARD_SYMBOL_METHOD(getAddressSection) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolBlock.h b/include/llvm/DebugInfo/PDB/PDBSymbolBlock.h index d30ed577b60..6462159833b 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolBlock.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolBlock.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Block) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getAddressOffset) FORWARD_SYMBOL_METHOD(getAddressSection) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolCompiland.h b/include/llvm/DebugInfo/PDB/PDBSymbolCompiland.h index 04a0712f2da..0363c8600c3 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolCompiland.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolCompiland.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Compiland) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(isEditAndContinueEnabled) FORWARD_SYMBOL_METHOD(getLexicalParentId) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h b/include/llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h index d0338550d89..83ca9b5bf64 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::CompilandDetails) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; void getFrontEndVersion(VersionInfo &Version) const { RawSymbol->getFrontEndVersion(Version); diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h b/include/llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h index c31a33924cc..5f621b956a9 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::CompilandEnv) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getLexicalParentId) FORWARD_SYMBOL_METHOD(getName) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolCustom.h b/include/llvm/DebugInfo/PDB/PDBSymbolCustom.h index eab4b08fecf..741d073b942 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolCustom.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolCustom.h @@ -28,7 +28,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Custom) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; void getDataBytes(llvm::SmallVector &bytes); FORWARD_SYMBOL_METHOD(getSymIndexId) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolData.h b/include/llvm/DebugInfo/PDB/PDBSymbolData.h index c99ef63f8e7..f6eca3ec61b 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolData.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolData.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Data) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getAccess) FORWARD_SYMBOL_METHOD(getAddressOffset) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolExe.h b/include/llvm/DebugInfo/PDB/PDBSymbolExe.h index cdb6a326d88..a5327f309b7 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolExe.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolExe.h @@ -25,7 +25,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Exe) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getAge) FORWARD_SYMBOL_METHOD(getGuid) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h b/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h index a521acff547..030e57fd51a 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h @@ -22,7 +22,7 @@ public: PDBSymbolFunc(const IPDBSession &PDBSession, std::unique_ptr FuncSymbol); - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; std::unique_ptr getSignature() const; diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h b/include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h index e974375481a..9e4697ff3cf 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::FuncDebugEnd) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getAddressOffset) FORWARD_SYMBOL_METHOD(getAddressSection) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h b/include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h index 99de8c06306..36bc1679d80 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::FuncDebugStart) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getAddressOffset) FORWARD_SYMBOL_METHOD(getAddressSection) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolLabel.h b/include/llvm/DebugInfo/PDB/PDBSymbolLabel.h index edc75d0078b..21b33b01545 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolLabel.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolLabel.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Label) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getAddressOffset) FORWARD_SYMBOL_METHOD(getAddressSection) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h b/include/llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h index b99fe16116b..019c3e94927 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::PublicSymbol) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getAddressOffset) FORWARD_SYMBOL_METHOD(getAddressSection) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolThunk.h b/include/llvm/DebugInfo/PDB/PDBSymbolThunk.h index 8cfd63bb8b3..2ebd29cccba 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolThunk.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolThunk.h @@ -25,7 +25,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Thunk) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getAccess) FORWARD_SYMBOL_METHOD(getAddressOffset) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolTypeArray.h b/include/llvm/DebugInfo/PDB/PDBSymbolTypeArray.h index 42d0f39341b..d9e86fd510f 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolTypeArray.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolTypeArray.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::ArrayType) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getArrayIndexTypeId) FORWARD_SYMBOL_METHOD(isConstType) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h b/include/llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h index e80caffaf51..c0763a6f6f4 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::BaseClass) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getAccess) FORWARD_SYMBOL_METHOD(getClassParentId) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h b/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h index 725abe76b69..3c16f133f9b 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::BuiltinType) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getBuiltinType) FORWARD_SYMBOL_METHOD(isConstType) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h b/include/llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h index 622c7824e53..0e3cff044fb 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::CustomType) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getOemId) FORWARD_SYMBOL_METHOD(getOemSymbolId) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h b/include/llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h index 91d8b8789d1..78a6ac35420 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Dimension) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getLowerBoundId) FORWARD_SYMBOL_METHOD(getUpperBoundId) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h b/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h index a1ee01d8262..3266c826a70 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Enum) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getBuiltinType) FORWARD_SYMBOL_METHOD(getClassParentId) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h b/include/llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h index 1b835b11655..e1846decc44 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Friend) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getClassParentId) FORWARD_SYMBOL_METHOD(getName) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h b/include/llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h index 050889244a7..39504276eaa 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::FunctionArg) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getClassParentId) FORWARD_SYMBOL_METHOD(getLexicalParentId) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h b/include/llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h index e81afcbd75e..068472c92b4 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h @@ -28,7 +28,7 @@ public: std::unique_ptr getArguments() const; std::unique_ptr getClassParent() const; - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; void dumpArgList(raw_ostream &OS) const; FORWARD_SYMBOL_METHOD(getCallingConvention) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h b/include/llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h index ff86f569779..4b6fad6b587 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::ManagedType) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getName) FORWARD_SYMBOL_METHOD(getSymIndexId) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolTypePointer.h b/include/llvm/DebugInfo/PDB/PDBSymbolTypePointer.h index f0989c1770a..f52c47442b8 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolTypePointer.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolTypePointer.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::PointerType) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(isConstType) FORWARD_SYMBOL_METHOD(getLength) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h b/include/llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h index 3afdbf38203..ddf4f46035c 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Typedef) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getBuiltinType) FORWARD_SYMBOL_METHOD(getClassParentId) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h b/include/llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h index 2e067fa5372..aea5d92f795 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::UDT) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getClassParentId) FORWARD_SYMBOL_METHOD(hasConstructor) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h b/include/llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h index a0b26ea11f2..5a2a7c3bf7e 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::VTable) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getClassParentId) FORWARD_SYMBOL_METHOD(isConstType) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h b/include/llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h index a1379a05b82..4676a35ad54 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::VTableShape) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(isConstType) FORWARD_SYMBOL_METHOD(getCount) diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolUnknown.h b/include/llvm/DebugInfo/PDB/PDBSymbolUnknown.h index 1fa358c3eae..dbcbf07af74 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolUnknown.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolUnknown.h @@ -21,7 +21,7 @@ public: PDBSymbolUnknown(const IPDBSession &PDBSession, std::unique_ptr UnknownSymbol); - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; static bool classof(const PDBSymbol *S) { return (S->getSymTag() == PDB_SymType::None || diff --git a/include/llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h b/include/llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h index 9d94ed8f775..d0d624d1470 100644 --- a/include/llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h +++ b/include/llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h @@ -24,7 +24,7 @@ public: DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::UsingNamespace) - void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override; + void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level, PDB_DumpFlags Flags) const override; FORWARD_SYMBOL_METHOD(getLexicalParentId) FORWARD_SYMBOL_METHOD(getName) diff --git a/include/llvm/DebugInfo/PDB/PDBTypes.h b/include/llvm/DebugInfo/PDB/PDBTypes.h index e933621729b..1b44a5f21d8 100644 --- a/include/llvm/DebugInfo/PDB/PDBTypes.h +++ b/include/llvm/DebugInfo/PDB/PDBTypes.h @@ -75,6 +75,44 @@ enum class PDB_DumpLevel { Detailed, }; +enum PDB_DumpFlags { + PDB_DF_None = 0x0, + PDB_DF_Functions = 0x1, // Dump functions + PDB_DF_Data = 0x2, // Dump variables and constants + PDB_DF_Labels = 0x4, // Dump labels + PDB_DF_PublicSyms = 0x8, // Dump public symbols + PDB_DF_Classes = 0x10, // Dump class types + PDB_DF_Enums = 0x20, // Dump enums + PDB_DF_Funcsigs = 0x40, // Dump function signatures + PDB_DF_VTables = 0x80, // Dump virtual function tables + PDB_DF_Thunks = 0x100, // Dump thunks + PDB_DF_ObjFiles = 0x200, // Dump object files (compilands) + PDB_DF_Typedefs = 0x400, // Dump typedefs + PDB_DF_Children = 0x800, // Dump children of the current symbol + PDB_DF_Hidden = 0x1000, // Dump everything. This is not simply a bitwise + // or of the previous flags. It will find symbols + // that would otherwise be missed, but can lead to + // much slower dumps for large input files. + PDB_DF_All = 0x7FF +}; +inline PDB_DumpFlags operator|(PDB_DumpFlags LHS, PDB_DumpFlags RHS) { + return static_cast((int)LHS | (int)RHS); +} + +inline PDB_DumpFlags operator&(PDB_DumpFlags LHS, PDB_DumpFlags RHS) { + return static_cast((int)LHS & (int)RHS); +} + +inline PDB_DumpFlags operator~(PDB_DumpFlags LHS) { + return static_cast(~(int)LHS); +} +inline PDB_DumpFlags &operator|=(PDB_DumpFlags &LHS, PDB_DumpFlags RHS) { + return (LHS = (LHS | RHS)); +} +inline PDB_DumpFlags &operator&=(PDB_DumpFlags &LHS, PDB_DumpFlags RHS) { + return (LHS = (LHS & RHS)); +} + /// Defines a 128-bit unique identifier. This maps to a GUID on Windows, but /// is abstracted here for the purposes of non-Windows platforms that don't have /// the GUID structure defined. diff --git a/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp b/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp index 2baf3df0fd8..5ed1624bfd4 100644 --- a/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp +++ b/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp @@ -352,7 +352,7 @@ DIARawSymbol::findChildren(PDB_SymType Type) const { enum SymTagEnum EnumVal = static_cast(Type); CComPtr DiaEnumerator; - if (S_OK != Symbol->findChildren(EnumVal, nullptr, nsNone, &DiaEnumerator)) + if (S_OK != Symbol->findChildrenEx(EnumVal, nullptr, nsNone, &DiaEnumerator)) return nullptr; return llvm::make_unique(Session, DiaEnumerator); @@ -370,7 +370,7 @@ DIARawSymbol::findChildren(PDB_SymType Type, StringRef Name, CComPtr DiaEnumerator; if (S_OK != - Symbol->findChildren(EnumVal, Name16Str, CompareFlags, &DiaEnumerator)) + Symbol->findChildrenEx(EnumVal, Name16Str, CompareFlags, &DiaEnumerator)) return nullptr; return llvm::make_unique(Session, DiaEnumerator); diff --git a/lib/DebugInfo/PDB/PDBSymbolAnnotation.cpp b/lib/DebugInfo/PDB/PDBSymbolAnnotation.cpp index 5fcc602e5a8..c965d1d9d6b 100644 --- a/lib/DebugInfo/PDB/PDBSymbolAnnotation.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolAnnotation.cpp @@ -20,4 +20,4 @@ PDBSymbolAnnotation::PDBSymbolAnnotation(const IPDBSession &PDBSession, : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolAnnotation::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const {} + PDB_DumpLevel Level, PDB_DumpFlags Flags) const {} diff --git a/lib/DebugInfo/PDB/PDBSymbolBlock.cpp b/lib/DebugInfo/PDB/PDBSymbolBlock.cpp index f92bfca193d..2e350ad2fe9 100644 --- a/lib/DebugInfo/PDB/PDBSymbolBlock.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolBlock.cpp @@ -20,4 +20,4 @@ PDBSymbolBlock::PDBSymbolBlock(const IPDBSession &PDBSession, : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolBlock::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const {} + PDB_DumpLevel Level, PDB_DumpFlags Flags) const {} diff --git a/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp b/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp index 0ea0b185911..f014b3959b0 100644 --- a/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp @@ -28,75 +28,43 @@ PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession, std::unique_ptr Symbol) : PDBSymbol(PDBSession, std::move(Symbol)) {} +#define SKIP_SYMBOL_IF_FLAG_UNSET(Tag, Flag) \ + case PDB_SymType::Tag: \ + if ((Flags & Flag) == 0) \ + continue; \ + break; + void PDBSymbolCompiland::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const { + PDB_DumpLevel Level, PDB_DumpFlags Flags) const { 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"; - - 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::Detailed) { - while (auto Child = ChildrenEnum->getNext()) { - if (llvm::isa(*Child)) - continue; - if (llvm::isa(*Child)) - continue; - PDB_DumpLevel ChildLevel = (Level == PDB_DumpLevel::Detailed) - ? PDB_DumpLevel::Normal - : PDB_DumpLevel::Compact; - Child->dump(OS, Indent + 4, ChildLevel); - OS << "\n"; + OS << stream_indent(Indent) << FullName; + if (Flags & PDB_DF_Children) { + if (Level >= PDB_DumpLevel::Detailed) { + auto ChildrenEnum = findAllChildren(); + while (auto Child = ChildrenEnum->getNext()) { + switch (Child->getSymTag()) { + SKIP_SYMBOL_IF_FLAG_UNSET(Function, PDB_DF_Functions) + SKIP_SYMBOL_IF_FLAG_UNSET(Data, PDB_DF_Data) + SKIP_SYMBOL_IF_FLAG_UNSET(Label, PDB_DF_Labels) + SKIP_SYMBOL_IF_FLAG_UNSET(PublicSymbol, PDB_DF_PublicSyms) + SKIP_SYMBOL_IF_FLAG_UNSET(UDT, PDB_DF_Classes) + SKIP_SYMBOL_IF_FLAG_UNSET(Enum, PDB_DF_Enums) + SKIP_SYMBOL_IF_FLAG_UNSET(FunctionSig, PDB_DF_Funcsigs) + SKIP_SYMBOL_IF_FLAG_UNSET(VTable, PDB_DF_VTables) + SKIP_SYMBOL_IF_FLAG_UNSET(Thunk, PDB_DF_Thunks) + SKIP_SYMBOL_IF_FLAG_UNSET(Compiland, PDB_DF_ObjFiles) + default: + continue; + } + PDB_DumpLevel ChildLevel = (Level == PDB_DumpLevel::Detailed) + ? PDB_DumpLevel::Normal + : PDB_DumpLevel::Compact; + OS << "\n"; + Child->dump(OS, Indent + 2, ChildLevel, PDB_DF_Children); + } } } - - auto DetailsEnum(findAllChildren()); - 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; diff --git a/lib/DebugInfo/PDB/PDBSymbolCompilandDetails.cpp b/lib/DebugInfo/PDB/PDBSymbolCompilandDetails.cpp index ebda161999f..9194376eee0 100644 --- a/lib/DebugInfo/PDB/PDBSymbolCompilandDetails.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolCompilandDetails.cpp @@ -20,4 +20,4 @@ PDBSymbolCompilandDetails::PDBSymbolCompilandDetails( : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolCompilandDetails::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const {} + PDB_DumpLevel Level, PDB_DumpFlags Flags) const {} diff --git a/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp b/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp index e4955e2b470..b44dc578ea4 100644 --- a/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp @@ -26,4 +26,4 @@ std::string PDBSymbolCompilandEnv::getValue() const { } void PDBSymbolCompilandEnv::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const {} + PDB_DumpLevel Level, PDB_DumpFlags Flags) const {} diff --git a/lib/DebugInfo/PDB/PDBSymbolCustom.cpp b/lib/DebugInfo/PDB/PDBSymbolCustom.cpp index 4bddf562e3b..68f2b45194c 100644 --- a/lib/DebugInfo/PDB/PDBSymbolCustom.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolCustom.cpp @@ -25,4 +25,4 @@ void PDBSymbolCustom::getDataBytes(llvm::SmallVector &bytes) { } void PDBSymbolCustom::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const {} \ No newline at end of file + PDB_DumpLevel Level, PDB_DumpFlags Flags) const {} \ No newline at end of file diff --git a/lib/DebugInfo/PDB/PDBSymbolData.cpp b/lib/DebugInfo/PDB/PDBSymbolData.cpp index 516b87ec001..9a04ecd1f43 100644 --- a/lib/DebugInfo/PDB/PDBSymbolData.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolData.cpp @@ -24,58 +24,56 @@ PDBSymbolData::PDBSymbolData(const IPDBSession &PDBSession, : PDBSymbol(PDBSession, std::move(DataSymbol)) {} void PDBSymbolData::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const { + PDB_DumpLevel Level, PDB_DumpFlags Flags) const { OS << stream_indent(Indent); PDB_LocType Loc = getLocationType(); PDB_DataKind Kind = getDataKind(); - if (Level >= PDB_DumpLevel::Normal) { - switch (Loc) { - case PDB_LocType::Static: { - uint32_t RVA = getRelativeVirtualAddress(); - OS << Kind << " data["; - if (RVA != 0) - OS << format_hex(RVA, 10); - else - OS << "???"; - break; - } - case PDB_LocType::TLS: - OS << "threadlocal " << Kind << " data["; - OS << getAddressSection() << ":" << format_hex(getAddressOffset(), 10); - break; - case PDB_LocType::RegRel: - OS << "regrel " << Kind << " data["; - OS << getRegisterId() << " + " << getOffset(); - break; - case PDB_LocType::ThisRel: { - uint32_t Offset = getOffset(); - OS << Kind << " data[this + " << format_hex(Offset, 4); - break; - } - case PDB_LocType::Enregistered: - OS << "register " << Kind << " data[" << getRegisterId(); - break; - case PDB_LocType::BitField: { - OS << "bitfield data[this + "; - uint32_t Offset = getOffset(); - uint32_t BitPos = getBitPosition(); - uint32_t Length = getLength(); - OS << format_hex(Offset, 4) << ":" << BitPos << "," << Length; - break; - } - case PDB_LocType::Slot: - OS << getSlot(); - break; - case PDB_LocType::Constant: { - OS << "constant data["; - OS << getValue(); - break; - } - case PDB_LocType::IlRel: - case PDB_LocType::MetaData: - default: + switch (Loc) { + case PDB_LocType::Static: { + uint32_t RVA = getRelativeVirtualAddress(); + OS << Kind << " data["; + if (RVA != 0) + OS << format_hex(RVA, 10); + else OS << "???"; - } + break; + } + case PDB_LocType::TLS: + OS << "threadlocal " << Kind << " data["; + OS << getAddressSection() << ":" << format_hex(getAddressOffset(), 10); + break; + case PDB_LocType::RegRel: + OS << "regrel " << Kind << " data["; + OS << getRegisterId() << " + " << getOffset(); + break; + case PDB_LocType::ThisRel: { + uint32_t Offset = getOffset(); + OS << Kind << " data[this + " << format_hex(Offset, 4); + break; + } + case PDB_LocType::Enregistered: + OS << "register " << Kind << " data[" << getRegisterId(); + break; + case PDB_LocType::BitField: { + OS << "bitfield data[this + "; + uint32_t Offset = getOffset(); + uint32_t BitPos = getBitPosition(); + uint32_t Length = getLength(); + OS << format_hex(Offset, 4) << ":" << BitPos << "," << Length; + break; + } + case PDB_LocType::Slot: + OS << getSlot(); + break; + case PDB_LocType::Constant: { + OS << "constant data["; + OS << getValue(); + break; + } + case PDB_LocType::IlRel: + case PDB_LocType::MetaData: + default: + OS << "???"; } OS << "] "; diff --git a/lib/DebugInfo/PDB/PDBSymbolExe.cpp b/lib/DebugInfo/PDB/PDBSymbolExe.cpp index 6555b814a68..5d3da216957 100644 --- a/lib/DebugInfo/PDB/PDBSymbolExe.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolExe.cpp @@ -21,12 +21,18 @@ using namespace llvm; +#define SKIP_SYMBOL_IF_FLAG_UNSET(Tag, Flag) \ + case PDB_SymType::Tag: \ + if ((Flags & Flag) == 0) \ + continue; \ + break; + PDBSymbolExe::PDBSymbolExe(const IPDBSession &PDBSession, std::unique_ptr Symbol) : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolExe::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const { + PDB_DumpLevel Level, PDB_DumpFlags Flags) const { std::string FileName(getSymbolsFileName()); OS << stream_indent(Indent) << "Summary for " << FileName << "\n"; @@ -46,25 +52,76 @@ void PDBSymbolExe::dump(raw_ostream &OS, int Indent, OS << "HasPrivateSymbols "; OS << "\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 + if (Flags & PDB_DF_Children) { + if (Flags & PDB_DF_Hidden) { + // For some reason, for each SymTag T, this dumps more items of type T + // than are dumped by calling dumpChildren(T). In other words, there are + // "hidden" symbols. For example, it causes functions to be dumped which + // have no address information, whereas specifically dumping only + // functions will not find those symbols. + // + // My suspicion is that in the underlying DIA call, when you call + // findChildren, passing a value of SymTagNone means all children + // recursively, whereas passing a concrete tag value means only immediate + // children of the global scope. So perhaps we need to find these + // mysterious missing values by recursing through the hierarchy. + // + // On the other hand, there may just be some symbols that DIA tries to + // hide from you because it thinks you don't care about them. However + // experimentation shows that even vtables, for example, can't be found + // without an exhaustive search. + auto ChildrenEnum = findAllChildren(); + OS << stream_indent(Indent + 2) << ChildrenEnum->getChildCount() + << " symbols"; + + while (auto Child = ChildrenEnum->getNext()) { + switch (Child->getSymTag()) { + SKIP_SYMBOL_IF_FLAG_UNSET(Function, PDB_DF_Functions) + SKIP_SYMBOL_IF_FLAG_UNSET(Data, PDB_DF_Data) + SKIP_SYMBOL_IF_FLAG_UNSET(Label, PDB_DF_Labels) + SKIP_SYMBOL_IF_FLAG_UNSET(PublicSymbol, PDB_DF_PublicSyms) + SKIP_SYMBOL_IF_FLAG_UNSET(UDT, PDB_DF_Classes) + SKIP_SYMBOL_IF_FLAG_UNSET(Enum, PDB_DF_Enums) + SKIP_SYMBOL_IF_FLAG_UNSET(FunctionSig, PDB_DF_Funcsigs) + SKIP_SYMBOL_IF_FLAG_UNSET(VTable, PDB_DF_VTables) + SKIP_SYMBOL_IF_FLAG_UNSET(Thunk, PDB_DF_Thunks) + SKIP_SYMBOL_IF_FLAG_UNSET(Compiland, PDB_DF_ObjFiles) + default: + continue; + } + PDB_DumpLevel ChildLevel = (Level == PDB_DumpLevel::Detailed) + ? PDB_DumpLevel::Normal + : PDB_DumpLevel::Compact; + OS << "\n"; + Child->dump(OS, Indent + 4, ChildLevel, PDB_DF_Children); + } + } else { + if (Flags & PDB_DF_ObjFiles) + dumpChildren(OS, "Compilands", PDB_SymType::Compiland, Indent + 4); + if (Flags & PDB_DF_Functions) + dumpChildren(OS, "Functions", PDB_SymType::Function, Indent + 4); + if (Flags & PDB_DF_Data) + dumpChildren(OS, "Data", PDB_SymType::Data, Indent + 4); + if (Flags & PDB_DF_Labels) + dumpChildren(OS, "Labels", PDB_SymType::Label, Indent + 4); + if (Flags & PDB_DF_PublicSyms) + dumpChildren(OS, "Public Symbols", PDB_SymType::PublicSymbol, + Indent + 4); + if (Flags & PDB_DF_Classes) + dumpChildren(OS, "UDTs", PDB_SymType::UDT, Indent + 4); + if (Flags & PDB_DF_Enums) + dumpChildren(OS, "Enums", PDB_SymType::Enum, Indent + 4); + if (Flags & PDB_DF_Funcsigs) + dumpChildren(OS, "Function Signatures", PDB_SymType::FunctionSig, + Indent + 4); + if (Flags & PDB_DF_Typedefs) + dumpChildren(OS, "Typedefs", PDB_SymType::Typedef, Indent + 4); + if (Flags & PDB_DF_VTables) + dumpChildren(OS, "VTables", PDB_SymType::VTable, Indent + 4); + if (Flags & PDB_DF_Thunks) + dumpChildren(OS, "Thunks", PDB_SymType::Thunk, Indent + 4); + } + } } void PDBSymbolExe::dumpChildren(raw_ostream &OS, StringRef Label, @@ -73,7 +130,7 @@ void PDBSymbolExe::dumpChildren(raw_ostream &OS, StringRef Label, OS << stream_indent(Indent) << Label << ": (" << ChildrenEnum->getChildCount() << " items)\n"; while (auto Child = ChildrenEnum->getNext()) { - Child->dump(OS, Indent + 2, PDB_DumpLevel::Normal); + Child->dump(OS, Indent + 2, PDB_DumpLevel::Normal, PDB_DF_None); OS << "\n"; } } diff --git a/lib/DebugInfo/PDB/PDBSymbolFunc.cpp b/lib/DebugInfo/PDB/PDBSymbolFunc.cpp index 817279bc3db..cd01423c9b7 100644 --- a/lib/DebugInfo/PDB/PDBSymbolFunc.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolFunc.cpp @@ -29,66 +29,58 @@ std::unique_ptr PDBSymbolFunc::getSignature() const { } void PDBSymbolFunc::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const { + PDB_DumpLevel Level, PDB_DumpFlags Flags) const { + uint32_t FuncStart = getRelativeVirtualAddress(); + uint32_t FuncEnd = FuncStart + getLength(); 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(); - if (FuncStart == 0 && FuncEnd == 0) { - OS << "func [???] "; - } else { - OS << "func "; - OS << "[" << format_hex(FuncStart, 8); - if (auto DebugStart = findOneChild()) - OS << "+" << DebugStart->getRelativeVirtualAddress() - FuncStart; - OS << " - " << format_hex(FuncEnd, 8); - if (auto DebugEnd = findOneChild()) - OS << "-" << FuncEnd - DebugEnd->getRelativeVirtualAddress(); - OS << "] "; - } + if (FuncStart == 0 && FuncEnd == 0) { + OS << "func [???] "; + } else { + OS << "func "; + OS << "[" << format_hex(FuncStart, 8); + if (auto DebugStart = findOneChild()) + OS << "+" << DebugStart->getRelativeVirtualAddress() - FuncStart; + OS << " - " << format_hex(FuncEnd, 8); + if (auto DebugEnd = findOneChild()) + OS << "-" << FuncEnd - DebugEnd->getRelativeVirtualAddress(); + OS << "] "; + } - PDB_RegisterId Reg = getLocalBasePointerRegisterId(); - if (Reg == PDB_RegisterId::VFrame) - OS << "(VFrame)"; - else if (hasFramePointer()) - OS << "(" << Reg << ")"; - else - OS << "(FPO)"; + PDB_RegisterId Reg = getLocalBasePointerRegisterId(); + if (Reg == PDB_RegisterId::VFrame) + OS << "(VFrame)"; + else if (hasFramePointer()) + OS << "(" << Reg << ")"; + else + OS << "(FPO)"; - OS << " "; - 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 << " "; + if (isVirtual() || isPureVirtual()) + OS << "virtual "; - 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, PDB_DF_Children); + OS << " "; + } - if (auto ClassParent = FuncSig->getClassParent()) { - ClassParent->dump(OS, 0, PDB_DumpLevel::Compact); - OS << "::"; - } + OS << FuncSig->getCallingConvention() << " "; - OS << getName(); - FuncSig->dumpArgList(OS); - } else { - uint32_t ClassId = getClassParentId(); - if (ClassId != 0) { - if (auto Class = Session.getSymbolById(ClassId)) { - if (auto UDT = dyn_cast(Class.get())) - OS << UDT->getName() << "::"; - else - OS << "{class " << Class->getSymTag() << "}::"; - } + OS << getName(); + FuncSig->dumpArgList(OS); + if (isPureVirtual()) + OS << " = 0"; + } else { + uint32_t ClassId = getClassParentId(); + if (ClassId != 0) { + if (auto Class = Session.getSymbolById(ClassId)) { + if (auto UDT = dyn_cast(Class.get())) + OS << UDT->getName() << "::"; + else + OS << "{class " << Class->getSymTag() << "}::"; } - OS << getName(); } - } else { OS << getName(); } } diff --git a/lib/DebugInfo/PDB/PDBSymbolFuncDebugEnd.cpp b/lib/DebugInfo/PDB/PDBSymbolFuncDebugEnd.cpp index bd4d88834ae..8658be951fa 100644 --- a/lib/DebugInfo/PDB/PDBSymbolFuncDebugEnd.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolFuncDebugEnd.cpp @@ -20,4 +20,4 @@ PDBSymbolFuncDebugEnd::PDBSymbolFuncDebugEnd( : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolFuncDebugEnd::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const {} + PDB_DumpLevel Level, PDB_DumpFlags Flags) const {} diff --git a/lib/DebugInfo/PDB/PDBSymbolFuncDebugStart.cpp b/lib/DebugInfo/PDB/PDBSymbolFuncDebugStart.cpp index 704e7ca0168..64cd3e36705 100644 --- a/lib/DebugInfo/PDB/PDBSymbolFuncDebugStart.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolFuncDebugStart.cpp @@ -20,4 +20,4 @@ PDBSymbolFuncDebugStart::PDBSymbolFuncDebugStart( : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolFuncDebugStart::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const {} + PDB_DumpLevel Level, PDB_DumpFlags Flags) const {} diff --git a/lib/DebugInfo/PDB/PDBSymbolLabel.cpp b/lib/DebugInfo/PDB/PDBSymbolLabel.cpp index 5f2dedf2e30..abb516330de 100644 --- a/lib/DebugInfo/PDB/PDBSymbolLabel.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolLabel.cpp @@ -21,7 +21,7 @@ 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, PDB_DumpFlags Flags) const { OS << stream_indent(Indent); OS << "label [" << format_hex(getRelativeVirtualAddress(), 10) << "] " << getName(); diff --git a/lib/DebugInfo/PDB/PDBSymbolPublicSymbol.cpp b/lib/DebugInfo/PDB/PDBSymbolPublicSymbol.cpp index 5d53a3a130e..a2cea8be82c 100644 --- a/lib/DebugInfo/PDB/PDBSymbolPublicSymbol.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolPublicSymbol.cpp @@ -20,7 +20,7 @@ PDBSymbolPublicSymbol::PDBSymbolPublicSymbol( : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolPublicSymbol::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const { + PDB_DumpLevel Level, PDB_DumpFlags Flags) const { OS << stream_indent(Indent); OS << "public symbol: " << getName(); } diff --git a/lib/DebugInfo/PDB/PDBSymbolThunk.cpp b/lib/DebugInfo/PDB/PDBSymbolThunk.cpp index 985b87ef9d2..c62c96b6ae4 100644 --- a/lib/DebugInfo/PDB/PDBSymbolThunk.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolThunk.cpp @@ -21,7 +21,7 @@ PDBSymbolThunk::PDBSymbolThunk(const IPDBSession &PDBSession, : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolThunk::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const { + PDB_DumpLevel Level, PDB_DumpFlags Flags) const { OS.indent(Indent); OS << "thunk "; PDB_ThunkOrdinal Ordinal = getThunkOrdinal(); diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeArray.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeArray.cpp index ef6bb137a90..b418e3343f6 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypeArray.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypeArray.cpp @@ -21,10 +21,10 @@ 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, PDB_DumpFlags Flags) const { OS << stream_indent(Indent); if (auto ElementType = Session.getSymbolById(getTypeId())) - ElementType->dump(OS, 0, PDB_DumpLevel::Compact); + ElementType->dump(OS, 0, PDB_DumpLevel::Compact, PDB_DF_Children); else OS << ""; OS << "[" << getLength() << "]"; diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeBaseClass.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeBaseClass.cpp index c312d9f3bcb..532e8b8178f 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypeBaseClass.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypeBaseClass.cpp @@ -20,7 +20,7 @@ PDBSymbolTypeBaseClass::PDBSymbolTypeBaseClass( : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolTypeBaseClass::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const { + PDB_DumpLevel Level, PDB_DumpFlags Flags) const { OS << stream_indent(Indent); OS << " " << getName(); } diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp index d51f6530f91..b7afdcddeb0 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp @@ -20,7 +20,7 @@ PDBSymbolTypeBuiltin::PDBSymbolTypeBuiltin( : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolTypeBuiltin::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const { + PDB_DumpLevel Level, PDB_DumpFlags Flags) const { OS << stream_indent(Indent); PDB_BuiltinType Type = getBuiltinType(); OS << Type; diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeCustom.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeCustom.cpp index f09d0a08680..0bfa8eb4e74 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypeCustom.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypeCustom.cpp @@ -20,4 +20,4 @@ PDBSymbolTypeCustom::PDBSymbolTypeCustom(const IPDBSession &PDBSession, : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolTypeCustom::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const {} + PDB_DumpLevel Level, PDB_DumpFlags Flags) const {} diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeDimension.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeDimension.cpp index d36d0cf36e8..84f48ea4310 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypeDimension.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypeDimension.cpp @@ -21,4 +21,4 @@ PDBSymbolTypeDimension::PDBSymbolTypeDimension( : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolTypeDimension::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const {} + PDB_DumpLevel Level, PDB_DumpFlags Flags) const {} diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp index a44acc00915..512b602244f 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp @@ -21,7 +21,7 @@ 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, PDB_DumpFlags Flags) const { OS << stream_indent(Indent); if (Level >= PDB_DumpLevel::Normal) OS << "enum "; @@ -29,7 +29,7 @@ void PDBSymbolTypeEnum::dump(raw_ostream &OS, int Indent, uint32_t ClassId = getClassParentId(); if (ClassId != 0) { if (auto ClassParent = Session.getSymbolById(ClassId)) { - ClassParent->dump(OS, 0, Level); + ClassParent->dump(OS, 0, Level, PDB_DF_Children); OS << "::"; } } diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeFriend.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeFriend.cpp index 405f49a7dbb..236304eb478 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypeFriend.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypeFriend.cpp @@ -20,4 +20,4 @@ PDBSymbolTypeFriend::PDBSymbolTypeFriend(const IPDBSession &PDBSession, : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolTypeFriend::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const {} + PDB_DumpLevel Level, PDB_DumpFlags Flags) const {} diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeFunctionArg.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeFunctionArg.cpp index 30db55ab315..4b8cc26d9f7 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypeFunctionArg.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypeFunctionArg.cpp @@ -21,10 +21,10 @@ PDBSymbolTypeFunctionArg::PDBSymbolTypeFunctionArg( : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolTypeFunctionArg::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const { + PDB_DumpLevel Level, PDB_DumpFlags Flags) const { OS << stream_indent(Indent); uint32_t TypeId = getTypeId(); if (auto Type = Session.getSymbolById(TypeId)) { - Type->dump(OS, 0, Level); + Type->dump(OS, 0, Level, PDB_DF_Children); } } diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp index f9a1bbf74e6..13b89b235dd 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp @@ -87,7 +87,7 @@ void PDBSymbolTypeFunctionSig::dumpArgList(raw_ostream &OS) const { if (auto ChildEnum = getArguments()) { uint32_t Index = 0; while (auto Arg = ChildEnum->getNext()) { - Arg->dump(OS, 0, PDB_DumpLevel::Compact); + Arg->dump(OS, 0, PDB_DumpLevel::Compact, PDB_DF_Children); if (++Index < ChildEnum->getChildCount()) OS << ", "; } @@ -100,18 +100,18 @@ void PDBSymbolTypeFunctionSig::dumpArgList(raw_ostream &OS) const { } void PDBSymbolTypeFunctionSig::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const { + PDB_DumpLevel Level, PDB_DumpFlags Flags) const { OS << stream_indent(Indent); if (auto ReturnType = getReturnType()) { - ReturnType->dump(OS, 0, PDB_DumpLevel::Compact); + ReturnType->dump(OS, 0, PDB_DumpLevel::Compact, PDB_DF_Children); OS << " "; } OS << getCallingConvention() << " "; if (auto ClassParent = getClassParent()) { OS << "("; - ClassParent->dump(OS, 0, PDB_DumpLevel::Compact); + ClassParent->dump(OS, 0, PDB_DumpLevel::Compact, PDB_DF_Children); OS << "::*)"; } diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeManaged.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeManaged.cpp index 4cce8e1c34b..32602dc022b 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypeManaged.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypeManaged.cpp @@ -20,4 +20,4 @@ PDBSymbolTypeManaged::PDBSymbolTypeManaged( : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolTypeManaged::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const {} + PDB_DumpLevel Level, PDB_DumpFlags Flags) const {} diff --git a/lib/DebugInfo/PDB/PDBSymbolTypePointer.cpp b/lib/DebugInfo/PDB/PDBSymbolTypePointer.cpp index 0a4dd230ab4..3461928993a 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypePointer.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypePointer.cpp @@ -22,7 +22,7 @@ PDBSymbolTypePointer::PDBSymbolTypePointer( : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolTypePointer::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const { + PDB_DumpLevel Level, PDB_DumpFlags Flags) const { OS << stream_indent(Indent); if (isConstType()) OS << "const "; @@ -34,12 +34,12 @@ void PDBSymbolTypePointer::dump(raw_ostream &OS, int Indent, // the middle of the signature. if (auto FuncSig = dyn_cast(PointeeType.get())) { if (auto ReturnType = FuncSig->getReturnType()) - ReturnType->dump(OS, 0, PDB_DumpLevel::Compact); + ReturnType->dump(OS, 0, PDB_DumpLevel::Compact, PDB_DF_Children); OS << " (" << FuncSig->getCallingConvention() << " "; OS << ((isReference()) ? "&" : "*") << ")"; FuncSig->dumpArgList(OS); } else { - PointeeType->dump(OS, 0, PDB_DumpLevel::Compact); + PointeeType->dump(OS, 0, PDB_DumpLevel::Compact, PDB_DF_Children); OS << ((isReference()) ? "&" : "*"); } } diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeTypedef.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeTypedef.cpp index 32e5446feef..9554d708222 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypeTypedef.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypeTypedef.cpp @@ -22,7 +22,7 @@ PDBSymbolTypeTypedef::PDBSymbolTypeTypedef( : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolTypeTypedef::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const { + PDB_DumpLevel Level, PDB_DumpFlags Flags) const { OS.indent(Indent); if (Level >= PDB_DumpLevel::Normal) { std::string Name = getName(); @@ -30,7 +30,7 @@ void PDBSymbolTypeTypedef::dump(raw_ostream &OS, int Indent, std::string TargetTypeName; uint32_t TargetId = getTypeId(); if (auto TypeSymbol = Session.getSymbolById(TargetId)) { - TypeSymbol->dump(OS, 0, PDB_DumpLevel::Compact); + TypeSymbol->dump(OS, 0, PDB_DumpLevel::Compact, PDB_DF_Children); } OS << TargetTypeName; } else { diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeUDT.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeUDT.cpp index 96786a2668b..ea884bdac51 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypeUDT.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypeUDT.cpp @@ -21,7 +21,7 @@ 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, PDB_DumpFlags Flags) const { OS << stream_indent(Indent); if (Level >= PDB_DumpLevel::Normal) OS << "class "; @@ -30,7 +30,7 @@ void PDBSymbolTypeUDT::dump(raw_ostream &OS, int Indent, uint32_t ClassId = getClassParentId(); if (ClassId != 0) { if (auto ClassParent = Session.getSymbolById(ClassId)) { - ClassParent->dump(OS, 0, Level); + ClassParent->dump(OS, 0, Level, PDB_DF_Children); OS << "::"; } } diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeVTable.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeVTable.cpp index 7002008841d..4c1f05ea0d3 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypeVTable.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypeVTable.cpp @@ -23,11 +23,11 @@ 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, PDB_DumpFlags Flags) const { OS << stream_indent(Indent); uint32_t ClassId = getClassParentId(); if (auto ClassParent = Session.getSymbolById(ClassId)) { - ClassParent->dump(OS, 0, PDB_DumpLevel::Compact); + ClassParent->dump(OS, 0, PDB_DumpLevel::Compact, PDB_DF_Children); OS << "::"; } OS << " "; @@ -38,5 +38,4 @@ void PDBSymbolTypeVTable::dump(raw_ostream &OS, int Indent, VtblPointer->getTypeId())) OS << "(" << VtblShape->getCount() << " entries)"; } - OS.flush(); } diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeVTableShape.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeVTableShape.cpp index 7ea4da2f741..cff0d03c4cf 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypeVTableShape.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypeVTableShape.cpp @@ -20,4 +20,4 @@ PDBSymbolTypeVTableShape::PDBSymbolTypeVTableShape( : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolTypeVTableShape::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const {} + PDB_DumpLevel Level, PDB_DumpFlags Flags) const {} diff --git a/lib/DebugInfo/PDB/PDBSymbolUnknown.cpp b/lib/DebugInfo/PDB/PDBSymbolUnknown.cpp index 97e4a9156ef..b7b4c38f24d 100644 --- a/lib/DebugInfo/PDB/PDBSymbolUnknown.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolUnknown.cpp @@ -20,4 +20,4 @@ PDBSymbolUnknown::PDBSymbolUnknown(const IPDBSession &PDBSession, : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolUnknown::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const {} + PDB_DumpLevel Level, PDB_DumpFlags Flags) const {} diff --git a/lib/DebugInfo/PDB/PDBSymbolUsingNamespace.cpp b/lib/DebugInfo/PDB/PDBSymbolUsingNamespace.cpp index fea984408a9..077d2b3a3ae 100644 --- a/lib/DebugInfo/PDB/PDBSymbolUsingNamespace.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolUsingNamespace.cpp @@ -20,4 +20,4 @@ PDBSymbolUsingNamespace::PDBSymbolUsingNamespace( : PDBSymbol(PDBSession, std::move(Symbol)) {} void PDBSymbolUsingNamespace::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level) const {} + PDB_DumpLevel Level, PDB_DumpFlags Flags) const {} diff --git a/tools/llvm-pdbdump/llvm-pdbdump.cpp b/tools/llvm-pdbdump/llvm-pdbdump.cpp index 49a7c8147fc..1254a53a8d1 100644 --- a/tools/llvm-pdbdump/llvm-pdbdump.cpp +++ b/tools/llvm-pdbdump/llvm-pdbdump.cpp @@ -38,15 +38,78 @@ using namespace llvm; namespace opts { + +enum class PDB_DumpType { ByType, ByObjFile, Both }; + cl::list InputFilenames(cl::Positional, cl::desc(""), cl::OneOrMore); -cl::opt Compilands("compilands", - cl::desc("Display a list of compilands (e.g. object " - "files) and symbols for each one.")); -cl::alias CompilandsShort("c", cl::desc("Alias for --compilands"), - cl::aliasopt(Compilands)); +cl::opt DumpHidden( + "hidden", + cl::desc("Attempt to find hidden symbols. This can find additional\n" + "symbols that cannot be found otherwise. For example, vtables\n" + "can only be found with an exhaustive search such as this. Be\n" + "warned that the performance can be prohibitive on large PDB " + "files.")); + +cl::opt DumpAll( + "all", + cl::desc("Specifies all other options except -hidden and -group-by")); +cl::opt DumpObjFiles("compilands", cl::desc("Display object files")); +cl::opt DumpFuncs("functions", cl::desc("Display function information")); +cl::opt DumpData( + "data", + cl::desc("Display global, class, and constant variable information.")); +cl::opt DumpLabels("labels", cl::desc("Display labels")); +cl::opt DumpPublic("public", cl::desc("Display public symbols")); +cl::opt DumpClasses("classes", cl::desc("Display class type information")); +cl::opt DumpEnums("enums", cl::desc("Display enum information")); +cl::opt DumpFuncsigs("funcsigs", + cl::desc("Display unique function signatures")); +cl::opt DumpTypedefs("typedefs", cl::desc("Display typedefs")); +cl::opt DumpThunks("thunks", cl::desc("Display thunks")); +cl::opt DumpVtables( + "vtables", + cl::desc("Display virtual function tables (only with --exhaustive)")); + +static cl::opt DumpMode( + "group-by", cl::init(PDB_DumpType::ByType), cl::desc("Dump mode:"), + cl::values( + clEnumValN(PDB_DumpType::ByType, "type", + "(Default) Display symbols grouped by type"), + clEnumValN(PDB_DumpType::ByObjFile, "compiland", + "Display symbols grouped under their containing object " + "file."), + clEnumValN( + PDB_DumpType::Both, "both", + "Display symbols grouped by type, and then by object file."))); +} + +#define SET_DUMP_FLAG_FROM_OPT(Var, Flag, Opt) \ + if (opts::Opt) \ + Var |= Flag; + +PDB_DumpFlags CalculateDumpFlags() { + PDB_DumpFlags Flags = PDB_DF_None; + + SET_DUMP_FLAG_FROM_OPT(Flags, PDB_DF_Hidden, DumpHidden) + + if (opts::DumpAll) + return Flags | PDB_DF_All; + + SET_DUMP_FLAG_FROM_OPT(Flags, PDB_DF_ObjFiles, DumpObjFiles) + SET_DUMP_FLAG_FROM_OPT(Flags, PDB_DF_Functions, DumpFuncs) + SET_DUMP_FLAG_FROM_OPT(Flags, PDB_DF_Data, DumpData) + SET_DUMP_FLAG_FROM_OPT(Flags, PDB_DF_Labels, DumpLabels) + SET_DUMP_FLAG_FROM_OPT(Flags, PDB_DF_PublicSyms, DumpPublic) + SET_DUMP_FLAG_FROM_OPT(Flags, PDB_DF_Classes, DumpClasses) + SET_DUMP_FLAG_FROM_OPT(Flags, PDB_DF_Enums, DumpEnums) + SET_DUMP_FLAG_FROM_OPT(Flags, PDB_DF_Funcsigs, DumpFuncsigs) + SET_DUMP_FLAG_FROM_OPT(Flags, PDB_DF_Typedefs, DumpTypedefs) + SET_DUMP_FLAG_FROM_OPT(Flags, PDB_DF_Thunks, DumpThunks) + SET_DUMP_FLAG_FROM_OPT(Flags, PDB_DF_VTables, DumpVtables) + return Flags; } static void dumpInput(StringRef Path) { @@ -57,15 +120,19 @@ static void dumpInput(StringRef Path) { outs() << " is available for your platform."; return; } + PDB_DumpFlags Flags = CalculateDumpFlags(); + if (opts::DumpMode != opts::PDB_DumpType::ByObjFile) + Flags |= PDB_DF_Children; auto GlobalScope(Session->getGlobalScope()); - GlobalScope->dump(outs(), 0, PDB_DumpLevel::Normal); - outs().flush(); + GlobalScope->dump(outs(), 0, PDB_DumpLevel::Normal, Flags); + outs() << "\n"; - if (opts::Compilands) { + if (opts::DumpMode != opts::PDB_DumpType::ByType) { auto Compilands = GlobalScope->findAllChildren(); while (auto Compiland = Compilands->getNext()) { - Compiland->dump(outs(), 0, PDB_DumpLevel::Detailed); + Compiland->dump(outs(), 0, PDB_DumpLevel::Detailed, + Flags | PDB_DF_Children); outs() << "\n"; } }