• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:include +full:- +full:cat

1 //===- llvm-pdbdump.cpp - Dump debug info from a PDB file -------*- C++ -*-===//
8 //===----------------------------------------------------------------------===//
11 // the Microsoft Windows SDK, so will not compile or run on non-Windows
14 //===----------------------------------------------------------------------===//
16 #include "llvm-pdbdump.h"
17 #include "CompilandDumper.h"
18 #include "ExternalSymbolDumper.h"
19 #include "FunctionDumper.h"
20 #include "LLVMOutputStyle.h"
21 #include "LinePrinter.h"
22 #include "OutputStyle.h"
23 #include "TypeDumper.h"
24 #include "VariableDumper.h"
25 #include "YAMLOutputStyle.h"
27 #include "llvm/ADT/ArrayRef.h"
28 #include "llvm/ADT/BitVector.h"
29 #include "llvm/ADT/DenseMap.h"
30 #include "llvm/ADT/StringExtras.h"
31 #include "llvm/Config/config.h"
32 #include "llvm/DebugInfo/CodeView/ByteStream.h"
33 #include "llvm/DebugInfo/PDB/GenericError.h"
34 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
35 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
36 #include "llvm/DebugInfo/PDB/IPDBSession.h"
37 #include "llvm/DebugInfo/PDB/PDB.h"
38 #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
39 #include "llvm/DebugInfo/PDB/PDBSymbolData.h"
40 #include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
41 #include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
42 #include "llvm/DebugInfo/PDB/PDBSymbolThunk.h"
43 #include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
44 #include "llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h"
45 #include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
46 #include "llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h"
47 #include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
48 #include "llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h"
49 #include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
50 #include "llvm/DebugInfo/PDB/Raw/RawError.h"
51 #include "llvm/DebugInfo/PDB/Raw/RawSession.h"
52 #include "llvm/Support/COM.h"
53 #include "llvm/Support/CommandLine.h"
54 #include "llvm/Support/ConvertUTF.h"
55 #include "llvm/Support/FileOutputBuffer.h"
56 #include "llvm/Support/FileSystem.h"
57 #include "llvm/Support/Format.h"
58 #include "llvm/Support/ManagedStatic.h"
59 #include "llvm/Support/MemoryBuffer.h"
60 #include "llvm/Support/PrettyStackTrace.h"
61 #include "llvm/Support/Process.h"
62 #include "llvm/Support/ScopedPrinter.h"
63 #include "llvm/Support/Signals.h"
64 #include "llvm/Support/raw_ostream.h"
76 : ByteStream(MutableArrayRef<uint8_t>(Buffer->getBufferStart(), in FileBufferByteStream()
77 Buffer->getBufferEnd())), in FileBufferByteStream()
81 if (FileBuffer->commit()) in commit()
114 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
116 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
118 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
120 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
121 cl::opt<bool> Types("types", cl::desc("Display types"), cl::cat(TypeCategory),
123 cl::opt<bool> Lines("lines", cl::desc("Line tables"), cl::cat(TypeCategory),
127 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
130 "load-address",
132 cl::cat(OtherOptions), cl::sub(PrettySubcommand));
134 "exclude-types", cl::desc("Exclude types by regular expression"),
135 cl::ZeroOrMore, cl::cat(FilterCategory), cl::sub(PrettySubcommand));
137 "exclude-symbols", cl::desc("Exclude symbols by regular expression"),
138 cl::ZeroOrMore, cl::cat(FilterCategory), cl::sub(PrettySubcommand));
140 "exclude-compilands", cl::desc("Exclude compilands by regular expression"),
141 cl::ZeroOrMore, cl::cat(FilterCategory), cl::sub(PrettySubcommand));
144 "include-types",
145 cl::desc("Include only types which match a regular expression"),
146 cl::ZeroOrMore, cl::cat(FilterCategory), cl::sub(PrettySubcommand));
148 "include-symbols",
149 cl::desc("Include only symbols which match a regular expression"),
150 cl::ZeroOrMore, cl::cat(FilterCategory), cl::sub(PrettySubcommand));
152 "include-compilands",
153 cl::desc("Include only compilands those which match a regular expression"),
154 cl::ZeroOrMore, cl::cat(FilterCategory), cl::sub(PrettySubcommand));
157 "no-compiler-generated",
159 cl::cat(FilterCategory), cl::sub(PrettySubcommand));
161 ExcludeSystemLibraries("no-system-libs",
163 cl::cat(FilterCategory), cl::sub(PrettySubcommand));
164 cl::opt<bool> NoClassDefs("no-class-definitions",
166 cl::cat(FilterCategory), cl::sub(PrettySubcommand));
167 cl::opt<bool> NoEnumDefs("no-enum-definitions",
169 cl::cat(FilterCategory), cl::sub(PrettySubcommand));
182 cl::cat(MsfOptions), cl::sub(RawSubcommand));
183 cl::opt<bool> DumpStreamBlocks("stream-blocks",
185 cl::cat(MsfOptions), cl::sub(RawSubcommand));
186 cl::opt<bool> DumpStreamSummary("stream-summary",
188 cl::cat(MsfOptions), cl::sub(RawSubcommand));
192 DumpTpiRecords("tpi-records",
194 cl::cat(TypeOptions), cl::sub(RawSubcommand));
196 "tpi-record-bytes",
198 cl::cat(TypeOptions), cl::sub(RawSubcommand));
199 cl::opt<bool> DumpTpiHash("tpi-hash", cl::desc("dump CodeView TPI hash stream"),
200 cl::cat(TypeOptions), cl::sub(RawSubcommand));
202 DumpIpiRecords("ipi-records",
204 cl::cat(TypeOptions), cl::sub(RawSubcommand));
206 "ipi-record-bytes",
208 cl::cat(TypeOptions), cl::sub(RawSubcommand));
212 cl::cat(FileOptions), cl::sub(RawSubcommand));
213 cl::opt<bool> DumpModuleFiles("module-files", cl::desc("dump file information"),
214 cl::cat(FileOptions), cl::sub(RawSubcommand));
215 cl::opt<bool> DumpLineInfo("line-info",
217 cl::cat(FileOptions), cl::sub(RawSubcommand));
220 cl::opt<bool> DumpModuleSyms("module-syms", cl::desc("dump module symbols"),
221 cl::cat(SymbolOptions), cl::sub(RawSubcommand));
223 cl::cat(SymbolOptions), cl::sub(RawSubcommand));
225 DumpSymRecordBytes("sym-record-bytes",
227 cl::cat(SymbolOptions), cl::sub(RawSubcommand));
230 cl::opt<bool> DumpSectionContribs("section-contribs",
232 cl::cat(MiscOptions), cl::sub(RawSubcommand));
233 cl::opt<bool> DumpSectionMap("section-map", cl::desc("dump section map"),
234 cl::cat(MiscOptions), cl::sub(RawSubcommand));
235 cl::opt<bool> DumpSectionHeaders("section-headers",
237 cl::cat(MiscOptions), cl::sub(RawSubcommand));
238 cl::opt<bool> DumpFpo("fpo", cl::desc("dump FPO records"), cl::cat(MiscOptions),
242 cl::cat(MiscOptions),
244 cl::opt<std::string> DumpStreamDataName("stream-name",
246 cl::cat(MiscOptions),
250 cl::cat(MiscOptions), cl::sub(RawSubcommand));
269 NoFileHeaders("no-file-headers",
275 "stream-metadata",
279 "stream-directory",
280 cl::desc("Dump each stream's block map (implies -stream-metadata)"),
283 "pdb-stream",
284 cl::desc("Dump the PDB Stream (Stream 1) (implies -stream-metadata)"),
287 "dbi-stream",
288 cl::desc("Dump the DBI Stream (Stream 2) (implies -stream-metadata)"),
301 MemoryBuffer::getFileOrSTDIN(Path, /*FileSize=*/-1, in yamlToPdb()
310 llvm::yaml::Input In(Buffer->getBuffer()); in yamlToPdb()
318 opts::yaml2pdb::YamlPdbOutputFile, YamlObj.Headers->FileSize); in yamlToPdb()
327 ExitOnErr(Builder.setSuperBlock(YamlObj.Headers->SuperBlock)); in yamlToPdb()
331 Builder.setDirectoryBlocks(YamlObj.Headers->DirectoryBlocks); in yamlToPdb()
345 InfoBuilder.setAge(YamlObj.PdbStream->Age); in yamlToPdb()
346 InfoBuilder.setGuid(YamlObj.PdbStream->Guid); in yamlToPdb()
347 InfoBuilder.setSignature(YamlObj.PdbStream->Signature); in yamlToPdb()
348 InfoBuilder.setVersion(YamlObj.PdbStream->Version); in yamlToPdb()
353 DbiBuilder.setAge(YamlObj.DbiStream->Age); in yamlToPdb()
354 DbiBuilder.setBuildNumber(YamlObj.DbiStream->BuildNumber); in yamlToPdb()
355 DbiBuilder.setFlags(YamlObj.DbiStream->Flags); in yamlToPdb()
356 DbiBuilder.setMachineType(YamlObj.DbiStream->MachineType); in yamlToPdb()
357 DbiBuilder.setPdbDllRbld(YamlObj.DbiStream->PdbDllRbld); in yamlToPdb()
358 DbiBuilder.setPdbDllVersion(YamlObj.DbiStream->PdbDllVersion); in yamlToPdb()
359 DbiBuilder.setVersionHeader(YamlObj.DbiStream->VerHeader); in yamlToPdb()
366 ExitOnErr(PdbFile->commit()); in yamlToPdb()
374 PDBFile &File = RS->getPDBFile(); in pdb2Yaml()
378 ExitOnErr(O->dump()); in pdb2Yaml()
386 PDBFile &File = RS->getPDBFile(); in dumpRaw()
389 ExitOnErr(O->dump()); in dumpRaw()
398 Session->setLoadAddress(opts::pretty::LoadAddress); in dumpPretty()
402 auto GlobalScope(Session->getGlobalScope()); in dumpPretty()
403 std::string FileName(GlobalScope->getSymbolsFileName()); in dumpPretty()
420 Printer << ": " << GlobalScope->getGuid(); in dumpPretty()
424 Printer << ": " << GlobalScope->getAge(); in dumpPretty()
429 if (GlobalScope->hasCTypes()) in dumpPretty()
431 if (GlobalScope->hasPrivateSymbols()) in dumpPretty()
438 << "---COMPILANDS---"; in dumpPretty()
440 auto Compilands = GlobalScope->findAllChildren<PDBSymbolCompiland>(); in dumpPretty()
445 while (auto Compiland = Compilands->getNext()) in dumpPretty()
452 WithColor(Printer, PDB_ColorItem::SectionHeader).get() << "---TYPES---"; in dumpPretty()
461 WithColor(Printer, PDB_ColorItem::SectionHeader).get() << "---SYMBOLS---"; in dumpPretty()
463 auto Compilands = GlobalScope->findAllChildren<PDBSymbolCompiland>(); in dumpPretty()
465 while (auto Compiland = Compilands->getNext()) in dumpPretty()
472 WithColor(Printer, PDB_ColorItem::SectionHeader).get() << "---GLOBALS---"; in dumpPretty()
476 auto Functions = GlobalScope->findAllChildren<PDBSymbolFunc>(); in dumpPretty()
477 while (auto Function = Functions->getNext()) { in dumpPretty()
483 auto Vars = GlobalScope->findAllChildren<PDBSymbolData>(); in dumpPretty()
485 while (auto Var = Vars->getNext()) in dumpPretty()
489 auto Thunks = GlobalScope->findAllChildren<PDBSymbolThunk>(); in dumpPretty()
491 while (auto Thunk = Thunks->getNext()) in dumpPretty()
498 WithColor(Printer, PDB_ColorItem::SectionHeader).get() << "---EXTERNALS---"; in dumpPretty()
514 ExitOnErr.setBanner("llvm-pdbdump: "); in main()