llvm-pdbutil.h 6.8 KB

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