[Lldb-commits] [lldb] r366316 - [lldb][NFC] Tablegenify watchpoint commands

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 17 04:48:30 PDT 2019


Author: teemperor
Date: Wed Jul 17 04:48:29 2019
New Revision: 366316

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

Part of the project that migrates these struct initializers to our
new lldb-tablegen.

Modified:
    lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
    lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
    lldb/trunk/source/Commands/Options.td

Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp?rev=366316&r1=366315&r2=366316&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Wed Jul 17 04:48:29 2019
@@ -148,11 +148,8 @@ bool CommandObjectMultiwordWatchpoint::V
 #pragma mark List::CommandOptions
 
 static constexpr OptionDefinition g_watchpoint_list_options[] = {
-    // clang-format off
-  { LLDB_OPT_SET_1, false, "brief",   'b', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Give a brief description of the watchpoint (no location info)." },
-  { LLDB_OPT_SET_2, false, "full",    'f', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Give a full description of the watchpoint and its locations." },
-  { LLDB_OPT_SET_3, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Explain everything we know about the watchpoint (for debugging debugger bugs)." }
-    // clang-format on
+#define LLDB_OPTIONS_watchpoint_list
+#include "CommandOptions.inc"
 };
 
 #pragma mark List
@@ -511,9 +508,8 @@ protected:
 
 #pragma mark Ignore::CommandOptions
 static constexpr OptionDefinition g_watchpoint_ignore_options[] = {
-    // clang-format off
-  { LLDB_OPT_SET_ALL, true, "ignore-count", 'i', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeCount, "Set the number of times this watchpoint is skipped before stopping." }
-    // clang-format on
+#define LLDB_OPTIONS_watchpoint_ignore
+#include "CommandOptions.inc"
 };
 
 class CommandObjectWatchpointIgnore : public CommandObjectParsed {
@@ -631,9 +627,8 @@ private:
 #pragma mark Modify::CommandOptions
 
 static constexpr OptionDefinition g_watchpoint_modify_options[] = {
-    // clang-format off
-  { LLDB_OPT_SET_ALL, false, "condition", 'c', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeExpression, "The watchpoint stops only if this condition expression evaluates to true." }
-    // clang-format on
+#define LLDB_OPTIONS_watchpoint_modify
+#include "CommandOptions.inc"
 };
 
 #pragma mark Modify

Modified: lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp?rev=366316&r1=366315&r2=366316&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp Wed Jul 17 04:48:29 2019
@@ -43,12 +43,8 @@ static constexpr OptionEnumValues Script
 }
 
 static constexpr OptionDefinition g_watchpoint_command_add_options[] = {
-    // clang-format off
-  { LLDB_OPT_SET_1,   false, "one-liner",       'o', OptionParser::eRequiredArgument, nullptr, {},                 0, eArgTypeOneLiner,       "Specify a one-line watchpoint command inline. Be sure to surround it with quotes." },
-  { LLDB_OPT_SET_ALL, false, "stop-on-error",   'e', OptionParser::eRequiredArgument, nullptr, {},                 0, eArgTypeBoolean,        "Specify whether watchpoint command execution should terminate on error." },
-  { LLDB_OPT_SET_ALL, false, "script-type",     's', OptionParser::eRequiredArgument, nullptr, ScriptOptionEnum(), 0, eArgTypeNone,           "Specify the language for the commands - if none is specified, the lldb command interpreter will be used." },
-  { LLDB_OPT_SET_2,   false, "python-function", 'F', OptionParser::eRequiredArgument, nullptr, {},                 0, eArgTypePythonFunction, "Give the name of a Python function to run as command for this watchpoint. Be sure to give a module name if appropriate." }
-    // clang-format on
+#define LLDB_OPTIONS_watchpoint_command_add
+#include "CommandOptions.inc"
 };
 
 class CommandObjectWatchpointCommandAdd : public CommandObjectParsed,

Modified: lldb/trunk/source/Commands/Options.td
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/Options.td?rev=366316&r1=366315&r2=366316&view=diff
==============================================================================
--- lldb/trunk/source/Commands/Options.td (original)
+++ lldb/trunk/source/Commands/Options.td Wed Jul 17 04:48:29 2019
@@ -51,3 +51,41 @@ let Command = "breakpoint list" in {
     Desc<"List Dummy breakpoints - i.e. breakpoints set before a file is "
     "provided, which prime new targets.">;
 }
+
+let Command = "watchpoint list" in {
+  def watchpoint_list_brief : Option<"brief", "b">, Group<1>, Desc<"Give a "
+    "brief description of the watchpoint (no location info).">;
+  def watchpoint_list_full : Option<"full", "f">, Group<2>, Desc<"Give a full "
+    "description of the watchpoint and its locations.">;
+  def watchpoint_list_verbose : Option<"verbose", "v">, Group<3>, Desc<"Explain"
+    "everything we know about the watchpoint (for debugging debugger bugs).">;
+}
+
+let Command = "watchpoint ignore" in {
+  def watchpoint_ignore_ignore_count : Option<"ignore-count", "i">,
+    Arg<"Count">, Required, Desc<"Set the number of times this watchpoint is"
+    " skipped before stopping.">;
+}
+
+let Command = "watchpoint modify" in {
+  def watchpoint_modify_condition : Option<"condition", "c">, Arg<"Expression">,
+    Desc<"The watchpoint stops only if this condition expression evaluates "
+    "to true.">;
+}
+
+let Command = "watchpoint command add" in {
+  def watchpoint_command_add_one_liner : Option<"one-liner", "o">, Group<1>,
+    Arg<"OneLiner">, Desc<"Specify a one-line watchpoint command inline. Be "
+    "sure to surround it with quotes.">;
+  def watchpoint_command_add_stop_on_error : Option<"stop-on-error", "e">,
+    Arg<"Boolean">, Desc<"Specify whether watchpoint command execution should "
+    "terminate on error.">;
+  def watchpoint_command_add_script_type : Option<"script-type", "s">,
+    EnumArg<"None", "ScriptOptionEnum()">, Desc<"Specify the language for the"
+    " commands - if none is specified, the lldb command interpreter will be "
+    "used.">;
+  def watchpoint_command_add_python_function : Option<"python-function", "F">,
+    Group<2>, Arg<"PythonFunction">, Desc<"Give the name of a Python function "
+    "to run as command for this watchpoint. Be sure to give a module name if "
+    "appropriate.">;
+}




More information about the lldb-commits mailing list