Skip to content

Commit f94668e

Browse files
committed
[lldb][NFC] Tablegenify breakpoint
llvm-svn: 366673
1 parent 0a42fe7 commit f94668e

File tree

4 files changed

+270
-139
lines changed

4 files changed

+270
-139
lines changed

lldb/source/Commands/CommandObjectBreakpoint.cpp

+18-126
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,8 @@ static void AddBreakpointDescription(Stream *s, Breakpoint *bp,
4545
// Modifiable Breakpoint Options
4646
#pragma mark Modify::CommandOptions
4747
static constexpr OptionDefinition g_breakpoint_modify_options[] = {
48-
// clang-format off
49-
{ LLDB_OPT_SET_1, false, "ignore-count", 'i', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeCount, "Set the number of times this breakpoint is skipped before stopping." },
50-
{ LLDB_OPT_SET_1, false, "one-shot", 'o', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "The breakpoint is deleted the first time it stop causes a stop." },
51-
{ LLDB_OPT_SET_1, false, "thread-index", 'x', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeThreadIndex, "The breakpoint stops only for the thread whose index matches this argument." },
52-
{ LLDB_OPT_SET_1, false, "thread-id", 't', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeThreadID, "The breakpoint stops only for the thread whose TID matches this argument." },
53-
{ LLDB_OPT_SET_1, false, "thread-name", 'T', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeThreadName, "The breakpoint stops only for the thread whose thread name matches this argument." },
54-
{ LLDB_OPT_SET_1, false, "queue-name", 'q', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeQueueName, "The breakpoint stops only for threads in the queue whose name is given by this argument." },
55-
{ LLDB_OPT_SET_1, false, "condition", 'c', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeExpression, "The breakpoint stops only if this condition expression evaluates to true." },
56-
{ LLDB_OPT_SET_1, false, "auto-continue",'G', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "The breakpoint will auto-continue after running its commands." },
57-
{ LLDB_OPT_SET_2, false, "enable", 'e', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Enable the breakpoint." },
58-
{ LLDB_OPT_SET_3, false, "disable", 'd', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Disable the breakpoint." },
59-
{ LLDB_OPT_SET_4, false, "command", 'C', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeCommand, "A command to run when the breakpoint is hit, can be provided more than once, the commands will get run in order left to right." },
60-
// clang-format on
48+
#define LLDB_OPTIONS_breakpoint_modify
49+
#include "CommandOptions.inc"
6150
};
6251
class lldb_private::BreakpointOptionGroup : public OptionGroup
6352
{
@@ -193,10 +182,8 @@ class lldb_private::BreakpointOptionGroup : public OptionGroup
193182

194183
};
195184
static constexpr OptionDefinition g_breakpoint_dummy_options[] = {
196-
// clang-format off
197-
{ LLDB_OPT_SET_1, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Act on Dummy breakpoints - i.e. breakpoints set before a file is provided, "
198-
"which prime new targets." },
199-
// clang-format on
185+
#define LLDB_OPTIONS_breakpoint_dummy
186+
#include "CommandOptions.inc"
200187
};
201188

202189
class BreakpointDummyOptionGroup : public OptionGroup
@@ -237,87 +224,9 @@ class BreakpointDummyOptionGroup : public OptionGroup
237224

238225
};
239226

240-
// If an additional option set beyond LLDB_OPTION_SET_10 is added, make sure to
241-
// update the numbers passed to LLDB_OPT_SET_FROM_TO(...) appropriately.
242-
#define LLDB_OPT_NOT_10 (LLDB_OPT_SET_FROM_TO(1, 11) & ~LLDB_OPT_SET_10)
243-
#define LLDB_OPT_SKIP_PROLOGUE (LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3, 8))
244-
#define LLDB_OPT_FILE (LLDB_OPT_SET_FROM_TO(1, 11) & ~LLDB_OPT_SET_2 & ~LLDB_OPT_SET_10)
245-
#define LLDB_OPT_OFFSET_APPLIES (LLDB_OPT_SET_FROM_TO(1, 8) & ~LLDB_OPT_SET_2)
246-
#define LLDB_OPT_MOVE_TO_NEAREST_CODE (LLDB_OPT_SET_1 | LLDB_OPT_SET_9)
247-
#define LLDB_OPT_EXPR_LANGUAGE (LLDB_OPT_SET_FROM_TO(3, 8))
248-
249227
static constexpr OptionDefinition g_breakpoint_set_options[] = {
250-
// clang-format off
251-
{ LLDB_OPT_NOT_10, false, "shlib", 's', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Set the breakpoint only in this shared library. Can repeat this option "
252-
"multiple times to specify multiple shared libraries." },
253-
{ LLDB_OPT_SET_ALL, false, "hardware", 'H', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Require the breakpoint to use hardware breakpoints." },
254-
{ LLDB_OPT_FILE, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "Specifies the source file in which to set this breakpoint. Note, by default "
255-
"lldb only looks for files that are #included if they use the standard include "
256-
"file extensions. To set breakpoints on .c/.cpp/.m/.mm files that are "
257-
"#included, set target.inline-breakpoint-strategy to \"always\"." },
258-
{ LLDB_OPT_SET_1, true, "line", 'l', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeLineNum, "Specifies the line number on which to set this breakpoint." },
259-
260-
// Comment out this option for the moment, as we don't actually use it, but
261-
// will in the future. This way users won't see it, but the infrastructure is
262-
// left in place.
263-
// { 0, false, "column", 'C', OptionParser::eRequiredArgument, nullptr, "<column>",
264-
// "Set the breakpoint by source location at this particular column."},
265-
266-
{ LLDB_OPT_SET_2, true, "address", 'a', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeAddressOrExpression, "Set the breakpoint at the specified address. If the address maps uniquely to "
267-
"a particular binary, then the address will be converted to a \"file\" "
268-
"address, so that the breakpoint will track that binary+offset no matter where "
269-
"the binary eventually loads. Alternately, if you also specify the module - "
270-
"with the -s option - then the address will be treated as a file address in "
271-
"that module, and resolved accordingly. Again, this will allow lldb to track "
272-
"that offset on subsequent reloads. The module need not have been loaded at "
273-
"the time you specify this breakpoint, and will get resolved when the module "
274-
"is loaded." },
275-
{ LLDB_OPT_SET_3, true, "name", 'n', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "Set the breakpoint by function name. Can be repeated multiple times to make "
276-
"one breakpoint for multiple names" },
277-
{ LLDB_OPT_SET_9, false, "source-regexp-function", 'X', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "When used with '-p' limits the source regex to source contained in the named "
278-
"functions. Can be repeated multiple times." },
279-
{ LLDB_OPT_SET_4, true, "fullname", 'F', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eSymbolCompletion, eArgTypeFullName, "Set the breakpoint by fully qualified function names. For C++ this means "
280-
"namespaces and all arguments, and for Objective-C this means a full function "
281-
"prototype with class and selector. Can be repeated multiple times to make "
282-
"one breakpoint for multiple names." },
283-
{ LLDB_OPT_SET_5, true, "selector", 'S', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeSelector, "Set the breakpoint by ObjC selector name. Can be repeated multiple times to "
284-
"make one breakpoint for multiple Selectors." },
285-
{ LLDB_OPT_SET_6, true, "method", 'M', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeMethod, "Set the breakpoint by C++ method names. Can be repeated multiple times to "
286-
"make one breakpoint for multiple methods." },
287-
{ LLDB_OPT_SET_7, true, "func-regex", 'r', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeRegularExpression, "Set the breakpoint by function name, evaluating a regular-expression to find "
288-
"the function name(s)." },
289-
{ LLDB_OPT_SET_8, true, "basename", 'b', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "Set the breakpoint by function basename (C++ namespaces and arguments will be "
290-
"ignored). Can be repeated multiple times to make one breakpoint for multiple "
291-
"symbols." },
292-
{ LLDB_OPT_SET_9, true, "source-pattern-regexp", 'p', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeRegularExpression, "Set the breakpoint by specifying a regular expression which is matched "
293-
"against the source text in a source file or files specified with the -f "
294-
"option. The -f option can be specified more than once. If no source files "
295-
"are specified, uses the current \"default source file\". If you want to "
296-
"match against all source files, pass the \"--all-files\" option." },
297-
{ LLDB_OPT_SET_9, false, "all-files", 'A', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "All files are searched for source pattern matches." },
298-
{ LLDB_OPT_SET_11, true, "python-class", 'P', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePythonClass, "The name of the class that implement a scripted breakpoint." },
299-
{ LLDB_OPT_SET_11, false, "python-class-key", 'k', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeNone, "The key for a key/value pair passed to the class that implements a scripted breakpoint. Can be specified more than once." },
300-
{ LLDB_OPT_SET_11, false, "python-class-value", 'v', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeNone, "The value for the previous key in the pair passed to the class that implements a scripted breakpoint. Can be specified more than once." },
301-
{ LLDB_OPT_SET_10, true, "language-exception", 'E', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeLanguage, "Set the breakpoint on exceptions thrown by the specified language (without "
302-
"options, on throw but not catch.)" },
303-
{ LLDB_OPT_SET_10, false, "on-throw", 'w', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Set the breakpoint on exception throW." },
304-
{ LLDB_OPT_SET_10, false, "on-catch", 'h', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Set the breakpoint on exception catcH." },
305-
306-
// Don't add this option till it actually does something useful...
307-
// { LLDB_OPT_SET_10, false, "exception-typename", 'O', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeTypeName,
308-
// "The breakpoint will only stop if an exception Object of this type is thrown. Can be repeated multiple times to stop for multiple object types" },
309-
310-
{ LLDB_OPT_EXPR_LANGUAGE, false, "language", 'L', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeLanguage, "Specifies the Language to use when interpreting the breakpoint's expression "
311-
"(note: currently only implemented for setting breakpoints on identifiers). "
312-
"If not set the target.language setting is used." },
313-
{ LLDB_OPT_SKIP_PROLOGUE, false, "skip-prologue", 'K', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "sKip the prologue if the breakpoint is at the beginning of a function. "
314-
"If not set the target.skip-prologue setting is used." },
315-
{ LLDB_OPT_SET_ALL, false, "breakpoint-name", 'N', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBreakpointName, "Adds this to the list of names for this breakpoint." },
316-
{ LLDB_OPT_OFFSET_APPLIES, false, "address-slide", 'R', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeAddress, "Add the specified offset to whatever address(es) the breakpoint resolves to. "
317-
"At present this applies the offset directly as given, and doesn't try to align it to instruction boundaries." },
318-
{ LLDB_OPT_MOVE_TO_NEAREST_CODE, false, "move-to-nearest-code", 'm', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Move breakpoints to nearest code. If not set the target.move-to-nearest-code "
319-
"setting is used." },
320-
// clang-format on
228+
#define LLDB_OPTIONS_breakpoint_set
229+
#include "CommandOptions.inc"
321230
};
322231

323232
// CommandObjectBreakpointSet
@@ -1246,8 +1155,6 @@ the second re-enables the first location.");
12461155

12471156
#pragma mark List::CommandOptions
12481157
static constexpr OptionDefinition g_breakpoint_list_options[] = {
1249-
// FIXME: We need to add an "internal" command, and then add this sort of
1250-
// thing to it. But I need to see it for now, and don't want to wait.
12511158
#define LLDB_OPTIONS_breakpoint_list
12521159
#include "CommandOptions.inc"
12531160
};
@@ -1405,10 +1312,8 @@ class CommandObjectBreakpointList : public CommandObjectParsed {
14051312
#pragma mark Clear::CommandOptions
14061313

14071314
static constexpr OptionDefinition g_breakpoint_clear_options[] = {
1408-
// clang-format off
1409-
{ LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "Specify the breakpoint by source location in this particular file." },
1410-
{ LLDB_OPT_SET_1, true, "line", 'l', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeLineNum, "Specify the breakpoint by source location at this particular line." }
1411-
// clang-format on
1315+
#define LLDB_OPTIONS_breakpoint_clear
1316+
#include "CommandOptions.inc"
14121317
};
14131318

14141319
#pragma mark Clear
@@ -1558,10 +1463,8 @@ class CommandObjectBreakpointClear : public CommandObjectParsed {
15581463

15591464
// CommandObjectBreakpointDelete
15601465
static constexpr OptionDefinition g_breakpoint_delete_options[] = {
1561-
// clang-format off
1562-
{ LLDB_OPT_SET_1, false, "force", 'f', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Delete all breakpoints without querying for confirmation." },
1563-
{ LLDB_OPT_SET_1, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Delete Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets." },
1564-
// clang-format on
1466+
#define LLDB_OPTIONS_breakpoint_delete
1467+
#include "CommandOptions.inc"
15651468
};
15661469

15671470
#pragma mark Delete
@@ -1713,12 +1616,8 @@ class CommandObjectBreakpointDelete : public CommandObjectParsed {
17131616
// CommandObjectBreakpointName
17141617

17151618
static constexpr OptionDefinition g_breakpoint_name_options[] = {
1716-
// clang-format off
1717-
{LLDB_OPT_SET_1, false, "name", 'N', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBreakpointName, "Specifies a breakpoint name to use."},
1718-
{LLDB_OPT_SET_2, false, "breakpoint-id", 'B', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBreakpointID, "Specify a breakpoint ID to use."},
1719-
{LLDB_OPT_SET_3, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Operate on Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
1720-
{LLDB_OPT_SET_4, false, "help-string", 'H', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeNone, "A help string describing the purpose of this name."},
1721-
// clang-format on
1619+
#define LLDB_OPTIONS_breakpoint_name
1620+
#include "CommandOptions.inc"
17221621
};
17231622
class BreakpointNameOptionGroup : public OptionGroup {
17241623
public:
@@ -1782,11 +1681,8 @@ class BreakpointNameOptionGroup : public OptionGroup {
17821681
};
17831682

17841683
static constexpr OptionDefinition g_breakpoint_access_options[] = {
1785-
// clang-format off
1786-
{LLDB_OPT_SET_1, false, "allow-list", 'L', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Determines whether the breakpoint will show up in break list if not referred to explicitly."},
1787-
{LLDB_OPT_SET_2, false, "allow-disable", 'A', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Determines whether the breakpoint can be disabled by name or when all breakpoints are disabled."},
1788-
{LLDB_OPT_SET_3, false, "allow-delete", 'D', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Determines whether the breakpoint can be deleted by name or when all breakpoints are deleted."},
1789-
// clang-format on
1684+
#define LLDB_OPTIONS_breakpoint_access
1685+
#include "CommandOptions.inc"
17901686
};
17911687

17921688
class BreakpointAccessOptionGroup : public OptionGroup {
@@ -2247,10 +2143,8 @@ class CommandObjectBreakpointName : public CommandObjectMultiword {
22472143
// CommandObjectBreakpointRead
22482144
#pragma mark Read::CommandOptions
22492145
static constexpr OptionDefinition g_breakpoint_read_options[] = {
2250-
// clang-format off
2251-
{LLDB_OPT_SET_ALL, true, "file", 'f', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eDiskFileCompletion, eArgTypeFilename, "The file from which to read the breakpoints." },
2252-
{LLDB_OPT_SET_ALL, false, "breakpoint-name", 'N', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBreakpointName, "Only read in breakpoints with this name."},
2253-
// clang-format on
2146+
#define LLDB_OPTIONS_breakpoint_read
2147+
#include "CommandOptions.inc"
22542148
};
22552149

22562150
#pragma mark Read
@@ -2376,10 +2270,8 @@ class CommandObjectBreakpointRead : public CommandObjectParsed {
23762270
// CommandObjectBreakpointWrite
23772271
#pragma mark Write::CommandOptions
23782272
static constexpr OptionDefinition g_breakpoint_write_options[] = {
2379-
// clang-format off
2380-
{ LLDB_OPT_SET_ALL, true, "file", 'f', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eDiskFileCompletion, eArgTypeFilename, "The file into which to write the breakpoints." },
2381-
{ LLDB_OPT_SET_ALL, false, "append",'a', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Append to saved breakpoints file if it exists."},
2382-
// clang-format on
2273+
#define LLDB_OPTIONS_breakpoint_write
2274+
#include "CommandOptions.inc"
23832275
};
23842276

23852277
#pragma mark Write

0 commit comments

Comments
 (0)