Lines Matching +full:sub +full:- +full:module
1 //===- llvm-pdbutil.cpp - Dump debug info from a PDB file -------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
13 #include "llvm-pdbutil.h"
105 "Dump debug information using a DIA-like API");
133 "Cross module exports (DEBUG_S_CROSSSCOPEEXPORTS subsection)"),
135 "Cross module imports (DEBUG_S_CROSSSCOPEIMPORTS subsection)"),
159 cl::OneOrMore, cl::sub(DiaDumpSubcommand));
162 cl::sub(DiaDumpSubcommand));
166 cl::sub(DiaDumpSubcommand));
168 "no-ids",
169 cl::desc("Don't show any SymIndexId fields (overrides -hierarchy)"),
170 cl::sub(DiaDumpSubcommand));
176 cl::sub(DiaDumpSubcommand));
179 cl::sub(DiaDumpSubcommand));
181 cl::sub(DiaDumpSubcommand));
183 cl::sub(DiaDumpSubcommand));
186 cl::sub(DiaDumpSubcommand));
189 cl::sub(DiaDumpSubcommand));
191 cl::sub(DiaDumpSubcommand));
193 cl::sub(DiaDumpSubcommand));
195 cl::sub(DiaDumpSubcommand));
203 cl::OneOrMore, cl::sub(PrettySubcommand));
205 cl::opt<bool> InjectedSources("injected-sources",
207 cl::cat(OtherOptions), cl::sub(PrettySubcommand));
209 "injected-source-content",
211 cl::cat(OtherOptions), cl::sub(PrettySubcommand));
214 "with-name",
216 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
219 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
220 cl::opt<bool> Symbols("module-syms",
222 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
224 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
226 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
228 "sym-types", cl::desc("Type of symbols to dump (default all)"),
229 cl::cat(TypeCategory), cl::sub(PrettySubcommand),
238 cl::desc("Display all types (implies -classes, -enums, -typedefs)"),
239 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
241 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
243 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
245 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
247 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
249 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
251 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
253 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
256 "symbol-order", cl::desc("symbol sort order"),
263 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
266 "class-order", cl::desc("Class sort order"), cl::init(ClassSortMode::None),
274 clEnumValN(ClassSortMode::PaddingPct, "padding-pct",
276 clEnumValN(ClassSortMode::PaddingImmediate, "padding-imm",
278 clEnumValN(ClassSortMode::PaddingPctImmediate, "padding-pct-imm",
281 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
284 "class-definitions", cl::desc("Class definition format"),
294 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
296 "class-recurse-depth", cl::desc("Class recursion depth (0=no limit)"),
297 cl::init(0), cl::cat(TypeCategory), cl::sub(PrettySubcommand));
300 cl::sub(PrettySubcommand));
303 cl::cat(TypeCategory), cl::sub(PrettySubcommand));
306 "load-address",
307 cl::desc("Assume the module is loaded at the specified address"),
308 cl::cat(OtherOptions), cl::sub(PrettySubcommand));
310 cl::cat(OtherOptions), cl::sub(PrettySubcommand));
312 ColorOutput("color-output",
314 cl::cat(OtherOptions), cl::sub(PrettySubcommand));
316 ExcludeTypes("exclude-types",
318 cl::cat(FilterCategory), cl::sub(PrettySubcommand));
320 ExcludeSymbols("exclude-symbols",
322 cl::cat(FilterCategory), cl::sub(PrettySubcommand));
324 ExcludeCompilands("exclude-compilands",
326 cl::cat(FilterCategory), cl::sub(PrettySubcommand));
329 "include-types",
331 cl::cat(FilterCategory), cl::sub(PrettySubcommand));
333 "include-symbols",
335 cl::cat(FilterCategory), cl::sub(PrettySubcommand));
337 "include-compilands",
339 cl::cat(FilterCategory), cl::sub(PrettySubcommand));
341 "min-type-size", cl::desc("Displays only those types which are greater "
343 cl::init(0), cl::cat(FilterCategory), cl::sub(PrettySubcommand));
345 "min-class-padding", cl::desc("Displays only those classes which have at "
347 cl::init(0), cl::cat(FilterCategory), cl::sub(PrettySubcommand));
349 "min-class-padding-imm",
353 cl::init(0), cl::cat(FilterCategory), cl::sub(PrettySubcommand));
356 "no-compiler-generated",
358 cl::cat(FilterCategory), cl::sub(PrettySubcommand));
360 ExcludeSystemLibraries("no-system-libs",
362 cl::cat(FilterCategory), cl::sub(PrettySubcommand));
364 cl::opt<bool> NoEnumDefs("no-enum-definitions",
366 cl::cat(FilterCategory), cl::sub(PrettySubcommand));
369 cl::OptionCategory FileOptions("Module & File Options");
376 cl::OptionCategory ModuleCategory("Module Options");
382 "block-range", cl::value_desc("start[-end]"),
384 cl::sub(BytesSubcommand), cl::cat(MsfBytes));
387 DumpByteRangeOpt("byte-range", cl::value_desc("start[-end]"),
389 cl::sub(BytesSubcommand), cl::cat(MsfBytes));
392 DumpStreamData("stream-data", cl::CommaSeparated,
395 cl::sub(BytesSubcommand), cl::cat(MsfBytes));
397 cl::opt<bool> NameMap("name-map", cl::desc("Dump bytes of PDB Name Map"),
398 cl::sub(BytesSubcommand), cl::cat(PdbBytes));
400 cl::sub(BytesSubcommand), cl::cat(MsfBytes));
403 cl::sub(BytesSubcommand), cl::cat(DbiBytes));
405 cl::sub(BytesSubcommand), cl::cat(DbiBytes));
406 cl::opt<bool> ModuleInfos("modi", cl::desc("Dump module info"),
407 cl::sub(BytesSubcommand), cl::cat(DbiBytes));
409 cl::sub(BytesSubcommand), cl::cat(DbiBytes));
410 cl::opt<bool> TypeServerMap("type-server", cl::desc("Dump type server map"),
411 cl::sub(BytesSubcommand), cl::cat(DbiBytes));
413 cl::sub(BytesSubcommand), cl::cat(DbiBytes));
417 cl::CommaSeparated, cl::sub(BytesSubcommand), cl::cat(TypeCategory));
420 cl::CommaSeparated, cl::sub(BytesSubcommand),
426 "Limit options in the Modules category to the specified module index"),
427 cl::Optional, cl::sub(BytesSubcommand), cl::cat(ModuleCategory));
429 cl::sub(BytesSubcommand), cl::cat(ModuleCategory));
430 cl::opt<bool> ModuleC11("c11-chunks", cl::Hidden,
432 cl::sub(BytesSubcommand), cl::cat(ModuleCategory));
435 cl::sub(BytesSubcommand), cl::cat(ModuleCategory));
437 "split-chunks",
440 cl::sub(BytesSubcommand), cl::cat(ModuleCategory));
443 cl::OneOrMore, cl::sub(BytesSubcommand));
456 cl::cat(MsfOptions), cl::sub(DumpSubcommand));
459 cl::cat(MsfOptions), cl::sub(DumpSubcommand));
461 "stream-blocks",
462 cl::desc("Add block information to the output of -streams"),
463 cl::cat(MsfOptions), cl::sub(DumpSubcommand));
465 "sym-stats",
466 cl::desc("Dump a detailed breakdown of symbol usage/size for each module"),
467 cl::cat(MsfOptions), cl::sub(DumpSubcommand));
469 "type-stats",
471 cl::cat(MsfOptions), cl::sub(DumpSubcommand));
473 "id-stats",
475 cl::cat(MsfOptions), cl::sub(DumpSubcommand));
477 "udt-stats",
479 cl::cat(MsfOptions), cl::sub(DumpSubcommand));
484 cl::cat(TypeOptions), cl::sub(DumpSubcommand));
486 "type-data",
488 cl::cat(TypeOptions), cl::sub(DumpSubcommand));
490 DumpTypeRefStats("type-ref-stats",
493 cl::cat(TypeOptions), cl::sub(DumpSubcommand));
495 cl::opt<bool> DumpTypeExtras("type-extras",
497 cl::cat(TypeOptions), cl::sub(DumpSubcommand));
500 "dont-resolve-forward-refs",
503 cl::cat(TypeOptions), cl::sub(DumpSubcommand));
506 "type-index", cl::CommaSeparated,
508 cl::cat(TypeOptions), cl::sub(DumpSubcommand));
512 cl::cat(TypeOptions), cl::sub(DumpSubcommand));
514 DumpIdData("id-data",
516 cl::cat(TypeOptions), cl::sub(DumpSubcommand));
518 cl::opt<bool> DumpIdExtras("id-extras",
520 cl::cat(TypeOptions), cl::sub(DumpSubcommand));
522 "id-index", cl::CommaSeparated,
524 cl::cat(TypeOptions), cl::sub(DumpSubcommand));
528 cl::desc("In conjunection with -type-index and -id-index, dumps the entire "
531 cl::cat(TypeOptions), cl::sub(DumpSubcommand));
535 cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
536 cl::opt<bool> DumpGlobalExtras("global-extras", cl::desc("dump Globals hashes"),
537 cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
539 "global-name",
541 "With -globals, only dump globals whose name matches the given value"),
542 cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
544 cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
545 cl::opt<bool> DumpPublicExtras("public-extras",
547 cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
549 DumpGSIRecords("gsi-records",
551 cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
552 cl::opt<bool> DumpSymbols("symbols", cl::desc("dump module symbols"),
553 cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
556 DumpSymRecordBytes("sym-data",
558 cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
561 cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
564 "symbol-offset", cl::Optional,
566 cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
567 cl::opt<bool> DumpParents("show-parents",
569 cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
571 DumpParentDepth("parent-recurse-depth", cl::Optional, cl::init(-1U),
574 cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
575 cl::opt<bool> DumpChildren("show-children",
577 cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
579 DumpChildrenDepth("children-recurse-depth", cl::Optional, cl::init(-1U),
582 cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
584 // MODULE & FILE OPTIONS
586 cl::cat(FileOptions), cl::sub(DumpSubcommand));
589 cl::desc("Dump the source files that contribute to each module's."),
590 cl::cat(FileOptions), cl::sub(DumpSubcommand));
594 cl::cat(FileOptions), cl::sub(DumpSubcommand));
598 cl::cat(FileOptions), cl::sub(DumpSubcommand));
602 "dump cross module imports (DEBUG_S_CROSSSCOPEIMPORTS subsection)"),
603 cl::cat(FileOptions), cl::sub(DumpSubcommand));
607 "dump cross module exports (DEBUG_S_CROSSSCOPEEXPORTS subsection)"),
608 cl::cat(FileOptions), cl::sub(DumpSubcommand));
611 "modules, limit to the specified module"),
612 cl::cat(FileOptions), cl::sub(DumpSubcommand));
616 cl::cat(FileOptions), cl::sub(DumpSubcommand));
619 cl::opt<bool> DumpNamedStreams("named-streams",
621 cl::cat(MiscOptions), cl::sub(DumpSubcommand));
623 cl::opt<bool> DumpStringTable("string-table", cl::desc("dump PDB String Table"),
624 cl::cat(MiscOptions), cl::sub(DumpSubcommand));
625 cl::opt<bool> DumpStringTableDetails("string-table-details",
628 cl::sub(DumpSubcommand));
630 cl::opt<bool> DumpSectionContribs("section-contribs",
633 cl::sub(DumpSubcommand));
634 cl::opt<bool> DumpSectionMap("section-map", cl::desc("dump section map"),
635 cl::cat(MiscOptions), cl::sub(DumpSubcommand));
636 cl::opt<bool> DumpSectionHeaders("section-headers",
638 cl::cat(MiscOptions), cl::sub(DumpSubcommand));
641 cl::cat(MiscOptions), cl::sub(DumpSubcommand));
645 cl::OneOrMore, cl::sub(DumpSubcommand));
651 cl::sub(YamlToPdbSubcommand));
655 cl::sub(YamlToPdbSubcommand));
661 cl::sub(PdbToYamlSubcommand), cl::init(false));
662 cl::opt<bool> NoFileHeaders("no-file-headers",
664 cl::sub(PdbToYamlSubcommand), cl::init(false));
667 cl::sub(PdbToYamlSubcommand), cl::init(false));
670 "stream-metadata",
672 cl::sub(PdbToYamlSubcommand), cl::init(false));
674 "stream-directory",
675 cl::desc("Dump each stream's block map (implies -stream-metadata)"),
676 cl::sub(PdbToYamlSubcommand), cl::init(false));
677 cl::opt<bool> PdbStream("pdb-stream",
679 cl::sub(PdbToYamlSubcommand), cl::init(false));
681 cl::opt<bool> StringTable("string-table", cl::desc("Dump the PDB String Table"),
682 cl::sub(PdbToYamlSubcommand), cl::init(false));
684 cl::opt<bool> DbiStream("dbi-stream",
686 cl::sub(PdbToYamlSubcommand), cl::init(false));
688 cl::opt<bool> TpiStream("tpi-stream",
690 cl::sub(PdbToYamlSubcommand), cl::init(false));
692 cl::opt<bool> IpiStream("ipi-stream",
694 cl::sub(PdbToYamlSubcommand), cl::init(false));
696 cl::opt<bool> PublicsStream("publics-stream",
698 cl::sub(PdbToYamlSubcommand), cl::init(false));
700 // MODULE & FILE OPTIONS
702 cl::cat(FileOptions), cl::sub(PdbToYamlSubcommand));
703 cl::opt<bool> DumpModuleFiles("module-files", cl::desc("dump file information"),
705 cl::sub(PdbToYamlSubcommand));
708 cl::desc("dump subsections from each module's debug stream"), ChunkValues,
709 cl::cat(FileOptions), cl::sub(PdbToYamlSubcommand));
710 cl::opt<bool> DumpModuleSyms("module-syms", cl::desc("dump module symbols"),
712 cl::sub(PdbToYamlSubcommand));
716 cl::sub(PdbToYamlSubcommand));
722 cl::OneOrMore, cl::sub(MergeSubcommand));
725 cl::sub(MergeSubcommand));
731 cl::sub(ExplainSubcommand));
734 cl::sub(ExplainSubcommand), cl::OneOrMore);
737 "input-type", cl::desc("Specify how to interpret the input file"),
738 cl::init(InputFileType::PDBFile), cl::Optional, cl::sub(ExplainSubcommand),
739 cl::values(clEnumValN(InputFileType::PDBFile, "pdb-file",
741 clEnumValN(InputFileType::PDBStream, "pdb-stream",
743 clEnumValN(InputFileType::DBIStream, "dbi-stream",
745 clEnumValN(InputFileType::Names, "names-stream",
747 clEnumValN(InputFileType::ModuleStream, "mod-stream",
748 "Treat input as raw contents of a module stream")));
754 cl::sub(ExportSubcommand));
757 cl::Required, cl::sub(ExportSubcommand));
761 cl::sub(ExportSubcommand));
763 cl::desc("Force the interpretation of -stream as a "
765 cl::sub(ExportSubcommand), cl::Optional,
784 llvm::yaml::Input In(Buffer->getBuffer()); in yamlToPdb()
792 BlockSize = YamlObj.Headers->SuperBlock.BlockSize; in yamlToPdb()
808 Strings.strings()->insert(S); in yamlToPdb()
849 // Each module has its own checksum subsection, so scan for it every time. in yamlToPdb()
887 return NS->getPDBFile(); in loadPDB()
896 ExitOnErr(O->dump()); in pdb2Yaml()
903 ExitOnErr(O->dump()); in dumpRaw()
912 ExitOnErr(O->dump()); in dumpBytes()
927 const IPDBRawSymbol &RawType = SymbolType->getRawSymbol(); in getTypeLength()
938 return F1->getName() < F2->getName(); in compareFunctionSymbols()
942 return F1->getLength() > F2->getLength(); in compareFunctionSymbols()
951 return F1->getName() < F2->getName(); in compareDataSymbols()
964 if (!Sources || !Sources->getChildCount()) { in dumpInjectedSources()
969 while (auto IS = Sources->getNext()) { in dumpInjectedSources()
971 std::string File = stringOr(IS->getFileName(), "<null>"); in dumpInjectedSources()
972 uint64_t Size = IS->getCodeByteSize(); in dumpInjectedSources()
973 std::string Obj = stringOr(IS->getObjectFileName(), "<null>"); in dumpInjectedSources()
974 std::string VFName = stringOr(IS->getVirtualFileName(), "<null>"); in dumpInjectedSources()
975 uint32_t CRC = IS->getCrc32(); in dumpInjectedSources()
997 IS->getCompression()); in dumpInjectedSources()
1006 if (IS->getCompression() == PDB_SourceCompression::None) in dumpInjectedSources()
1007 Printer.printLine(IS->getCode()); in dumpInjectedSources()
1010 arrayRefFromStringRef(IS->getCode()), in dumpInjectedSources()
1013 // Re-indent back to the original level. in dumpInjectedSources()
1025 auto Children = ConcreteOuter->template findAllChildren<ChildT>(); in diaDumpChildren()
1026 while (auto Child = Children->getNext()) { in diaDumpChildren()
1028 Child->defaultDump(outs(), 4, Ids, Recurse); in diaDumpChildren()
1040 auto GlobalScope = Session->getGlobalScope(); in dumpDia()
1070 auto Children = GlobalScope->findAllChildren(ST); in dumpDia()
1071 while (auto Child = Children->getNext()) { in dumpDia()
1073 Child->defaultDump(outs(), 2, Ids, Recurse); in dumpDia()
1089 Session->setLoadAddress(opts::pretty::LoadAddress); in dumpPretty()
1097 auto GlobalScope(Session->getGlobalScope()); in dumpPretty()
1100 std::string FileName(GlobalScope->getSymbolsFileName()); in dumpPretty()
1117 Printer << ": " << GlobalScope->getGuid(); in dumpPretty()
1121 Printer << ": " << GlobalScope->getAge(); in dumpPretty()
1126 if (GlobalScope->hasCTypes()) in dumpPretty()
1128 if (GlobalScope->hasPrivateSymbols()) in dumpPretty()
1135 << "---SYMBOLS & TYPES BY NAME---"; in dumpPretty()
1138 auto Symbols = GlobalScope->findChildren( in dumpPretty()
1140 if (!Symbols || Symbols->getChildCount() == 0) { in dumpPretty()
1141 Printer.formatLine("[not found] - {0}", Name); in dumpPretty()
1144 Printer.formatLine("[{0} occurrences] - {1}", Symbols->getChildCount(), in dumpPretty()
1150 while (auto Symbol = Symbols->getNext()) { in dumpPretty()
1151 switch (Symbol->getSymTag()) { in dumpPretty()
1176 Symbol->dump(TD); in dumpPretty()
1211 << "---COMPILANDS---"; in dumpPretty()
1212 auto Compilands = GlobalScope->findAllChildren<PDBSymbolCompiland>(); in dumpPretty()
1220 while (auto Compiland = Compilands->getNext()) in dumpPretty()
1230 WithColor(Printer, PDB_ColorItem::SectionHeader).get() << "---TYPES---"; in dumpPretty()
1239 WithColor(Printer, PDB_ColorItem::SectionHeader).get() << "---SYMBOLS---"; in dumpPretty()
1240 if (auto Compilands = GlobalScope->findAllChildren<PDBSymbolCompiland>()) { in dumpPretty()
1243 while (auto Compiland = Compilands->getNext()) in dumpPretty()
1251 WithColor(Printer, PDB_ColorItem::SectionHeader).get() << "---GLOBALS---"; in dumpPretty()
1254 if (auto Functions = GlobalScope->findAllChildren<PDBSymbolFunc>()) { in dumpPretty()
1257 while (auto Function = Functions->getNext()) { in dumpPretty()
1263 while (auto Func = Functions->getNext()) in dumpPretty()
1274 if (auto Vars = GlobalScope->findAllChildren<PDBSymbolData>()) { in dumpPretty()
1277 while (auto Var = Vars->getNext()) in dumpPretty()
1281 while (auto Var = Vars->getNext()) in dumpPretty()
1290 if (auto Thunks = GlobalScope->findAllChildren<PDBSymbolThunk>()) { in dumpPretty()
1292 while (auto Thunk = Thunks->getNext()) in dumpPretty()
1300 WithColor(Printer, PDB_ColorItem::SectionHeader).get() << "---EXTERNALS---"; in dumpPretty()
1311 << "---INJECTED SOURCES---"; in dumpPretty()
1379 ExitOnErr(O->dump()); in explain()
1415 FileOutputBuffer::create(OutFileName, SourceStream->getLength())); in exportStream()
1427 llvm::Regex R("^([^-]+)(-([^-]+))?$"); in parseRange()
1433 if (!to_integer(Matches[1], Parsed->Min)) in parseRange()
1437 Parsed->Max.emplace(); in parseRange()
1438 if (!to_integer(Matches[3], *Parsed->Max)) in parseRange()
1455 ExitOnErr.setBanner("llvm-pdbutil: "); in main()
1551 errs() << "argument '-modi' specified more than once.\n"; in main()
1560 << "need to specify argument '-modi' when using '-symbol-offset'.\n"; in main()