diff options
author | gbreynoo <Owen.Reynolds@sony.com> | 2021-05-07 11:21:51 +0100 |
---|---|---|
committer | gbreynoo <Owen.Reynolds@sony.com> | 2021-05-07 11:23:05 +0100 |
commit | f0762fc42f0f4ecf849bef42eed2bb4c0785ea67 (patch) | |
tree | 2e99c1a3fe005267635719fd6fef3fcfa0af14b6 | |
parent | e805b7c2d63c1f8b74f228718a55536f54ddd1c0 (diff) | |
download | llvm-f0762fc42f0f4ecf849bef42eed2bb4c0785ea67.zip llvm-f0762fc42f0f4ecf849bef42eed2bb4c0785ea67.tar.gz llvm-f0762fc42f0f4ecf849bef42eed2bb4c0785ea67.tar.bz2 |
[llvm-dwarfdump] Help option output should be consistent with the command guide
The dwarfdump command guide shows the short options used as aliases but
these are not found in the help text unless --show-hidden is used.
Investigating other tools some follow this pattern, others like
llvm-objdump show aliases with --help. This change fixes the help output
to be consistent with the command guide. This includes updating alias
descriptions in the help output to use "--".
As part of this change I updated cmdline.test, including some options
that were missing testing.
Differential Revision: https://reviews.llvm.org/D101646
-rw-r--r-- | llvm/test/tools/llvm-dwarfdump/cmdline.test | 53 | ||||
-rw-r--r-- | llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 42 |
2 files changed, 72 insertions, 23 deletions
diff --git a/llvm/test/tools/llvm-dwarfdump/cmdline.test b/llvm/test/tools/llvm-dwarfdump/cmdline.test index 11f6b15d..1916ed73 100644 --- a/llvm/test/tools/llvm-dwarfdump/cmdline.test +++ b/llvm/test/tools/llvm-dwarfdump/cmdline.test @@ -8,24 +8,67 @@ HELP: --help HELP: --help-list HELP: --version HELP: Section-specific Dump Options -HELP: --debug-info[=<offset>] - Dump the .debug_info section +HELP: -a - Alias for --all +HELP: --all - Dump all debug info sections +HELP: --apple-names - Dump the .apple_names section +HELP: --apple-namespaces - Dump the .apple_namespaces section +HELP: --apple-objc - Dump the .apple_objc section +HELP: --apple-types - Dump the .apple_types section +HELP: --debug-abbrev - Dump the .debug_abbrev section +HELP: --debug-addr - Dump the .debug_addr section +HELP: --debug-aranges - Dump the .debug_aranges section +HELP: --debug-cu-index - Dump the .debug_cu_index section +HELP: --debug-frame[=<offset>] - Dump the .debug_frame section +HELP: --debug-gnu-pubnames - Dump the .debug_gnu_pubnames section +HELP: --debug-gnu-pubtypes - Dump the .debug_gnu_pubtypes section +HELP: --debug-info[=<offset>] - Dump the .debug_info section +HELP: --debug-line[=<offset>] - Dump the .debug_line section +HELP: --debug-line-str - Dump the .debug_line_str section +HELP: --debug-loc[=<offset>] - Dump the .debug_loc section +HELP: --debug-loclists[=<offset>] - Dump the .debug_loclists section +HELP: --debug-macro - Dump the .debug_macro section HELP: --debug-names - Dump the .debug_names section -HELP: --eh-frame - Alias for -debug-frame +HELP: --debug-pubnames - Dump the .debug_pubnames section +HELP: --debug-pubtypes - Dump the .debug_pubtypes section +HELP: --debug-ranges - Dump the .debug_ranges section +HELP: --debug-rnglists - Dump the .debug_rnglists section +HELP: --debug-str - Dump the .debug_str section +HELP: --debug-str-offsets - Dump the .debug_str_offsets section +HELP: --debug-tu-index - Dump the .debug_tu_index section +HELP: --debug-types[=<offset>] - Dump the .debug_types section +HELP: --eh-frame - Alias for --debug-frame +HELP: --gdb-index - Dump the .gdb_index section HELP: Specific Options +HELP: -F +HELP: --arch=<string> +HELP: -c HELP: --diff -HELP: --find +HELP: -f +HELP: --find=<name> +HELP: -i HELP: --ignore-case -HELP: --lookup -HELP: --name +HELP: --lookup=<address> +HELP: -n +HELP: --name=<pattern> HELP: -o=<filename> +HELP: -p HELP: --parent-recurse-depth=<N> +HELP: --quiet +HELP: -r HELP: --recurse-depth=<N> HELP: --regex HELP: --show-children HELP: --show-form HELP: --show-parents +HELP: --show-section-sizes HELP: --statistics HELP: --summarize-types +HELP: -u +HELP: --uuid +HELP: -v +HELP: --verbose +HELP: --verify +HELP: -x HELP: @FILE RUN: llvm-dwarfdump --version 2>&1 | FileCheck --check-prefix=VERSION %s diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index 642e452..78665c0 100644 --- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -130,7 +130,8 @@ cl::OptionCategory SectionCategory("Section-specific Dump Options", static opt<bool> DumpAll("all", desc("Dump all debug info sections"), cat(SectionCategory)); -static alias DumpAllAlias("a", desc("Alias for -all"), aliasopt(DumpAll)); +static alias DumpAllAlias("a", desc("Alias for --all"), aliasopt(DumpAll), + cl::NotHidden); // Options for dumping specific sections. static unsigned DumpType = DIDT_Null; @@ -143,7 +144,7 @@ static std::array<llvm::Optional<uint64_t>, (unsigned)DIDT_ID_Count> #include "llvm/BinaryFormat/Dwarf.def" #undef HANDLE_DWARF_SECTION -static alias DumpDebugFrameAlias("eh-frame", desc("Alias for -debug-frame"), +static alias DumpDebugFrameAlias("eh-frame", desc("Alias for --debug-frame"), NotHidden, cat(SectionCategory), aliasopt(DumpDebugFrame)); static list<std::string> @@ -164,19 +165,21 @@ static list<std::string> "accelerator tables are available, the slower but more complete " "-name option can be used instead."), value_desc("name"), cat(DwarfDumpCategory)); -static alias FindAlias("f", desc("Alias for -find."), aliasopt(Find)); +static alias FindAlias("f", desc("Alias for --find."), aliasopt(Find), + cl::NotHidden); static opt<bool> IgnoreCase("ignore-case", desc("Ignore case distinctions when searching."), value_desc("i"), cat(DwarfDumpCategory)); -static alias IgnoreCaseAlias("i", desc("Alias for -ignore-case."), - aliasopt(IgnoreCase)); +static alias IgnoreCaseAlias("i", desc("Alias for --ignore-case."), + aliasopt(IgnoreCase), cl::NotHidden); static list<std::string> Name( "name", desc("Find and print all debug info entries whose name (DW_AT_name " "attribute) matches the exact text in <pattern>. When used with the " "the -regex option <pattern> is interpreted as a regular expression."), value_desc("pattern"), cat(DwarfDumpCategory)); -static alias NameAlias("n", desc("Alias for -name"), aliasopt(Name)); +static alias NameAlias("n", desc("Alias for --name"), aliasopt(Name), + cl::NotHidden); static opt<uint64_t> Lookup("lookup", desc("Lookup <address> in the debug information and print out any " @@ -193,34 +196,36 @@ static opt<bool> desc("Treat any <pattern> strings as regular expressions when " "searching instead of just as an exact string match."), cat(DwarfDumpCategory)); -static alias RegexAlias("x", desc("Alias for -regex"), aliasopt(UseRegex)); +static alias RegexAlias("x", desc("Alias for --regex"), aliasopt(UseRegex), + cl::NotHidden); static opt<bool> ShowChildren("show-children", desc("Show a debug info entry's children when selectively " "printing entries."), cat(DwarfDumpCategory)); -static alias ShowChildrenAlias("c", desc("Alias for -show-children."), - aliasopt(ShowChildren)); +static alias ShowChildrenAlias("c", desc("Alias for --show-children."), + aliasopt(ShowChildren), cl::NotHidden); static opt<bool> ShowParents("show-parents", desc("Show a debug info entry's parents when selectively " "printing entries."), cat(DwarfDumpCategory)); -static alias ShowParentsAlias("p", desc("Alias for -show-parents."), - aliasopt(ShowParents)); +static alias ShowParentsAlias("p", desc("Alias for --show-parents."), + aliasopt(ShowParents), cl::NotHidden); static opt<bool> ShowForm("show-form", desc("Show DWARF form types after the DWARF attribute types."), cat(DwarfDumpCategory)); -static alias ShowFormAlias("F", desc("Alias for -show-form."), - aliasopt(ShowForm), cat(DwarfDumpCategory)); +static alias ShowFormAlias("F", desc("Alias for --show-form."), + aliasopt(ShowForm), cat(DwarfDumpCategory), + cl::NotHidden); static opt<unsigned> ChildRecurseDepth("recurse-depth", desc("Only recurse to a depth of N when displaying " "children of debug info entries."), cat(DwarfDumpCategory), init(-1U), value_desc("N")); -static alias ChildRecurseDepthAlias("r", desc("Alias for -recurse-depth."), - aliasopt(ChildRecurseDepth)); +static alias ChildRecurseDepthAlias("r", desc("Alias for --recurse-depth."), + aliasopt(ChildRecurseDepth), cl::NotHidden); static opt<unsigned> ParentRecurseDepth("parent-recurse-depth", desc("Only recurse to a depth of N when displaying " @@ -245,12 +250,13 @@ static opt<bool> Quiet("quiet", desc("Use with -verify to not emit to STDOUT."), cat(DwarfDumpCategory)); static opt<bool> DumpUUID("uuid", desc("Show the UUID for each architecture."), cat(DwarfDumpCategory)); -static alias DumpUUIDAlias("u", desc("Alias for -uuid."), aliasopt(DumpUUID)); +static alias DumpUUIDAlias("u", desc("Alias for --uuid."), aliasopt(DumpUUID), + cl::NotHidden); 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)); +static alias VerboseAlias("v", desc("Alias for --verbose."), aliasopt(Verbose), + cat(DwarfDumpCategory), cl::NotHidden); static cl::extrahelp HelpResponse("\nPass @FILE as argument to read options from FILE.\n"); } // namespace |