[Lldb-commits] [lldb] r366783 - [lldb][NFC] Tablegenify disassemble

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 23 00:15:55 PDT 2019


Author: teemperor
Date: Tue Jul 23 00:15:54 2019
New Revision: 366783

URL: http://llvm.org/viewvc/llvm-project?rev=366783&view=rev
Log:
[lldb][NFC] Tablegenify disassemble

Modified:
    lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
    lldb/trunk/source/Commands/Options.td

Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=366783&r1=366782&r2=366783&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Tue Jul 23 00:15:54 2019
@@ -31,30 +31,8 @@ using namespace lldb;
 using namespace lldb_private;
 
 static constexpr OptionDefinition g_disassemble_options[] = {
-    // clang-format off
-  { LLDB_OPT_SET_ALL, false, "bytes",         'b', OptionParser::eNoArgument,       nullptr, {}, 0,                                     eArgTypeNone,                "Show opcode bytes when disassembling." },
-  { LLDB_OPT_SET_ALL, false, "context",       'C', OptionParser::eRequiredArgument, nullptr, {}, 0,                                     eArgTypeNumLines,            "Number of context lines of source to show." },
-  { LLDB_OPT_SET_ALL, false, "mixed",         'm', OptionParser::eNoArgument,       nullptr, {}, 0,                                     eArgTypeNone,                "Enable mixed source and assembly display." },
-  { LLDB_OPT_SET_ALL, false, "raw",           'r', OptionParser::eNoArgument,       nullptr, {}, 0,                                     eArgTypeNone,                "Print raw disassembly with no symbol information." },
-  { LLDB_OPT_SET_ALL, false, "plugin",        'P', OptionParser::eRequiredArgument, nullptr, {}, 0,                                     eArgTypePlugin,              "Name of the disassembler plugin you want to use." },
-  { LLDB_OPT_SET_ALL, false, "flavor",        'F', OptionParser::eRequiredArgument, nullptr, {}, 0,                                     eArgTypeDisassemblyFlavor,   "Name of the disassembly flavor you want to use.  "
-  "Currently the only valid options are default, and for Intel "
-  "architectures, att and intel." },
-  { LLDB_OPT_SET_ALL, false, "arch",          'A', OptionParser::eRequiredArgument, nullptr, {}, 0,                                     eArgTypeArchitecture,        "Specify the architecture to use from cross disassembly." },
-  { LLDB_OPT_SET_1 |
-  LLDB_OPT_SET_2,   true,  "start-address", 's', OptionParser::eRequiredArgument, nullptr, {}, 0,                                     eArgTypeAddressOrExpression, "Address at which to start disassembling." },
-  { LLDB_OPT_SET_1,   false, "end-address",   'e', OptionParser::eRequiredArgument, nullptr, {}, 0,                                     eArgTypeAddressOrExpression, "Address at which to end disassembling." },
-  { LLDB_OPT_SET_2 |
-  LLDB_OPT_SET_3 |
-  LLDB_OPT_SET_4 |
-  LLDB_OPT_SET_5,   false, "count",         'c', OptionParser::eRequiredArgument, nullptr, {}, 0,                                     eArgTypeNumLines,            "Number of instructions to display." },
-  { LLDB_OPT_SET_3,   false, "name",          'n', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName,        "Disassemble entire contents of the given function name." },
-  { LLDB_OPT_SET_4,   false, "frame",         'f', OptionParser::eNoArgument,       nullptr, {}, 0,                                     eArgTypeNone,                "Disassemble from the start of the current frame's function." },
-  { LLDB_OPT_SET_5,   false, "pc",            'p', OptionParser::eNoArgument,       nullptr, {}, 0,                                     eArgTypeNone,                "Disassemble around the current pc." },
-  { LLDB_OPT_SET_6,   false, "line",          'l', OptionParser::eNoArgument,       nullptr, {}, 0,                                     eArgTypeNone,                "Disassemble the current frame's current source line instructions if there is debug line "
-  "table information, else disassemble around the pc." },
-  { LLDB_OPT_SET_7,   false, "address",       'a', OptionParser::eRequiredArgument, nullptr, {}, 0,                                     eArgTypeAddressOrExpression, "Disassemble function containing this address." },
-    // clang-format on
+#define LLDB_OPTIONS_disassemble
+#include "CommandOptions.inc"
 };
 
 CommandObjectDisassemble::CommandOptions::CommandOptions()

Modified: lldb/trunk/source/Commands/Options.td
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/Options.td?rev=366783&r1=366782&r2=366783&view=diff
==============================================================================
--- lldb/trunk/source/Commands/Options.td (original)
+++ lldb/trunk/source/Commands/Options.td Tue Jul 23 00:15:54 2019
@@ -295,6 +295,45 @@ let Command = "breakpoint command delete
     "a file is provided, which prime new targets.">;
 }
 
+let Command = "disassemble" in {
+  def disassemble_options_bytes : Option<"bytes", "b">,
+    Desc<"Show opcode bytes when disassembling.">;
+  def disassemble_options_context : Option<"context", "C">, Arg<"NumLines">,
+    Desc<"Number of context lines of source to show.">;
+  def disassemble_options_mixed : Option<"mixed", "m">,
+    Desc<"Enable mixed source and assembly display.">;
+  def disassemble_options_raw : Option<"raw", "r">,
+    Desc<"Print raw disassembly with no symbol information.">;
+  def disassemble_options_plugin : Option<"plugin", "P">, Arg<"Plugin">,
+    Desc<"Name of the disassembler plugin you want to use.">;
+  def disassemble_options_flavor : Option<"flavor", "F">,
+    Arg<"DisassemblyFlavor">, Desc<"Name of the disassembly flavor you want to "
+    "use. Currently the only valid options are default, and for Intel "
+    "architectures, att and intel.">;
+  def disassemble_options_arch : Option<"arch", "A">, Arg<"Architecture">,
+    Desc<"Specify the architecture to use from cross disassembly.">;
+  def disassemble_options_start_address : Option<"start-address", "s">,
+    Groups<[1,2]>, Arg<"AddressOrExpression">, Required,
+    Desc<"Address at which to start disassembling.">;
+  def disassemble_options_end_address : Option<"end-address", "e">, Group<1>,
+    Arg<"AddressOrExpression">, Desc<"Address at which to end disassembling.">;
+  def disassemble_options_count : Option<"count", "c">, Groups<[2,3,4,5]>,
+    Arg<"NumLines">, Desc<"Number of instructions to display.">;
+  def disassemble_options_name : Option<"name", "n">, Group<3>,
+    Arg<"FunctionName">, Completion<"Symbol">,
+    Desc<"Disassemble entire contents of the given function name.">;
+  def disassemble_options_frame : Option<"frame", "f">, Group<4>,
+    Desc<"Disassemble from the start of the current frame's function.">;
+  def disassemble_options_pc : Option<"pc", "p">, Group<5>,
+    Desc<"Disassemble around the current pc.">;
+  def disassemble_options_line : Option<"line", "l">, Group<6>,
+    Desc<"Disassemble the current frame's current source line instructions if"
+    "there is debug line table information, else disassemble around the pc.">;
+  def disassemble_options_address : Option<"address", "a">, Group<7>,
+    Arg<"AddressOrExpression">,
+    Desc<"Disassemble function containing this address.">;
+}
+
 let Command = "history" in {
   def history_count : Option<"count", "c">, Group<1>, Arg<"UnsignedInteger">,
     Desc<"How many history commands to print.">;




More information about the lldb-commits mailing list