Skip to content

Commit 60bd7a9

Browse files
committed
[lldb][NFC] Tablegenify watchpoint commands
Part of the project that migrates these struct initializers to our new lldb-tablegen. llvm-svn: 366316
1 parent e14cfe2 commit 60bd7a9

File tree

3 files changed

+46
-17
lines changed

3 files changed

+46
-17
lines changed

lldb/source/Commands/CommandObjectWatchpoint.cpp

+6-11
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,8 @@ bool CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(
148148
#pragma mark List::CommandOptions
149149

150150
static constexpr OptionDefinition g_watchpoint_list_options[] = {
151-
// clang-format off
152-
{ LLDB_OPT_SET_1, false, "brief", 'b', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Give a brief description of the watchpoint (no location info)." },
153-
{ LLDB_OPT_SET_2, false, "full", 'f', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Give a full description of the watchpoint and its locations." },
154-
{ LLDB_OPT_SET_3, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Explain everything we know about the watchpoint (for debugging debugger bugs)." }
155-
// clang-format on
151+
#define LLDB_OPTIONS_watchpoint_list
152+
#include "CommandOptions.inc"
156153
};
157154

158155
#pragma mark List
@@ -511,9 +508,8 @@ class CommandObjectWatchpointDelete : public CommandObjectParsed {
511508

512509
#pragma mark Ignore::CommandOptions
513510
static constexpr OptionDefinition g_watchpoint_ignore_options[] = {
514-
// clang-format off
515-
{ LLDB_OPT_SET_ALL, true, "ignore-count", 'i', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeCount, "Set the number of times this watchpoint is skipped before stopping." }
516-
// clang-format on
511+
#define LLDB_OPTIONS_watchpoint_ignore
512+
#include "CommandOptions.inc"
517513
};
518514

519515
class CommandObjectWatchpointIgnore : public CommandObjectParsed {
@@ -631,9 +627,8 @@ class CommandObjectWatchpointIgnore : public CommandObjectParsed {
631627
#pragma mark Modify::CommandOptions
632628

633629
static constexpr OptionDefinition g_watchpoint_modify_options[] = {
634-
// clang-format off
635-
{ LLDB_OPT_SET_ALL, false, "condition", 'c', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeExpression, "The watchpoint stops only if this condition expression evaluates to true." }
636-
// clang-format on
630+
#define LLDB_OPTIONS_watchpoint_modify
631+
#include "CommandOptions.inc"
637632
};
638633

639634
#pragma mark Modify

lldb/source/Commands/CommandObjectWatchpointCommand.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,8 @@ static constexpr OptionEnumValues ScriptOptionEnum() {
4343
}
4444

4545
static constexpr OptionDefinition g_watchpoint_command_add_options[] = {
46-
// clang-format off
47-
{ 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." },
48-
{ LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Specify whether watchpoint command execution should terminate on error." },
49-
{ 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." },
50-
{ 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." }
51-
// clang-format on
46+
#define LLDB_OPTIONS_watchpoint_command_add
47+
#include "CommandOptions.inc"
5248
};
5349

5450
class CommandObjectWatchpointCommandAdd : public CommandObjectParsed,

lldb/source/Commands/Options.td

+38
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,41 @@ let Command = "breakpoint list" in {
5151
Desc<"List Dummy breakpoints - i.e. breakpoints set before a file is "
5252
"provided, which prime new targets.">;
5353
}
54+
55+
let Command = "watchpoint list" in {
56+
def watchpoint_list_brief : Option<"brief", "b">, Group<1>, Desc<"Give a "
57+
"brief description of the watchpoint (no location info).">;
58+
def watchpoint_list_full : Option<"full", "f">, Group<2>, Desc<"Give a full "
59+
"description of the watchpoint and its locations.">;
60+
def watchpoint_list_verbose : Option<"verbose", "v">, Group<3>, Desc<"Explain"
61+
"everything we know about the watchpoint (for debugging debugger bugs).">;
62+
}
63+
64+
let Command = "watchpoint ignore" in {
65+
def watchpoint_ignore_ignore_count : Option<"ignore-count", "i">,
66+
Arg<"Count">, Required, Desc<"Set the number of times this watchpoint is"
67+
" skipped before stopping.">;
68+
}
69+
70+
let Command = "watchpoint modify" in {
71+
def watchpoint_modify_condition : Option<"condition", "c">, Arg<"Expression">,
72+
Desc<"The watchpoint stops only if this condition expression evaluates "
73+
"to true.">;
74+
}
75+
76+
let Command = "watchpoint command add" in {
77+
def watchpoint_command_add_one_liner : Option<"one-liner", "o">, Group<1>,
78+
Arg<"OneLiner">, Desc<"Specify a one-line watchpoint command inline. Be "
79+
"sure to surround it with quotes.">;
80+
def watchpoint_command_add_stop_on_error : Option<"stop-on-error", "e">,
81+
Arg<"Boolean">, Desc<"Specify whether watchpoint command execution should "
82+
"terminate on error.">;
83+
def watchpoint_command_add_script_type : Option<"script-type", "s">,
84+
EnumArg<"None", "ScriptOptionEnum()">, Desc<"Specify the language for the"
85+
" commands - if none is specified, the lldb command interpreter will be "
86+
"used.">;
87+
def watchpoint_command_add_python_function : Option<"python-function", "F">,
88+
Group<2>, Arg<"PythonFunction">, Desc<"Give the name of a Python function "
89+
"to run as command for this watchpoint. Be sure to give a module name if "
90+
"appropriate.">;
91+
}

0 commit comments

Comments
 (0)