[llvm] r361351 - Properly categorize llvm-objdump options
Serge Guelton via llvm-commits
llvm-commits at lists.llvm.org
Tue May 21 23:30:46 PDT 2019
Author: serge_sans_paille
Date: Tue May 21 23:30:46 2019
New Revision: 361351
URL: http://llvm.org/viewvc/llvm-project?rev=361351&view=rev
Log:
Properly categorize llvm-objdump options
Filters out noise, and distinguish Mach-O related options from others.
Differential Revision: https://reviews.llvm.org/D62195
Modified:
llvm/trunk/tools/llvm-objdump/MachODump.cpp
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=361351&r1=361350&r2=361351&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Tue May 21 23:30:46 2019
@@ -59,6 +59,8 @@ using namespace llvm::object;
namespace llvm {
+cl::OptionCategory MachOCat("llvm-objdump MachO Specific Options");
+
extern cl::opt<bool> ArchiveHeaders;
extern cl::opt<bool> Disassemble;
extern cl::opt<bool> DisassembleAll;
@@ -80,91 +82,113 @@ extern cl::opt<bool> UnwindInfo;
cl::opt<bool>
FirstPrivateHeader("private-header",
cl::desc("Display only the first format specific file "
- "header"));
+ "header"),
+ cl::cat(MachOCat));
cl::opt<bool> ExportsTrie("exports-trie",
- cl::desc("Display mach-o exported symbols"));
+ cl::desc("Display mach-o exported symbols"),
+ cl::cat(MachOCat));
-cl::opt<bool> Rebase("rebase", cl::desc("Display mach-o rebasing info"));
+cl::opt<bool> Rebase("rebase", cl::desc("Display mach-o rebasing info"),
+ cl::cat(MachOCat));
-cl::opt<bool> Bind("bind", cl::desc("Display mach-o binding info"));
+cl::opt<bool> Bind("bind", cl::desc("Display mach-o binding info"),
+ cl::cat(MachOCat));
cl::opt<bool> LazyBind("lazy-bind",
- cl::desc("Display mach-o lazy binding info"));
+ cl::desc("Display mach-o lazy binding info"),
+ cl::cat(MachOCat));
cl::opt<bool> WeakBind("weak-bind",
- cl::desc("Display mach-o weak binding info"));
+ cl::desc("Display mach-o weak binding info"),
+ cl::cat(MachOCat));
static cl::opt<bool>
UseDbg("g", cl::Grouping,
- cl::desc("Print line information from debug info if available"));
+ cl::desc("Print line information from debug info if available"),
+ cl::cat(MachOCat));
static cl::opt<std::string> DSYMFile("dsym",
- cl::desc("Use .dSYM file for debug info"));
+ cl::desc("Use .dSYM file for debug info"),
+ cl::cat(MachOCat));
static cl::opt<bool> FullLeadingAddr("full-leading-addr",
- cl::desc("Print full leading address"));
+ cl::desc("Print full leading address"),
+ cl::cat(MachOCat));
static cl::opt<bool> NoLeadingHeaders("no-leading-headers",
- cl::desc("Print no leading headers"));
+ cl::desc("Print no leading headers"),
+ cl::cat(MachOCat));
cl::opt<bool> UniversalHeaders("universal-headers",
cl::desc("Print Mach-O universal headers "
- "(requires -macho)"));
+ "(requires -macho)"),
+ cl::cat(MachOCat));
cl::opt<bool>
ArchiveMemberOffsets("archive-member-offsets",
cl::desc("Print the offset to each archive member for "
"Mach-O archives (requires -macho and "
- "-archive-headers)"));
+ "-archive-headers)"),
+ cl::cat(MachOCat));
cl::opt<bool> IndirectSymbols("indirect-symbols",
cl::desc("Print indirect symbol table for Mach-O "
- "objects (requires -macho)"));
+ "objects (requires -macho)"),
+ cl::cat(MachOCat));
cl::opt<bool>
DataInCode("data-in-code",
cl::desc("Print the data in code table for Mach-O objects "
- "(requires -macho)"));
+ "(requires -macho)"),
+ cl::cat(MachOCat));
cl::opt<bool> LinkOptHints("link-opt-hints",
cl::desc("Print the linker optimization hints for "
- "Mach-O objects (requires -macho)"));
+ "Mach-O objects (requires -macho)"),
+ cl::cat(MachOCat));
cl::opt<bool> InfoPlist("info-plist",
cl::desc("Print the info plist section as strings for "
- "Mach-O objects (requires -macho)"));
+ "Mach-O objects (requires -macho)"),
+ cl::cat(MachOCat));
cl::opt<bool> DylibsUsed("dylibs-used",
cl::desc("Print the shared libraries used for linked "
- "Mach-O files (requires -macho)"));
+ "Mach-O files (requires -macho)"),
+ cl::cat(MachOCat));
cl::opt<bool>
DylibId("dylib-id",
cl::desc("Print the shared library's id for the dylib Mach-O "
- "file (requires -macho)"));
+ "file (requires -macho)"),
+ cl::cat(MachOCat));
cl::opt<bool>
NonVerbose("non-verbose",
cl::desc("Print the info for Mach-O objects in "
- "non-verbose or numeric form (requires -macho)"));
+ "non-verbose or numeric form (requires -macho)"),
+ cl::cat(MachOCat));
cl::opt<bool>
ObjcMetaData("objc-meta-data",
cl::desc("Print the Objective-C runtime meta data for "
- "Mach-O files (requires -macho)"));
+ "Mach-O files (requires -macho)"),
+ cl::cat(MachOCat));
cl::opt<std::string> DisSymName(
"dis-symname",
- cl::desc("disassemble just this symbol's instructions (requires -macho)"));
+ cl::desc("disassemble just this symbol's instructions (requires -macho)"),
+ cl::cat(MachOCat));
static cl::opt<bool> NoSymbolicOperands(
"no-symbolic-operands",
- cl::desc("do not symbolic operands when disassembling (requires -macho)"));
+ cl::desc("do not symbolic operands when disassembling (requires -macho)"),
+ cl::cat(MachOCat));
static cl::list<std::string>
ArchFlags("arch", cl::desc("architecture(s) from a Mach-O file to dump"),
- cl::ZeroOrMore);
+ cl::ZeroOrMore, cl::cat(MachOCat));
bool ArchAll = false;
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=361351&r1=361350&r2=361351&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Tue May 21 23:30:46 2019
@@ -71,7 +71,10 @@ using namespace llvm::object;
namespace llvm {
+cl::OptionCategory ObjdumpCat("llvm-objdump Options");
+
// MachO specific
+extern cl::OptionCategory MachOCat;
extern cl::opt<bool> Bind;
extern cl::opt<bool> DataInCode;
extern cl::opt<bool> DylibsUsed;
@@ -90,55 +93,62 @@ extern cl::opt<bool> WeakBind;
static cl::opt<uint64_t> AdjustVMA(
"adjust-vma",
cl::desc("Increase the displayed address by the specified offset"),
- cl::value_desc("offset"), cl::init(0));
+ cl::value_desc("offset"), cl::init(0), cl::cat(ObjdumpCat));
static cl::opt<bool>
AllHeaders("all-headers",
- cl::desc("Display all available header information"));
+ cl::desc("Display all available header information"),
+ cl::cat(ObjdumpCat));
static cl::alias AllHeadersShort("x", cl::desc("Alias for --all-headers"),
cl::NotHidden, cl::Grouping,
cl::aliasopt(AllHeaders));
static cl::opt<std::string>
- ArchName("arch-name", cl::desc("Target arch to disassemble for, "
- "see -version for available targets"));
+ ArchName("arch-name",
+ cl::desc("Target arch to disassemble for, "
+ "see -version for available targets"),
+ cl::cat(ObjdumpCat));
cl::opt<bool> ArchiveHeaders("archive-headers",
- cl::desc("Display archive header information"));
+ cl::desc("Display archive header information"),
+ cl::cat(ObjdumpCat));
static cl::alias ArchiveHeadersShort("a",
cl::desc("Alias for --archive-headers"),
cl::NotHidden, cl::Grouping,
cl::aliasopt(ArchiveHeaders));
cl::opt<bool> Demangle("demangle", cl::desc("Demangle symbols names"),
- cl::init(false));
+ cl::init(false), cl::cat(ObjdumpCat));
static cl::alias DemangleShort("C", cl::desc("Alias for --demangle"),
cl::NotHidden, cl::Grouping,
cl::aliasopt(Demangle));
cl::opt<bool> Disassemble(
"disassemble",
- cl::desc("Display assembler mnemonics for the machine instructions"));
+ cl::desc("Display assembler mnemonics for the machine instructions"),
+ cl::cat(ObjdumpCat));
static cl::alias DisassembleShort("d", cl::desc("Alias for --disassemble"),
cl::NotHidden, cl::Grouping,
cl::aliasopt(Disassemble));
cl::opt<bool> DisassembleAll(
"disassemble-all",
- cl::desc("Display assembler mnemonics for the machine instructions"));
+ cl::desc("Display assembler mnemonics for the machine instructions"),
+ cl::cat(ObjdumpCat));
static cl::alias DisassembleAllShort("D",
cl::desc("Alias for --disassemble-all"),
cl::NotHidden, cl::Grouping,
cl::aliasopt(DisassembleAll));
static cl::list<std::string>
-DisassembleFunctions("disassemble-functions",
- cl::CommaSeparated,
- cl::desc("List of functions to disassemble"));
+ DisassembleFunctions("disassemble-functions", cl::CommaSeparated,
+ cl::desc("List of functions to disassemble"),
+ cl::cat(ObjdumpCat));
static cl::opt<bool> DisassembleZeroes(
"disassemble-zeroes",
- cl::desc("Do not skip blocks of zeroes when disassembling"));
+ cl::desc("Do not skip blocks of zeroes when disassembling"),
+ cl::cat(ObjdumpCat));
static cl::alias
DisassembleZeroesShort("z", cl::desc("Alias for --disassemble-zeroes"),
cl::NotHidden, cl::Grouping,
@@ -147,7 +157,8 @@ static cl::alias
static cl::list<std::string>
DisassemblerOptions("disassembler-options",
cl::desc("Pass target specific disassembler options"),
- cl::value_desc("options"), cl::CommaSeparated);
+ cl::value_desc("options"), cl::CommaSeparated,
+ cl::cat(ObjdumpCat));
static cl::alias
DisassemblerOptionsShort("M", cl::desc("Alias for --disassembler-options"),
cl::NotHidden, cl::Grouping, cl::Prefix,
@@ -156,11 +167,13 @@ static cl::alias
cl::opt<DIDumpType> DwarfDumpType(
"dwarf", cl::init(DIDT_Null), cl::desc("Dump of dwarf debug sections:"),
- cl::values(clEnumValN(DIDT_DebugFrame, "frames", ".debug_frame")));
+ cl::values(clEnumValN(DIDT_DebugFrame, "frames", ".debug_frame")),
+ cl::cat(ObjdumpCat));
static cl::opt<bool> DynamicRelocations(
"dynamic-reloc",
- cl::desc("Display the dynamic relocation entries in the file"));
+ cl::desc("Display the dynamic relocation entries in the file"),
+ cl::cat(ObjdumpCat));
static cl::alias DynamicRelocationShort("R",
cl::desc("Alias for --dynamic-reloc"),
cl::NotHidden, cl::Grouping,
@@ -168,72 +181,83 @@ static cl::alias DynamicRelocationShort(
static cl::opt<bool>
FaultMapSection("fault-map-section",
- cl::desc("Display contents of faultmap section"));
+ cl::desc("Display contents of faultmap section"),
+ cl::cat(ObjdumpCat));
static cl::opt<bool>
FileHeaders("file-headers",
- cl::desc("Display the contents of the overall file header"));
+ cl::desc("Display the contents of the overall file header"),
+ cl::cat(ObjdumpCat));
static cl::alias FileHeadersShort("f", cl::desc("Alias for --file-headers"),
cl::NotHidden, cl::Grouping,
cl::aliasopt(FileHeaders));
cl::opt<bool> SectionContents("full-contents",
- cl::desc("Display the content of each section"));
+ cl::desc("Display the content of each section"),
+ cl::cat(ObjdumpCat));
static cl::alias SectionContentsShort("s",
cl::desc("Alias for --full-contents"),
cl::NotHidden, cl::Grouping,
cl::aliasopt(SectionContents));
-static cl::list<std::string>
-InputFilenames(cl::Positional, cl::desc("<input object files>"),cl::ZeroOrMore);
+static cl::list<std::string> InputFilenames(cl::Positional,
+ cl::desc("<input object files>"),
+ cl::ZeroOrMore,
+ cl::cat(ObjdumpCat));
static cl::opt<bool>
PrintLines("line-numbers",
cl::desc("Display source line numbers with "
- "disassembly. Implies disassemble object"));
+ "disassembly. Implies disassemble object"),
+ cl::cat(ObjdumpCat));
static cl::alias PrintLinesShort("l", cl::desc("Alias for --line-numbers"),
cl::NotHidden, cl::Grouping,
cl::aliasopt(PrintLines));
-static cl::opt<bool>
-MachOOpt("macho", cl::desc("Use MachO specific object file parser"));
+static cl::opt<bool> MachOOpt("macho",
+ cl::desc("Use MachO specific object file parser"),
+ cl::cat(ObjdumpCat));
static cl::alias MachOm("m", cl::desc("Alias for --macho"), cl::NotHidden,
cl::Grouping, cl::aliasopt(MachOOpt));
cl::opt<std::string>
MCPU("mcpu",
cl::desc("Target a specific cpu type (-mcpu=help for details)"),
- cl::value_desc("cpu-name"), cl::init(""));
+ cl::value_desc("cpu-name"), cl::init(""), cl::cat(ObjdumpCat));
cl::list<std::string> MAttrs("mattr", cl::CommaSeparated,
cl::desc("Target specific attributes"),
- cl::value_desc("a1,+a2,-a3,..."));
+ cl::value_desc("a1,+a2,-a3,..."),
+ cl::cat(ObjdumpCat));
cl::opt<bool> NoShowRawInsn("no-show-raw-insn",
cl::desc("When disassembling "
"instructions, do not print "
- "the instruction bytes."));
+ "the instruction bytes."),
+ cl::cat(ObjdumpCat));
cl::opt<bool> NoLeadingAddr("no-leading-addr",
- cl::desc("Print no leading address"));
+ cl::desc("Print no leading address"),
+ cl::cat(ObjdumpCat));
static cl::opt<bool> RawClangAST(
"raw-clang-ast",
- cl::desc("Dump the raw binary contents of the clang AST section"));
+ cl::desc("Dump the raw binary contents of the clang AST section"),
+ cl::cat(ObjdumpCat));
cl::opt<bool>
- Relocations("reloc",
- cl::desc("Display the relocation entries in the file"));
+ Relocations("reloc", cl::desc("Display the relocation entries in the file"),
+ cl::cat(ObjdumpCat));
static cl::alias RelocationsShort("r", cl::desc("Alias for --reloc"),
cl::NotHidden, cl::Grouping,
cl::aliasopt(Relocations));
-cl::opt<bool>
- PrintImmHex("print-imm-hex",
- cl::desc("Use hex format for immediate values"));
-
-cl::opt<bool>
- PrivateHeaders("private-headers",
- cl::desc("Display format specific file headers"));
+cl::opt<bool> PrintImmHex("print-imm-hex",
+ cl::desc("Use hex format for immediate values"),
+ cl::cat(ObjdumpCat));
+
+cl::opt<bool> PrivateHeaders("private-headers",
+ cl::desc("Display format specific file headers"),
+ cl::cat(ObjdumpCat));
static cl::alias PrivateHeadersShort("p",
cl::desc("Alias for --private-headers"),
cl::NotHidden, cl::Grouping,
@@ -242,14 +266,16 @@ static cl::alias PrivateHeadersShort("p"
cl::list<std::string>
FilterSections("section",
cl::desc("Operate on the specified sections only. "
- "With -macho dump segment,section"));
+ "With -macho dump segment,section"),
+ cl::cat(ObjdumpCat));
static cl::alias FilterSectionsj("j", cl::desc("Alias for --section"),
cl::NotHidden, cl::Grouping, cl::Prefix,
cl::aliasopt(FilterSections));
cl::opt<bool> SectionHeaders("section-headers",
cl::desc("Display summaries of the "
- "headers for each section."));
+ "headers for each section."),
+ cl::cat(ObjdumpCat));
static cl::alias SectionHeadersShort("headers",
cl::desc("Alias for --section-headers"),
cl::NotHidden,
@@ -261,42 +287,46 @@ static cl::alias SectionHeadersShorter("
static cl::opt<bool>
ShowLMA("show-lma",
- cl::desc("Display LMA column when dumping ELF section headers"));
+ cl::desc("Display LMA column when dumping ELF section headers"),
+ cl::cat(ObjdumpCat));
static cl::opt<bool> PrintSource(
"source",
cl::desc(
- "Display source inlined with disassembly. Implies disassemble object"));
+ "Display source inlined with disassembly. Implies disassemble object"),
+ cl::cat(ObjdumpCat));
static cl::alias PrintSourceShort("S", cl::desc("Alias for -source"),
cl::NotHidden, cl::Grouping,
cl::aliasopt(PrintSource));
static cl::opt<uint64_t>
StartAddress("start-address", cl::desc("Disassemble beginning at address"),
- cl::value_desc("address"), cl::init(0));
+ cl::value_desc("address"), cl::init(0), cl::cat(ObjdumpCat));
static cl::opt<uint64_t> StopAddress("stop-address",
cl::desc("Stop disassembly at address"),
cl::value_desc("address"),
- cl::init(UINT64_MAX));
+ cl::init(UINT64_MAX), cl::cat(ObjdumpCat));
-cl::opt<bool> SymbolTable("syms", cl::desc("Display the symbol table"));
+cl::opt<bool> SymbolTable("syms", cl::desc("Display the symbol table"),
+ cl::cat(ObjdumpCat));
static cl::alias SymbolTableShort("t", cl::desc("Alias for --syms"),
cl::NotHidden, cl::Grouping,
cl::aliasopt(SymbolTable));
cl::opt<std::string> TripleName("triple",
cl::desc("Target triple to disassemble for, "
- "see -version for available targets"));
+ "see -version for available targets"),
+ cl::cat(ObjdumpCat));
-cl::opt<bool> UnwindInfo("unwind-info",
- cl::desc("Display unwind information"));
+cl::opt<bool> UnwindInfo("unwind-info", cl::desc("Display unwind information"),
+ cl::cat(ObjdumpCat));
static cl::alias UnwindInfoShort("u", cl::desc("Alias for --unwind-info"),
cl::NotHidden, cl::Grouping,
cl::aliasopt(UnwindInfo));
-
static cl::opt<bool>
- Wide("wide", cl::desc("Ignored for compatibility with GNU objdump"));
+ Wide("wide", cl::desc("Ignored for compatibility with GNU objdump"),
+ cl::cat(ObjdumpCat));
static cl::alias WideShort("w", cl::Grouping, cl::aliasopt(Wide));
static StringSet<> DisasmFuncsSet;
@@ -2011,6 +2041,8 @@ static void dumpInput(StringRef file) {
int main(int argc, char **argv) {
using namespace llvm;
InitLLVM X(argc, argv);
+ const cl::OptionCategory *OptionFilters[] = {&ObjdumpCat, &MachOCat};
+ cl::HideUnrelatedOptions(OptionFilters);
// Initialize targets and assembly printers/parsers.
InitializeAllTargetInfos();
More information about the llvm-commits
mailing list