1 | //===- llvm-pdbutil.h ----------------------------------------- *- C++ --*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef LLVM_TOOLS_LLVMPDBDUMP_LLVMPDBDUMP_H |
10 | #define LLVM_TOOLS_LLVMPDBDUMP_LLVMPDBDUMP_H |
11 | |
12 | #include "llvm/ADT/PointerUnion.h" |
13 | #include "llvm/DebugInfo/PDB/Native/LinePrinter.h" |
14 | #include "llvm/Support/CommandLine.h" |
15 | #include "llvm/Support/raw_ostream.h" |
16 | |
17 | #include <memory> |
18 | #include <stdint.h> |
19 | |
20 | namespace llvm { |
21 | namespace object { |
22 | class COFFObjectFile; |
23 | } |
24 | namespace pdb { |
25 | class PDBSymbolData; |
26 | class PDBSymbolFunc; |
27 | class PDBFile; |
28 | uint32_t getTypeLength(const PDBSymbolData &Symbol); |
29 | } |
30 | typedef llvm::PointerUnion<object::COFFObjectFile *, pdb::PDBFile *> |
31 | PdbOrCoffObj; |
32 | } |
33 | |
34 | namespace opts { |
35 | |
36 | enum class DumpLevel { None, Basic, Verbose }; |
37 | |
38 | enum class ModuleSubsection { |
39 | Unknown, |
40 | Lines, |
41 | FileChecksums, |
42 | InlineeLines, |
43 | CrossScopeImports, |
44 | CrossScopeExports, |
45 | StringTable, |
46 | Symbols, |
47 | FrameData, |
48 | CoffSymbolRVAs, |
49 | All |
50 | }; |
51 | |
52 | extern FilterOptions Filters; |
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> Funcsigs; |
86 | extern llvm::cl::opt<bool> Arrays; |
87 | extern llvm::cl::opt<bool> Typedefs; |
88 | extern llvm::cl::opt<bool> Pointers; |
89 | extern llvm::cl::opt<bool> VTShapes; |
90 | extern llvm::cl::opt<bool> All; |
91 | extern llvm::cl::opt<bool> ExcludeCompilerGenerated; |
92 | |
93 | extern llvm::cl::opt<bool> NoEnumDefs; |
94 | extern llvm::cl::list<std::string> ExcludeTypes; |
95 | extern llvm::cl::list<std::string> ExcludeSymbols; |
96 | extern llvm::cl::list<std::string> ExcludeCompilands; |
97 | extern llvm::cl::list<std::string> IncludeTypes; |
98 | extern llvm::cl::list<std::string> IncludeSymbols; |
99 | extern llvm::cl::list<std::string> IncludeCompilands; |
100 | extern llvm::cl::opt<SymbolSortMode> SymbolOrder; |
101 | extern llvm::cl::opt<ClassSortMode> ClassOrder; |
102 | extern llvm::cl::opt<uint32_t> SizeThreshold; |
103 | extern llvm::cl::opt<uint32_t> PaddingThreshold; |
104 | extern llvm::cl::opt<uint32_t> ImmediatePaddingThreshold; |
105 | extern llvm::cl::opt<ClassDefinitionFormat> ClassFormat; |
106 | extern llvm::cl::opt<uint32_t> ClassRecursionDepth; |
107 | } |
108 | |
109 | namespace bytes { |
110 | struct NumberRange { |
111 | uint64_t Min; |
112 | std::optional<uint64_t> Max; |
113 | }; |
114 | |
115 | extern std::optional<NumberRange> DumpBlockRange; |
116 | extern std::optional<NumberRange> DumpByteRange; |
117 | extern llvm::cl::list<std::string> DumpStreamData; |
118 | extern llvm::cl::opt<bool> NameMap; |
119 | extern llvm::cl::opt<bool> Fpm; |
120 | |
121 | extern llvm::cl::opt<bool> SectionContributions; |
122 | extern llvm::cl::opt<bool> SectionMap; |
123 | extern llvm::cl::opt<bool> ModuleInfos; |
124 | extern llvm::cl::opt<bool> FileInfo; |
125 | extern llvm::cl::opt<bool> TypeServerMap; |
126 | extern llvm::cl::opt<bool> ECData; |
127 | |
128 | extern llvm::cl::list<uint32_t> TypeIndex; |
129 | extern llvm::cl::list<uint32_t> IdIndex; |
130 | |
131 | extern llvm::cl::opt<uint32_t> ModuleIndex; |
132 | extern llvm::cl::opt<bool> ModuleSyms; |
133 | extern llvm::cl::opt<bool> ModuleC11; |
134 | extern llvm::cl::opt<bool> ModuleC13; |
135 | extern llvm::cl::opt<bool> SplitChunks; |
136 | } // namespace bytes |
137 | |
138 | namespace dump { |
139 | |
140 | extern llvm::cl::opt<bool> DumpSummary; |
141 | extern llvm::cl::opt<bool> DumpFpm; |
142 | extern llvm::cl::opt<bool> DumpStreams; |
143 | extern llvm::cl::opt<bool> DumpSymbolStats; |
144 | extern llvm::cl::opt<bool> DumpTypeStats; |
145 | extern llvm::cl::opt<bool> DumpIDStats; |
146 | extern llvm::cl::opt<bool> DumpUdtStats; |
147 | extern llvm::cl::opt<bool> DumpStreamBlocks; |
148 | |
149 | extern llvm::cl::opt<bool> DumpLines; |
150 | extern llvm::cl::opt<bool> DumpInlineeLines; |
151 | extern llvm::cl::opt<bool> DumpXmi; |
152 | extern llvm::cl::opt<bool> DumpXme; |
153 | extern llvm::cl::opt<bool> DumpNamedStreams; |
154 | extern llvm::cl::opt<bool> DumpStringTable; |
155 | extern llvm::cl::opt<bool> DumpStringTableDetails; |
156 | extern llvm::cl::opt<bool> DumpTypes; |
157 | extern llvm::cl::opt<bool> DumpTypeData; |
158 | extern llvm::cl::opt<bool> ; |
159 | extern llvm::cl::list<uint32_t> DumpTypeIndex; |
160 | extern llvm::cl::opt<bool> DumpTypeDependents; |
161 | extern llvm::cl::opt<bool> DumpTypeRefStats; |
162 | extern llvm::cl::opt<bool> ; |
163 | |
164 | extern llvm::cl::opt<bool> DumpIds; |
165 | extern llvm::cl::opt<bool> DumpIdData; |
166 | extern llvm::cl::opt<bool> ; |
167 | extern llvm::cl::list<uint32_t> DumpIdIndex; |
168 | extern llvm::cl::opt<uint32_t> DumpModi; |
169 | extern llvm::cl::opt<bool> JustMyCode; |
170 | extern llvm::cl::opt<bool> DontResolveForwardRefs; |
171 | extern llvm::cl::opt<bool> DumpSymbols; |
172 | extern llvm::cl::opt<bool> DumpSymRecordBytes; |
173 | extern llvm::cl::opt<bool> DumpGSIRecords; |
174 | extern llvm::cl::opt<bool> DumpGlobals; |
175 | extern llvm::cl::list<std::string> DumpGlobalNames; |
176 | extern llvm::cl::opt<bool> ; |
177 | extern llvm::cl::opt<bool> DumpPublics; |
178 | extern llvm::cl::opt<bool> ; |
179 | extern llvm::cl::opt<bool> DumpSectionContribs; |
180 | extern llvm::cl::opt<bool> DumpSectionMap; |
181 | extern llvm::cl::opt<bool> DumpModules; |
182 | extern llvm::cl::opt<bool> DumpModuleFiles; |
183 | extern llvm::cl::opt<bool> DumpFpo; |
184 | extern llvm::cl::opt<bool> RawAll; |
185 | } |
186 | |
187 | namespace pdb2yaml { |
188 | extern llvm::cl::opt<bool> All; |
189 | extern llvm::cl::opt<bool> ; |
190 | extern llvm::cl::opt<bool> Minimal; |
191 | extern llvm::cl::opt<bool> StreamMetadata; |
192 | extern llvm::cl::opt<bool> StreamDirectory; |
193 | extern llvm::cl::opt<bool> StringTable; |
194 | extern llvm::cl::opt<bool> PdbStream; |
195 | extern llvm::cl::opt<bool> DbiStream; |
196 | extern llvm::cl::opt<bool> TpiStream; |
197 | extern llvm::cl::opt<bool> IpiStream; |
198 | extern llvm::cl::opt<bool> PublicsStream; |
199 | extern llvm::cl::list<std::string> InputFilename; |
200 | extern llvm::cl::opt<bool> DumpModules; |
201 | extern llvm::cl::opt<bool> DumpModuleFiles; |
202 | extern llvm::cl::list<ModuleSubsection> DumpModuleSubsections; |
203 | extern llvm::cl::opt<bool> DumpModuleSyms; |
204 | } // namespace pdb2yaml |
205 | |
206 | namespace explain { |
207 | enum class InputFileType { PDBFile, PDBStream, DBIStream, Names, ModuleStream }; |
208 | |
209 | extern llvm::cl::list<std::string> InputFilename; |
210 | extern llvm::cl::list<uint64_t> Offsets; |
211 | extern llvm::cl::opt<InputFileType> InputType; |
212 | } // namespace explain |
213 | |
214 | namespace exportstream { |
215 | extern llvm::cl::opt<std::string> OutputFile; |
216 | extern llvm::cl::opt<std::string> Stream; |
217 | extern llvm::cl::opt<bool> ForceName; |
218 | } // namespace exportstream |
219 | } |
220 | |
221 | #endif |
222 | |