1 //===- llvm-pdbutil.h ----------------------------------------- *- C++ --*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef LLVM_TOOLS_LLVMPDBDUMP_LLVMPDBDUMP_H 11 #define LLVM_TOOLS_LLVMPDBDUMP_LLVMPDBDUMP_H 12 13 #include "llvm/ADT/DenseMap.h" 14 #include "llvm/ADT/Optional.h" 15 #include "llvm/ADT/PointerUnion.h" 16 #include "llvm/Support/CommandLine.h" 17 #include "llvm/Support/raw_ostream.h" 18 19 #include <memory> 20 #include <stdint.h> 21 22 namespace llvm { 23 namespace object { 24 class COFFObjectFile; 25 } 26 namespace pdb { 27 class PDBSymbolData; 28 class PDBSymbolFunc; 29 class PDBFile; 30 uint32_t getTypeLength(const PDBSymbolData &Symbol); 31 } 32 typedef llvm::PointerUnion<object::COFFObjectFile *, pdb::PDBFile *> 33 PdbOrCoffObj; 34 } 35 36 namespace opts { 37 38 enum class DumpLevel { None, Basic, Verbose }; 39 40 enum class ModuleSubsection { 41 Unknown, 42 Lines, 43 FileChecksums, 44 InlineeLines, 45 CrossScopeImports, 46 CrossScopeExports, 47 StringTable, 48 Symbols, 49 FrameData, 50 CoffSymbolRVAs, 51 All 52 }; 53 54 namespace pretty { 55 56 enum class ClassDefinitionFormat { None, Layout, All }; 57 enum class ClassSortMode { 58 None, 59 Name, 60 Size, 61 Padding, 62 PaddingPct, 63 PaddingImmediate, 64 PaddingPctImmediate 65 }; 66 67 enum class SymbolSortMode { None, Name, Size }; 68 69 enum class SymLevel { Functions, Data, Thunks, All }; 70 71 bool shouldDumpSymLevel(SymLevel Level); 72 bool compareFunctionSymbols( 73 const std::unique_ptr<llvm::pdb::PDBSymbolFunc> &F1, 74 const std::unique_ptr<llvm::pdb::PDBSymbolFunc> &F2); 75 bool compareDataSymbols(const std::unique_ptr<llvm::pdb::PDBSymbolData> &F1, 76 const std::unique_ptr<llvm::pdb::PDBSymbolData> &F2); 77 78 extern llvm::cl::list<std::string> WithName; 79 80 extern llvm::cl::opt<bool> Compilands; 81 extern llvm::cl::opt<bool> Symbols; 82 extern llvm::cl::opt<bool> Globals; 83 extern llvm::cl::opt<bool> Classes; 84 extern llvm::cl::opt<bool> Enums; 85 extern llvm::cl::opt<bool> Typedefs; 86 extern llvm::cl::opt<bool> All; 87 extern llvm::cl::opt<bool> ExcludeCompilerGenerated; 88 89 extern llvm::cl::opt<bool> NoEnumDefs; 90 extern llvm::cl::list<std::string> ExcludeTypes; 91 extern llvm::cl::list<std::string> ExcludeSymbols; 92 extern llvm::cl::list<std::string> ExcludeCompilands; 93 extern llvm::cl::list<std::string> IncludeTypes; 94 extern llvm::cl::list<std::string> IncludeSymbols; 95 extern llvm::cl::list<std::string> IncludeCompilands; 96 extern llvm::cl::opt<SymbolSortMode> SymbolOrder; 97 extern llvm::cl::opt<ClassSortMode> ClassOrder; 98 extern llvm::cl::opt<uint32_t> SizeThreshold; 99 extern llvm::cl::opt<uint32_t> PaddingThreshold; 100 extern llvm::cl::opt<uint32_t> ImmediatePaddingThreshold; 101 extern llvm::cl::opt<ClassDefinitionFormat> ClassFormat; 102 extern llvm::cl::opt<uint32_t> ClassRecursionDepth; 103 } 104 105 namespace bytes { 106 struct NumberRange { 107 uint64_t Min; 108 llvm::Optional<uint64_t> Max; 109 }; 110 111 extern llvm::Optional<NumberRange> DumpBlockRange; 112 extern llvm::Optional<NumberRange> DumpByteRange; 113 extern llvm::cl::list<std::string> DumpStreamData; 114 extern llvm::cl::opt<bool> NameMap; 115 extern llvm::cl::opt<bool> Fpm; 116 117 extern llvm::cl::opt<bool> SectionContributions; 118 extern llvm::cl::opt<bool> SectionMap; 119 extern llvm::cl::opt<bool> ModuleInfos; 120 extern llvm::cl::opt<bool> FileInfo; 121 extern llvm::cl::opt<bool> TypeServerMap; 122 extern llvm::cl::opt<bool> ECData; 123 124 extern llvm::cl::list<uint32_t> TypeIndex; 125 extern llvm::cl::list<uint32_t> IdIndex; 126 127 extern llvm::cl::opt<uint32_t> ModuleIndex; 128 extern llvm::cl::opt<bool> ModuleSyms; 129 extern llvm::cl::opt<bool> ModuleC11; 130 extern llvm::cl::opt<bool> ModuleC13; 131 extern llvm::cl::opt<bool> SplitChunks; 132 } // namespace bytes 133 134 namespace dump { 135 136 extern llvm::cl::opt<bool> DumpSummary; 137 extern llvm::cl::opt<bool> DumpFpm; 138 extern llvm::cl::opt<bool> DumpStreams; 139 extern llvm::cl::opt<bool> DumpSymbolStats; 140 extern llvm::cl::opt<bool> DumpUdtStats; 141 extern llvm::cl::opt<bool> DumpStreamBlocks; 142 143 extern llvm::cl::opt<bool> DumpLines; 144 extern llvm::cl::opt<bool> DumpInlineeLines; 145 extern llvm::cl::opt<bool> DumpXmi; 146 extern llvm::cl::opt<bool> DumpXme; 147 extern llvm::cl::opt<bool> DumpNamedStreams; 148 extern llvm::cl::opt<bool> DumpStringTable; 149 extern llvm::cl::opt<bool> DumpStringTableDetails; 150 extern llvm::cl::opt<bool> DumpTypes; 151 extern llvm::cl::opt<bool> DumpTypeData; 152 extern llvm::cl::opt<bool> DumpTypeExtras; 153 extern llvm::cl::list<uint32_t> DumpTypeIndex; 154 extern llvm::cl::opt<bool> DumpTypeDependents; 155 extern llvm::cl::opt<bool> DumpSectionHeaders; 156 157 extern llvm::cl::opt<bool> DumpIds; 158 extern llvm::cl::opt<bool> DumpIdData; 159 extern llvm::cl::opt<bool> DumpIdExtras; 160 extern llvm::cl::list<uint32_t> DumpIdIndex; 161 extern llvm::cl::opt<uint32_t> DumpModi; 162 extern llvm::cl::opt<bool> JustMyCode; 163 extern llvm::cl::opt<bool> DumpSymbols; 164 extern llvm::cl::opt<bool> DumpSymRecordBytes; 165 extern llvm::cl::opt<bool> DumpGSIRecords; 166 extern llvm::cl::opt<bool> DumpGlobals; 167 extern llvm::cl::opt<bool> DumpGlobalExtras; 168 extern llvm::cl::opt<bool> DumpPublics; 169 extern llvm::cl::opt<bool> DumpPublicExtras; 170 extern llvm::cl::opt<bool> DumpSectionContribs; 171 extern llvm::cl::opt<bool> DumpSectionMap; 172 extern llvm::cl::opt<bool> DumpModules; 173 extern llvm::cl::opt<bool> DumpModuleFiles; 174 extern llvm::cl::opt<bool> RawAll; 175 } 176 177 namespace pdb2yaml { 178 extern llvm::cl::opt<bool> All; 179 extern llvm::cl::opt<bool> NoFileHeaders; 180 extern llvm::cl::opt<bool> Minimal; 181 extern llvm::cl::opt<bool> StreamMetadata; 182 extern llvm::cl::opt<bool> StreamDirectory; 183 extern llvm::cl::opt<bool> StringTable; 184 extern llvm::cl::opt<bool> PdbStream; 185 extern llvm::cl::opt<bool> DbiStream; 186 extern llvm::cl::opt<bool> TpiStream; 187 extern llvm::cl::opt<bool> IpiStream; 188 extern llvm::cl::list<std::string> InputFilename; 189 extern llvm::cl::opt<bool> DumpModules; 190 extern llvm::cl::opt<bool> DumpModuleFiles; 191 extern llvm::cl::list<ModuleSubsection> DumpModuleSubsections; 192 extern llvm::cl::opt<bool> DumpModuleSyms; 193 } // namespace pdb2yaml 194 195 namespace explain { 196 enum class InputFileType { PDBFile, PDBStream, DBIStream, Names, ModuleStream }; 197 198 extern llvm::cl::list<std::string> InputFilename; 199 extern llvm::cl::list<uint64_t> Offsets; 200 extern llvm::cl::opt<InputFileType> InputType; 201 } // namespace explain 202 203 namespace exportstream { 204 extern llvm::cl::opt<std::string> OutputFile; 205 extern llvm::cl::opt<std::string> Stream; 206 extern llvm::cl::opt<bool> ForceName; 207 } // namespace exportstream 208 } 209 210 #endif 211