diff options
author | Adrian Prantl <aprantl@apple.com> | 2017-09-12 22:32:53 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2017-09-12 22:32:53 +0000 |
commit | 7c5b45d33039908f96c0ac1fa605a42b6789698e (patch) | |
tree | 2abaea1215f8a72114632600ef932b08e52aa8ac /llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp | |
parent | f922501d98153df01ee12a0b8b7b12ecdef5bfe7 (diff) | |
download | bcm5719-llvm-7c5b45d33039908f96c0ac1fa605a42b6789698e.tar.gz bcm5719-llvm-7c5b45d33039908f96c0ac1fa605a42b6789698e.zip |
Clean up the --help output of llvm-dwarfdump by hiding irrelevant options.
llvm-svn: 313085
Diffstat (limited to 'llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp')
-rw-r--r-- | llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 60 |
1 files changed, 41 insertions, 19 deletions
diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index 5ebcc81ac9c..9fded20eeb5 100644 --- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -36,31 +36,44 @@ using namespace llvm; using namespace object; -static cl::list<std::string> -InputFilenames(cl::Positional, cl::desc("<input object files or .dSYM bundles>"), - cl::ZeroOrMore); - -static cl::opt<bool> DumpAll("all", cl::desc("Dump all debug info sections")); -static cl::alias DumpAllAlias("a", cl::desc("Alias for --all"), - cl::aliasopt(DumpAll)); +namespace { +using namespace llvm::cl; + +OptionCategory DwarfDumpCategory("Specific Options"); +static opt<bool> Help("h", desc("Alias for -help"), Hidden, + cat(DwarfDumpCategory)); +static list<std::string> + InputFilenames(Positional, desc("<input object files or .dSYM bundles>"), + ZeroOrMore, cat(DwarfDumpCategory)); + +cl::OptionCategory + SectionCategory("Section-specific Dump Options", + "These control which sections are dumped."); +static opt<bool> DumpAll("all", desc("Dump all debug info sections"), + cat(SectionCategory)); +static alias DumpAllAlias("a", desc("Alias for -all"), aliasopt(DumpAll)); static uint64_t DumpType = DIDT_Null; #define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME) \ - static cl::opt<bool> Dump##ENUM_NAME( \ - CMDLINE_NAME, cl::desc("Dump the " ELF_NAME " section")); + static opt<bool> Dump##ENUM_NAME(CMDLINE_NAME, \ + desc("Dump the " ELF_NAME " section"), \ + cat(SectionCategory)); #include "llvm/BinaryFormat/Dwarf.def" #undef HANDLE_DWARF_SECTION -static cl::opt<bool> +static opt<bool> SummarizeTypes("summarize-types", - cl::desc("Abbreviate the description of type unit entries")); -static cl::opt<bool> Verify("verify", cl::desc("Verify the DWARF debug info")); -static cl::opt<bool> Quiet("quiet", - cl::desc("Use with -verify to not emit to STDOUT.")); -static cl::opt<bool> Verbose("verbose", - cl::desc("Print more low-level encoding details")); -static cl::alias VerboseAlias("v", cl::desc("Alias for -verbose"), - cl::aliasopt(Verbose)); + desc("Abbreviate the description of type unit entries")); +static opt<bool> Verify("verify", desc("Verify the DWARF debug info"), + cat(DwarfDumpCategory)); +static opt<bool> Quiet("quiet", desc("Use with -verify to not emit to STDOUT."), + cat(DwarfDumpCategory)); +static opt<bool> Verbose("verbose", + desc("Print more low-level encoding details"), + cat(DwarfDumpCategory)); +static alias VerboseAlias("v", desc("Alias for -verbose"), aliasopt(Verbose), + cat(DwarfDumpCategory)); +} // namespace static void error(StringRef Filename, std::error_code EC) { if (!EC) @@ -190,7 +203,16 @@ int main(int argc, char **argv) { llvm::InitializeAllTargetInfos(); llvm::InitializeAllTargetMCs(); - cl::ParseCommandLineOptions(argc, argv, "llvm dwarf dumper\n"); + HideUnrelatedOptions({&DwarfDumpCategory, &SectionCategory}); + cl::ParseCommandLineOptions( + argc, argv, + "pretty-print DWARF debug information in object files" + " and debug info archives.\n"); + + if (Help) { + PrintHelpMessage(/*Hidden =*/false, /*Categorized =*/true); + return 0; + } // Defaults to dumping all sections, unless brief mode is specified in which // case only the .debug_info section in dumped. |