|
36 | 36 | using namespace llvm;
|
37 | 37 | using namespace object;
|
38 | 38 |
|
39 |
| -static cl::list<std::string> |
40 |
| -InputFilenames(cl::Positional, cl::desc("<input object files or .dSYM bundles>"), |
41 |
| - cl::ZeroOrMore); |
42 |
| - |
43 |
| -static cl::opt<bool> DumpAll("all", cl::desc("Dump all debug info sections")); |
44 |
| -static cl::alias DumpAllAlias("a", cl::desc("Alias for --all"), |
45 |
| - cl::aliasopt(DumpAll)); |
| 39 | +namespace { |
| 40 | +using namespace llvm::cl; |
| 41 | + |
| 42 | +OptionCategory DwarfDumpCategory("Specific Options"); |
| 43 | +static opt<bool> Help("h", desc("Alias for -help"), Hidden, |
| 44 | + cat(DwarfDumpCategory)); |
| 45 | +static list<std::string> |
| 46 | + InputFilenames(Positional, desc("<input object files or .dSYM bundles>"), |
| 47 | + ZeroOrMore, cat(DwarfDumpCategory)); |
| 48 | + |
| 49 | +cl::OptionCategory |
| 50 | + SectionCategory("Section-specific Dump Options", |
| 51 | + "These control which sections are dumped."); |
| 52 | +static opt<bool> DumpAll("all", desc("Dump all debug info sections"), |
| 53 | + cat(SectionCategory)); |
| 54 | +static alias DumpAllAlias("a", desc("Alias for -all"), aliasopt(DumpAll)); |
46 | 55 |
|
47 | 56 | static uint64_t DumpType = DIDT_Null;
|
48 | 57 | #define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME) \
|
49 |
| - static cl::opt<bool> Dump##ENUM_NAME( \ |
50 |
| - CMDLINE_NAME, cl::desc("Dump the " ELF_NAME " section")); |
| 58 | + static opt<bool> Dump##ENUM_NAME(CMDLINE_NAME, \ |
| 59 | + desc("Dump the " ELF_NAME " section"), \ |
| 60 | + cat(SectionCategory)); |
51 | 61 | #include "llvm/BinaryFormat/Dwarf.def"
|
52 | 62 | #undef HANDLE_DWARF_SECTION
|
53 | 63 |
|
54 |
| -static cl::opt<bool> |
| 64 | +static opt<bool> |
55 | 65 | SummarizeTypes("summarize-types",
|
56 |
| - cl::desc("Abbreviate the description of type unit entries")); |
57 |
| -static cl::opt<bool> Verify("verify", cl::desc("Verify the DWARF debug info")); |
58 |
| -static cl::opt<bool> Quiet("quiet", |
59 |
| - cl::desc("Use with -verify to not emit to STDOUT.")); |
60 |
| -static cl::opt<bool> Verbose("verbose", |
61 |
| - cl::desc("Print more low-level encoding details")); |
62 |
| -static cl::alias VerboseAlias("v", cl::desc("Alias for -verbose"), |
63 |
| - cl::aliasopt(Verbose)); |
| 66 | + desc("Abbreviate the description of type unit entries")); |
| 67 | +static opt<bool> Verify("verify", desc("Verify the DWARF debug info"), |
| 68 | + cat(DwarfDumpCategory)); |
| 69 | +static opt<bool> Quiet("quiet", desc("Use with -verify to not emit to STDOUT."), |
| 70 | + cat(DwarfDumpCategory)); |
| 71 | +static opt<bool> Verbose("verbose", |
| 72 | + desc("Print more low-level encoding details"), |
| 73 | + cat(DwarfDumpCategory)); |
| 74 | +static alias VerboseAlias("v", desc("Alias for -verbose"), aliasopt(Verbose), |
| 75 | + cat(DwarfDumpCategory)); |
| 76 | +} // namespace |
64 | 77 |
|
65 | 78 | static void error(StringRef Filename, std::error_code EC) {
|
66 | 79 | if (!EC)
|
@@ -190,7 +203,16 @@ int main(int argc, char **argv) {
|
190 | 203 | llvm::InitializeAllTargetInfos();
|
191 | 204 | llvm::InitializeAllTargetMCs();
|
192 | 205 |
|
193 |
| - cl::ParseCommandLineOptions(argc, argv, "llvm dwarf dumper\n"); |
| 206 | + HideUnrelatedOptions({&DwarfDumpCategory, &SectionCategory}); |
| 207 | + cl::ParseCommandLineOptions( |
| 208 | + argc, argv, |
| 209 | + "pretty-print DWARF debug information in object files" |
| 210 | + " and debug info archives.\n"); |
| 211 | + |
| 212 | + if (Help) { |
| 213 | + PrintHelpMessage(/*Hidden =*/false, /*Categorized =*/true); |
| 214 | + return 0; |
| 215 | + } |
194 | 216 |
|
195 | 217 | // Defaults to dumping all sections, unless brief mode is specified in which
|
196 | 218 | // case only the .debug_info section in dumped.
|
|
0 commit comments