summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-09-22 20:22:55 +0000
committerZachary Turner <zturner@google.com>2016-09-22 20:22:55 +0000
commit1f0f5b5b9eeaea93126583b40070091baf3bc92d (patch)
tree93be6068ce5a7314fb9bfdf0621f65c03b3cad0b /lldb/source/Commands
parent387eb83a509926ed6bd36591d1f235335ec215c0 (diff)
downloadbcm5719-llvm-1f0f5b5b9eeaea93126583b40070091baf3bc92d.tar.gz
bcm5719-llvm-1f0f5b5b9eeaea93126583b40070091baf3bc92d.zip
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the signature of `Options::GetDefinitions()` and `OptionGroup:: GetDefinitions()` to return an `ArrayRef<OptionDefinition>` instead of a `const OptionDefinition *`. In the case of the former, it deletes the sentinel entry from every table, and in the case of the latter, it removes the `GetNumDefinitions()` method from the interface. These are no longer necessary as `ArrayRef` carries its own length. In the former case, iteration was done by using a sentinel entry, so there was no knowledge of length. Because of this the individual option tables were allowed to be defined below the corresponding class (after all, only a pointer was needed). Now, however, the length must be known at compile time to construct the `ArrayRef`, and as a result it is necessary to move every option table before its corresponding class. This results in this CL looking very big, but in terms of substance there is not much here. Differential revision: https://reviews.llvm.org/D24834 llvm-svn: 282188
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r--lldb/source/Commands/CommandObjectArgs.cpp18
-rw-r--r--lldb/source/Commands/CommandObjectArgs.h6
-rw-r--r--lldb/source/Commands/CommandObjectBreakpoint.cpp380
-rw-r--r--lldb/source/Commands/CommandObjectBreakpointCommand.cpp80
-rw-r--r--lldb/source/Commands/CommandObjectCommands.cpp176
-rw-r--r--lldb/source/Commands/CommandObjectDisassemble.cpp59
-rw-r--r--lldb/source/Commands/CommandObjectDisassemble.h2
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp14
-rw-r--r--lldb/source/Commands/CommandObjectExpression.h4
-rw-r--r--lldb/source/Commands/CommandObjectFrame.cpp45
-rw-r--r--lldb/source/Commands/CommandObjectHelp.cpp8
-rw-r--r--lldb/source/Commands/CommandObjectHelp.h6
-rw-r--r--lldb/source/Commands/CommandObjectLog.cpp39
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp22
-rw-r--r--lldb/source/Commands/CommandObjectPlatform.cpp165
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp152
-rw-r--r--lldb/source/Commands/CommandObjectRegister.cpp34
-rw-r--r--lldb/source/Commands/CommandObjectSettings.cpp21
-rw-r--r--lldb/source/Commands/CommandObjectSource.cpp68
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp201
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp210
-rw-r--r--lldb/source/Commands/CommandObjectType.cpp298
-rw-r--r--lldb/source/Commands/CommandObjectWatchpoint.cpp89
-rw-r--r--lldb/source/Commands/CommandObjectWatchpointCommand.cpp56
24 files changed, 958 insertions, 1195 deletions
diff --git a/lldb/source/Commands/CommandObjectArgs.cpp b/lldb/source/Commands/CommandObjectArgs.cpp
index eec83b7db43..6cd75292ee7 100644
--- a/lldb/source/Commands/CommandObjectArgs.cpp
+++ b/lldb/source/Commands/CommandObjectArgs.cpp
@@ -37,6 +37,12 @@ using namespace lldb_private;
// calling functions.
//
+static OptionDefinition g_arg_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "debug", 'g', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable verbose debug logging of the expression parsing and evaluation." },
+ // clang-format on
+};
+
CommandObjectArgs::CommandOptions::CommandOptions(
CommandInterpreter &interpreter)
: Options() {
@@ -61,8 +67,9 @@ Error CommandObjectArgs::CommandOptions::SetOptionValue(
void CommandObjectArgs::CommandOptions::OptionParsingStarting(
ExecutionContext *execution_context) {}
-const OptionDefinition *CommandObjectArgs::CommandOptions::GetDefinitions() {
- return g_option_table;
+llvm::ArrayRef<OptionDefinition>
+CommandObjectArgs::CommandOptions::GetDefinitions() {
+ return g_arg_options;
}
CommandObjectArgs::CommandObjectArgs(CommandInterpreter &interpreter)
@@ -228,10 +235,3 @@ bool CommandObjectArgs::DoExecute(Args &args, CommandReturnObject &result) {
return result.Succeeded();
}
-
-OptionDefinition CommandObjectArgs::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "debug", 'g', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable verbose debug logging of the expression parsing and evaluation."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
diff --git a/lldb/source/Commands/CommandObjectArgs.h b/lldb/source/Commands/CommandObjectArgs.h
index 2a154a32843..9817c53cb2d 100644
--- a/lldb/source/Commands/CommandObjectArgs.h
+++ b/lldb/source/Commands/CommandObjectArgs.h
@@ -32,11 +32,7 @@ public:
void OptionParsingStarting(ExecutionContext *execution_context) override;
- const OptionDefinition *GetDefinitions() override;
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
};
CommandObjectArgs(CommandInterpreter &interpreter);
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index 72e7e128d57..b68203c720d 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -45,6 +45,96 @@ static void AddBreakpointDescription(Stream *s, Breakpoint *bp,
s->EOL();
}
+// If an additional option set beyond LLDB_OPTION_SET_10 is added, make sure to
+// update the numbers passed to LLDB_OPT_SET_FROM_TO(...) appropriately.
+#define LLDB_OPT_FILE (LLDB_OPT_SET_FROM_TO(1, 9) & ~LLDB_OPT_SET_2)
+#define LLDB_OPT_NOT_10 (LLDB_OPT_SET_FROM_TO(1, 10) & ~LLDB_OPT_SET_10)
+#define LLDB_OPT_SKIP_PROLOGUE (LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3, 8))
+#define LLDB_OPT_OFFSET_APPLIES (LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3, 8))
+#define LLDB_OPT_MOVE_TO_NEAREST_CODE (LLDB_OPT_SET_1 | LLDB_OPT_SET_9)
+#define LLDB_OPT_EXPR_LANGUAGE (LLDB_OPT_SET_FROM_TO(3, 8))
+
+static OptionDefinition g_breakpoint_set_options[] = {
+ // clang-format off
+ { LLDB_OPT_NOT_10, false, "shlib", 's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Set the breakpoint only in this shared library. Can repeat this option "
+ "multiple times to specify multiple shared libraries." },
+ { LLDB_OPT_SET_ALL, false, "ignore-count", 'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "Set the number of times this breakpoint is skipped before stopping." },
+ { LLDB_OPT_SET_ALL, false, "one-shot", 'o', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "The breakpoint is deleted the first time it causes a stop." },
+ { LLDB_OPT_SET_ALL, false, "condition", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeExpression, "The breakpoint stops only if this condition expression evaluates to true." },
+ { LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadIndex, "The breakpoint stops only for the thread whose indeX matches this argument." },
+ { LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadID, "The breakpoint stops only for the thread whose TID matches this argument." },
+ { LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadName, "The breakpoint stops only for the thread whose thread name matches this "
+ "argument." },
+ { LLDB_OPT_SET_ALL, false, "hardware", 'H', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Require the breakpoint to use hardware breakpoints." },
+ { LLDB_OPT_SET_ALL, false, "queue-name", 'q', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeQueueName, "The breakpoint stops only for threads in the queue whose name is given by "
+ "this argument." },
+ { LLDB_OPT_FILE, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "Specifies the source file in which to set this breakpoint. Note, by default "
+ "lldb only looks for files that are #included if they use the standard include "
+ "file extensions. To set breakpoints on .c/.cpp/.m/.mm files that are "
+ "#included, set target.inline-breakpoint-strategy to \"always\"." },
+ { LLDB_OPT_SET_1, true, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Specifies the line number on which to set this breakpoint." },
+
+ // Comment out this option for the moment, as we don't actually use it, but will in the future.
+ // This way users won't see it, but the infrastructure is left in place.
+ // { 0, false, "column", 'C', OptionParser::eRequiredArgument, nullptr, "<column>",
+ // "Set the breakpoint by source location at this particular column."},
+
+ { LLDB_OPT_SET_2, true, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Set the breakpoint at the specified address. If the address maps uniquely to "
+ "a particular binary, then the address will be converted to a \"file\" "
+ "address, so that the breakpoint will track that binary+offset no matter where "
+ "the binary eventually loads. Alternately, if you also specify the module - "
+ "with the -s option - then the address will be treated as a file address in "
+ "that module, and resolved accordingly. Again, this will allow lldb to track "
+ "that offset on subsequent reloads. The module need not have been loaded at "
+ "the time you specify this breakpoint, and will get resolved when the module "
+ "is loaded." },
+ { LLDB_OPT_SET_3, true, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "Set the breakpoint by function name. Can be repeated multiple times to make "
+ "one breakpoint for multiple names" },
+ { LLDB_OPT_SET_9, false, "source-regexp-function", 'X', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "When used with '-p' limits the source regex to source contained in the named "
+ "functions. Can be repeated multiple times." },
+ { LLDB_OPT_SET_4, true, "fullname", 'F', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeFullName, "Set the breakpoint by fully qualified function names. For C++ this means "
+ "namespaces and all arguments, and for Objective C this means a full function "
+ "prototype with class and selector. Can be repeated multiple times to make "
+ "one breakpoint for multiple names." },
+ { LLDB_OPT_SET_5, true, "selector", 'S', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeSelector, "Set the breakpoint by ObjC selector name. Can be repeated multiple times to "
+ "make one breakpoint for multiple Selectors." },
+ { LLDB_OPT_SET_6, true, "method", 'M', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeMethod, "Set the breakpoint by C++ method names. Can be repeated multiple times to "
+ "make one breakpoint for multiple methods." },
+ { LLDB_OPT_SET_7, true, "func-regex", 'r', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeRegularExpression, "Set the breakpoint by function name, evaluating a regular-expression to find "
+ "the function name(s)." },
+ { LLDB_OPT_SET_8, true, "basename", 'b', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "Set the breakpoint by function basename (C++ namespaces and arguments will be "
+ "ignored). Can be repeated multiple times to make one breakpoint for multiple "
+ "symbols." },
+ { LLDB_OPT_SET_9, true, "source-pattern-regexp", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeRegularExpression, "Set the breakpoint by specifying a regular expression which is matched "
+ "against the source text in a source file or files specified with the -f "
+ "option. The -f option can be specified more than once. If no source files "
+ "are specified, uses the current \"default source file\". If you want to "
+ "match against all source files, pass the \"--all-files\" option." },
+ { LLDB_OPT_SET_9, false, "all-files", 'A', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "All files are searched for source pattern matches." },
+ { LLDB_OPT_SET_10, true, "language-exception", 'E', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Set the breakpoint on exceptions thrown by the specified language (without "
+ "options, on throw but not catch.)" },
+ { LLDB_OPT_SET_10, false, "on-throw", 'w', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Set the breakpoint on exception throW." },
+ { LLDB_OPT_SET_10, false, "on-catch", 'h', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Set the breakpoint on exception catcH." },
+
+ // Don't add this option till it actually does something useful...
+ // { LLDB_OPT_SET_10, false, "exception-typename", 'O', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeTypeName,
+ // "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" },
+
+ { LLDB_OPT_EXPR_LANGUAGE, false, "language", 'L', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Specifies the Language to use when interpreting the breakpoint's expression "
+ "(note: currently only implemented for setting breakpoints on identifiers). "
+ "If not set the target.language setting is used." },
+ { LLDB_OPT_SKIP_PROLOGUE, false, "skip-prologue", 'K', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "sKip the prologue if the breakpoint is at the beginning of a function. "
+ "If not set the target.skip-prologue setting is used." },
+ { LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Sets Dummy breakpoints - i.e. breakpoints set before a file is provided, "
+ "which prime new targets." },
+ { LLDB_OPT_SET_ALL, false, "breakpoint-name", 'N', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBreakpointName, "Adds this to the list of names for this breakpoint." },
+ { LLDB_OPT_OFFSET_APPLIES, false, "address-slide", 'R', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddress, "Add the specified offset to whatever address(es) the breakpoint resolves to. "
+ "At present this applies the offset directly as given, and doesn't try to align it to instruction boundaries." },
+ { LLDB_OPT_MOVE_TO_NEAREST_CODE, false, "move-to-nearest-code", 'm', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Move breakpoints to nearest code. If not set the target.move-to-nearest-code "
+ "setting is used." },
+ // clang-format on
+};
+
//-------------------------------------------------------------------------
// CommandObjectBreakpointSet
//-------------------------------------------------------------------------
@@ -365,11 +455,9 @@ public:
m_source_regex_func_names.clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_breakpoint_set_options;
+ }
// Instance variables to hold the values for command options.
@@ -705,101 +793,26 @@ private:
CommandOptions m_options;
};
-// If an additional option set beyond LLDB_OPTION_SET_10 is added, make sure to
-// update the numbers passed to LLDB_OPT_SET_FROM_TO(...) appropriately.
-#define LLDB_OPT_FILE (LLDB_OPT_SET_FROM_TO(1, 9) & ~LLDB_OPT_SET_2)
-#define LLDB_OPT_NOT_10 (LLDB_OPT_SET_FROM_TO(1, 10) & ~LLDB_OPT_SET_10)
-#define LLDB_OPT_SKIP_PROLOGUE (LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3, 8))
-#define LLDB_OPT_OFFSET_APPLIES (LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3, 8))
-#define LLDB_OPT_MOVE_TO_NEAREST_CODE (LLDB_OPT_SET_1 | LLDB_OPT_SET_9)
-#define LLDB_OPT_EXPR_LANGUAGE (LLDB_OPT_SET_FROM_TO(3, 8))
-
-OptionDefinition CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_NOT_10, false, "shlib", 's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Set the breakpoint only in this shared library. Can repeat this option "
- "multiple times to specify multiple shared libraries."},
- {LLDB_OPT_SET_ALL, false, "ignore-count", 'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "Set the number of times this breakpoint is skipped before stopping." },
- {LLDB_OPT_SET_ALL, false, "one-shot", 'o', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "The breakpoint is deleted the first time it causes a stop." },
- {LLDB_OPT_SET_ALL, false, "condition", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeExpression, "The breakpoint stops only if this condition expression evaluates to true."},
- {LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadIndex, "The breakpoint stops only for the thread whose indeX matches this argument."},
- {LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadID, "The breakpoint stops only for the thread whose TID matches this argument."},
- {LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadName, "The breakpoint stops only for the thread whose thread name matches this "
- "argument."},
- {LLDB_OPT_SET_ALL, false, "hardware", 'H', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Require the breakpoint to use hardware breakpoints."},
- {LLDB_OPT_SET_ALL, false, "queue-name", 'q', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeQueueName, "The breakpoint stops only for threads in the queue whose name is given by "
- "this argument."},
- {LLDB_OPT_FILE, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "Specifies the source file in which to set this breakpoint. Note, by default "
- "lldb only looks for files that are #included if they use the standard include "
- "file extensions. To set breakpoints on .c/.cpp/.m/.mm files that are "
- "#included, set target.inline-breakpoint-strategy to \"always\"."},
- {LLDB_OPT_SET_1, true, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Specifies the line number on which to set this breakpoint."},
-
- // Comment out this option for the moment, as we don't actually use it, but will in the future.
- // This way users won't see it, but the infrastructure is left in place.
- // { 0, false, "column", 'C', OptionParser::eRequiredArgument, nullptr, "<column>",
- // "Set the breakpoint by source location at this particular column."},
-
- {LLDB_OPT_SET_2, true, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Set the breakpoint at the specified address. If the address maps uniquely to "
- "a particular binary, then the address will be converted to a \"file\" "
- "address, so that the breakpoint will track that binary+offset no matter where "
- "the binary eventually loads. Alternately, if you also specify the module - "
- "with the -s option - then the address will be treated as a file address in "
- "that module, and resolved accordingly. Again, this will allow lldb to track "
- "that offset on subsequent reloads. The module need not have been loaded at "
- "the time you specify this breakpoint, and will get resolved when the module "
- "is loaded."},
- {LLDB_OPT_SET_3, true, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "Set the breakpoint by function name. Can be repeated multiple times to make "
- "one breakpoint for multiple names"},
- {LLDB_OPT_SET_9, false, "source-regexp-function", 'X', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "When used with '-p' limits the source regex to source contained in the named "
- "functions. Can be repeated multiple times."},
- {LLDB_OPT_SET_4, true, "fullname", 'F', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeFullName, "Set the breakpoint by fully qualified function names. For C++ this means "
- "namespaces and all arguments, and for Objective C this means a full function "
- "prototype with class and selector. Can be repeated multiple times to make "
- "one breakpoint for multiple names."},
- {LLDB_OPT_SET_5, true, "selector", 'S', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeSelector, "Set the breakpoint by ObjC selector name. Can be repeated multiple times to "
- "make one breakpoint for multiple Selectors."},
- {LLDB_OPT_SET_6, true, "method", 'M', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeMethod, "Set the breakpoint by C++ method names. Can be repeated multiple times to "
- "make one breakpoint for multiple methods."},
- {LLDB_OPT_SET_7, true, "func-regex", 'r', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeRegularExpression, "Set the breakpoint by function name, evaluating a regular-expression to find "
- "the function name(s)."},
- {LLDB_OPT_SET_8, true, "basename", 'b', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "Set the breakpoint by function basename (C++ namespaces and arguments will be "
- "ignored). Can be repeated multiple times to make one breakpoint for multiple "
- "symbols."},
- {LLDB_OPT_SET_9, true, "source-pattern-regexp", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeRegularExpression, "Set the breakpoint by specifying a regular expression which is matched "
- "against the source text in a source file or files specified with the -f "
- "option. The -f option can be specified more than once. If no source files "
- "are specified, uses the current \"default source file\". If you want to "
- "match against all source files, pass the \"--all-files\" option."},
- {LLDB_OPT_SET_9, false, "all-files", 'A', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "All files are searched for source pattern matches."},
- {LLDB_OPT_SET_10, true, "language-exception", 'E', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Set the breakpoint on exceptions thrown by the specified language (without "
- "options, on throw but not catch.)"},
- {LLDB_OPT_SET_10, false, "on-throw", 'w', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Set the breakpoint on exception throW."},
- {LLDB_OPT_SET_10, false, "on-catch", 'h', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Set the breakpoint on exception catcH."},
-
-// Don't add this option till it actually does something useful...
-// { LLDB_OPT_SET_10, false, "exception-typename", 'O', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeTypeName,
-// "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" },
-
- {LLDB_OPT_EXPR_LANGUAGE, false, "language", 'L', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Specifies the Language to use when interpreting the breakpoint's expression "
- "(note: currently only implemented for setting breakpoints on identifiers). "
- "If not set the target.language setting is used."},
- {LLDB_OPT_SKIP_PROLOGUE, false, "skip-prologue", 'K', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "sKip the prologue if the breakpoint is at the beginning of a function. "
- "If not set the target.skip-prologue setting is used."},
- {LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Sets Dummy breakpoints - i.e. breakpoints set before a file is provided, "
- "which prime new targets."},
- {LLDB_OPT_SET_ALL, false, "breakpoint-name", 'N', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBreakpointName, "Adds this to the list of names for this breakpoint."},
- {LLDB_OPT_OFFSET_APPLIES, false, "address-slide", 'R', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddress, "Add the specified offset to whatever address(es) the breakpoint resolves to. "
- "At present this applies the offset directly as given, and doesn't try to align it to instruction boundaries."},
- {LLDB_OPT_MOVE_TO_NEAREST_CODE, false, "move-to-nearest-code", 'm', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Move breakpoints to nearest code. If not set the target.move-to-nearest-code "
- "setting is used."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectBreakpointModify
//-------------------------------------------------------------------------
+
+#pragma mark Modify::CommandOptions
+static OptionDefinition g_breakpoint_modify_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "ignore-count", 'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "Set the number of times this breakpoint is skipped before stopping." },
+ { LLDB_OPT_SET_ALL, false, "one-shot", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "The breakpoint is deleted the first time it stop causes a stop." },
+ { LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadIndex, "The breakpoint stops only for the thread whose index matches this argument." },
+ { LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadID, "The breakpoint stops only for the thread whose TID matches this argument." },
+ { LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadName, "The breakpoint stops only for the thread whose thread name matches this argument." },
+ { LLDB_OPT_SET_ALL, false, "queue-name", 'q', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeQueueName, "The breakpoint stops only for threads in the queue whose name is given by this argument." },
+ { LLDB_OPT_SET_ALL, false, "condition", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeExpression, "The breakpoint stops only if this condition expression evaluates to true." },
+ { LLDB_OPT_SET_1, false, "enable", 'e', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable the breakpoint." },
+ { LLDB_OPT_SET_2, false, "disable", 'd', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Disable the breakpoint." },
+ { LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Sets Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets." },
+ // clang-format on
+};
+
#pragma mark Modify
class CommandObjectBreakpointModify : public CommandObjectParsed {
@@ -948,11 +961,9 @@ public:
m_use_dummy = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_breakpoint_modify_options;
+ }
// Instance variables to hold the values for command options.
@@ -1057,24 +1068,6 @@ private:
CommandOptions m_options;
};
-#pragma mark Modify::CommandOptions
-OptionDefinition
- CommandObjectBreakpointModify::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "ignore-count", 'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "Set the number of times this breakpoint is skipped before stopping."},
- {LLDB_OPT_SET_ALL, false, "one-shot", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "The breakpoint is deleted the first time it stop causes a stop."},
- {LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadIndex, "The breakpoint stops only for the thread whose index matches this argument."},
- {LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadID, "The breakpoint stops only for the thread whose TID matches this argument."},
- {LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadName, "The breakpoint stops only for the thread whose thread name matches this argument."},
- {LLDB_OPT_SET_ALL, false, "queue-name", 'q', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeQueueName, "The breakpoint stops only for threads in the queue whose name is given by this argument."},
- {LLDB_OPT_SET_ALL, false, "condition", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeExpression, "The breakpoint stops only if this condition expression evaluates to true."},
- {LLDB_OPT_SET_1, false, "enable", 'e', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable the breakpoint."},
- {LLDB_OPT_SET_2, false, "disable", 'd', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Disable the breakpoint."},
- {LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Sets Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectBreakpointEnable
//-------------------------------------------------------------------------
@@ -1282,6 +1275,20 @@ protected:
//-------------------------------------------------------------------------
// CommandObjectBreakpointList
//-------------------------------------------------------------------------
+
+#pragma mark List::CommandOptions
+static OptionDefinition g_breakpoint_list_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "internal", 'i', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Show debugger internal breakpoints" },
+ { LLDB_OPT_SET_1, false, "brief", 'b', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Give a brief description of the breakpoint (no location info)." },
+ // FIXME: We need to add an "internal" command, and then add this sort of thing to it.
+ // But I need to see it for now, and don't want to wait.
+ { LLDB_OPT_SET_2, false, "full", 'f', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Give a full description of the breakpoint and its locations." },
+ { LLDB_OPT_SET_3, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Explain everything we know about the breakpoint (for debugging debugger bugs)." },
+ { LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "List Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets." },
+ // clang-format on
+};
+
#pragma mark List
class CommandObjectBreakpointList : public CommandObjectParsed {
@@ -1355,11 +1362,9 @@ public:
m_use_dummy = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_breakpoint_list_options;
+ }
// Instance variables to hold the values for command options.
@@ -1430,24 +1435,18 @@ private:
CommandOptions m_options;
};
-#pragma mark List::CommandOptions
-OptionDefinition CommandObjectBreakpointList::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "internal", 'i', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Show debugger internal breakpoints" },
- {LLDB_OPT_SET_1, false, "brief", 'b', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Give a brief description of the breakpoint (no location info)."},
- // FIXME: We need to add an "internal" command, and then add this sort of thing to it.
- // But I need to see it for now, and don't want to wait.
- {LLDB_OPT_SET_2, false, "full", 'f', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Give a full description of the breakpoint and its locations."},
- {LLDB_OPT_SET_3, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Explain everything we know about the breakpoint (for debugging debugger bugs)."},
- {LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "List Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectBreakpointClear
//-------------------------------------------------------------------------
+#pragma mark Clear::CommandOptions
+
+static OptionDefinition g_breakpoint_clear_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "Specify the breakpoint by source location in this particular file." },
+ { LLDB_OPT_SET_1, true, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Specify the breakpoint by source location at this particular line." }
+ // clang-format on
+};
+
#pragma mark Clear
class CommandObjectBreakpointClear : public CommandObjectParsed {
@@ -1502,11 +1501,9 @@ public:
m_line_num = 0;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_breakpoint_clear_options;
+ }
// Instance variables to hold the values for command options.
@@ -1597,20 +1594,16 @@ private:
CommandOptions m_options;
};
-#pragma mark Clear::CommandOptions
-
-OptionDefinition
- CommandObjectBreakpointClear::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "Specify the breakpoint by source location in this particular file."},
- {LLDB_OPT_SET_1, true, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Specify the breakpoint by source location at this particular line."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectBreakpointDelete
//-------------------------------------------------------------------------
+static OptionDefinition g_breakpoint_delete_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "force", 'f', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Delete all breakpoints without querying for confirmation." },
+ { LLDB_OPT_SET_1, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Delete Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets." },
+ // clang-format on
+};
+
#pragma mark Delete
class CommandObjectBreakpointDelete : public CommandObjectParsed {
@@ -1667,11 +1660,9 @@ public:
m_force = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_breakpoint_delete_options;
+ }
// Instance variables to hold the values for command options.
bool m_use_dummy;
@@ -1758,15 +1749,6 @@ private:
CommandOptions m_options;
};
-OptionDefinition
- CommandObjectBreakpointDelete::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "force", 'f', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Delete all breakpoints without querying for confirmation."},
- {LLDB_OPT_SET_1, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Delete Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectBreakpointName
//-------------------------------------------------------------------------
@@ -1786,11 +1768,7 @@ public:
~BreakpointNameOptionGroup() override = default;
- uint32_t GetNumDefinitions() override {
- return sizeof(g_breakpoint_name_options) / sizeof(OptionDefinition);
- }
-
- const OptionDefinition *GetDefinitions() override {
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
return g_breakpoint_name_options;
}
@@ -2099,7 +2077,14 @@ public:
//-------------------------------------------------------------------------
// CommandObjectBreakpointRead
//-------------------------------------------------------------------------
-#pragma mark Restore
+#pragma mark Modify::CommandOptions
+static OptionDefinition g_breakpoint_read_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, true, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eDiskFileCompletion, eArgTypeFilename, "The file from which to read the breakpoints." },
+ // clang-format on
+};
+
+#pragma mark Read
class CommandObjectBreakpointRead : public CommandObjectParsed {
public:
@@ -2149,11 +2134,9 @@ public:
m_filename.clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_breakpoint_read_options;
+ }
// Instance variables to hold the values for command options.
@@ -2186,19 +2169,17 @@ private:
CommandOptions m_options;
};
-#pragma mark Modify::CommandOptions
-OptionDefinition CommandObjectBreakpointRead::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_ALL, true, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eDiskFileCompletion, eArgTypeFilename, "The file from which to read the breakpoints."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectBreakpointWrite
//-------------------------------------------------------------------------
-#pragma mark Save
+#pragma mark Write::CommandOptions
+static OptionDefinition g_breakpoint_write_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, true, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eDiskFileCompletion, eArgTypeFilename, "The file into which to write the breakpoints." },
+ // clang-format on
+};
+
+#pragma mark Write
class CommandObjectBreakpointWrite : public CommandObjectParsed {
public:
CommandObjectBreakpointWrite(CommandInterpreter &interpreter)
@@ -2248,11 +2229,9 @@ public:
m_filename.clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_breakpoint_write_options;
+ }
// Instance variables to hold the values for command options.
@@ -2295,15 +2274,6 @@ private:
CommandOptions m_options;
};
-#pragma mark Modify::CommandOptions
-OptionDefinition
- CommandObjectBreakpointWrite::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, true, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eDiskFileCompletion, eArgTypeFilename, "The file into which to write the breakpoints."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectMultiwordBreakpoint
//-------------------------------------------------------------------------
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
index 18504947316..90e6b23947f 100644
--- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -33,6 +33,29 @@ using namespace lldb_private;
// CommandObjectBreakpointCommandAdd
//-------------------------------------------------------------------------
+// FIXME: "script-type" needs to have its contents determined dynamically, so
+// somebody can add a new scripting
+// language to lldb and have it pickable here without having to change this
+// enumeration by hand and rebuild lldb proper.
+
+static OptionEnumValueElement g_script_option_enumeration[4] = {
+ {eScriptLanguageNone, "command",
+ "Commands are in the lldb command interpreter language"},
+ {eScriptLanguagePython, "python", "Commands are in the Python language."},
+ {eSortOrderByName, "default-script",
+ "Commands are in the default scripting language."},
+ {0, nullptr, nullptr}};
+
+static OptionDefinition g_breakpoint_add_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "one-liner", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOneLiner, "Specify a one-line breakpoint command inline. Be sure to surround it with quotes." },
+ { LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Specify whether breakpoint command execution should terminate on error." },
+ { LLDB_OPT_SET_ALL, false, "script-type", 's', OptionParser::eRequiredArgument, nullptr, g_script_option_enumeration, 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, nullptr, 0, eArgTypePythonFunction, "Give the name of a Python function to run as command for this breakpoint. Be sure to give a module name if appropriate." },
+ { LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Sets Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets." },
+ // clang-format on
+};
+
class CommandObjectBreakpointCommandAdd : public CommandObjectParsed,
public IOHandlerDelegateMultiline {
public:
@@ -278,7 +301,7 @@ are no syntax errors may indicate that a function was declared but never called.
case 's':
m_script_language = (lldb::ScriptLanguage)Args::StringToOptionEnum(
- option_arg, g_option_table[option_idx].enum_values,
+ option_arg, g_breakpoint_add_options[option_idx].enum_values,
eScriptLanguageNone, error);
if (m_script_language == eScriptLanguagePython ||
@@ -325,11 +348,9 @@ are no syntax errors may indicate that a function was declared but never called.
m_use_dummy = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_breakpoint_add_options;
+ }
// Instance variables to hold the values for command options.
@@ -454,35 +475,16 @@ private:
const char *CommandObjectBreakpointCommandAdd::g_reader_instructions =
"Enter your debugger command(s). Type 'DONE' to end.\n";
-// FIXME: "script-type" needs to have its contents determined dynamically, so
-// somebody can add a new scripting
-// language to lldb and have it pickable here without having to change this
-// enumeration by hand and rebuild lldb proper.
-
-static OptionEnumValueElement g_script_option_enumeration[4] = {
- {eScriptLanguageNone, "command",
- "Commands are in the lldb command interpreter language"},
- {eScriptLanguagePython, "python", "Commands are in the Python language."},
- {eSortOrderByName, "default-script",
- "Commands are in the default scripting language."},
- {0, nullptr, nullptr}};
-
-OptionDefinition
- CommandObjectBreakpointCommandAdd::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "one-liner", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOneLiner, "Specify a one-line breakpoint command inline. Be sure to surround it with quotes." },
- {LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Specify whether breakpoint command execution should terminate on error." },
- {LLDB_OPT_SET_ALL, false, "script-type", 's', OptionParser::eRequiredArgument, nullptr, g_script_option_enumeration, 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, nullptr, 0, eArgTypePythonFunction, "Give the name of a Python function to run as command for this breakpoint. Be sure to give a module name if appropriate."},
- {LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Sets Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectBreakpointCommandDelete
//-------------------------------------------------------------------------
+static OptionDefinition g_breakpoint_delete_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Delete commands from Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets." },
+ // clang-format on
+};
+
class CommandObjectBreakpointCommandDelete : public CommandObjectParsed {
public:
CommandObjectBreakpointCommandDelete(CommandInterpreter &interpreter)
@@ -538,11 +540,9 @@ public:
m_use_dummy = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_breakpoint_delete_options;
+ }
// Instance variables to hold the values for command options.
bool m_use_dummy;
@@ -611,14 +611,6 @@ private:
CommandOptions m_options;
};
-OptionDefinition
- CommandObjectBreakpointCommandDelete::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Delete commands from Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectBreakpointCommandList
//-------------------------------------------------------------------------
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index f4f3afb32ba..74f0362b251 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -36,6 +36,15 @@ using namespace lldb_private;
// CommandObjectCommandsSource
//-------------------------------------------------------------------------
+static OptionDefinition g_history_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "How many history commands to print." },
+ { LLDB_OPT_SET_1, false, "start-index", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Index at which to start printing history commands (or end to mean tail mode)." },
+ { LLDB_OPT_SET_1, false, "end-index", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Index at which to stop printing history commands." },
+ { LLDB_OPT_SET_2, false, "clear", 'C', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Clears the current command history." },
+ // clang-format on
+};
+
class CommandObjectCommandsHistory : public CommandObjectParsed {
public:
CommandObjectCommandsHistory(CommandInterpreter &interpreter)
@@ -98,11 +107,9 @@ protected:
m_clear.Clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_history_options;
+ }
// Instance variables to hold the values for command options.
@@ -180,21 +187,18 @@ protected:
CommandOptions m_options;
};
-OptionDefinition
- CommandObjectCommandsHistory::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "How many history commands to print."},
- {LLDB_OPT_SET_1, false, "start-index", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Index at which to start printing history commands (or end to mean tail mode)."},
- {LLDB_OPT_SET_1, false, "end-index", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Index at which to stop printing history commands."},
- {LLDB_OPT_SET_2, false, "clear", 'C', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Clears the current command history."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectCommandsSource
//-------------------------------------------------------------------------
+static OptionDefinition g_source_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, stop executing commands on error." },
+ { LLDB_OPT_SET_ALL, false, "stop-on-continue", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, stop executing commands on continue." },
+ { LLDB_OPT_SET_ALL, false, "silent-run", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true don't echo commands while executing." },
+ // clang-format on
+};
+
class CommandObjectCommandsSource : public CommandObjectParsed {
public:
CommandObjectCommandsSource(CommandInterpreter &interpreter)
@@ -285,11 +289,9 @@ protected:
m_stop_on_continue.Clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_source_options;
+ }
// Instance variables to hold the values for command options.
@@ -340,21 +342,18 @@ protected:
CommandOptions m_options;
};
-OptionDefinition CommandObjectCommandsSource::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, stop executing commands on error."},
- {LLDB_OPT_SET_ALL, false, "stop-on-continue", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, stop executing commands on continue."},
- {LLDB_OPT_SET_ALL, false, "silent-run", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true don't echo commands while executing."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
#pragma mark CommandObjectCommandsAlias
//-------------------------------------------------------------------------
// CommandObjectCommandsAlias
//-------------------------------------------------------------------------
+static OptionDefinition g_alias_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "help", 'h', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeHelpText, "Help text for this command" },
+ { LLDB_OPT_SET_ALL, false, "long-help", 'H', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeHelpText, "Long help text for this command" },
+ // clang-format on
+};
+
static const char *g_python_command_instructions =
"Enter your Python command(s). Type 'DONE' to end.\n"
"You must define a Python function with this signature:\n"
@@ -368,15 +367,15 @@ protected:
~CommandOptions() override = default;
- uint32_t GetNumDefinitions() override { return 3; }
-
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_alias_options;
+ }
Error SetOptionValue(uint32_t option_idx, const char *option_value,
ExecutionContext *execution_context) override {
Error error;
- const int short_option = g_option_table[option_idx].short_option;
+ const int short_option = GetDefinitions()[option_idx].short_option;
switch (short_option) {
case 'h':
@@ -403,9 +402,6 @@ protected:
m_long_help.Clear();
}
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
OptionValueString m_help;
OptionValueString m_long_help;
};
@@ -810,15 +806,6 @@ protected:
}
};
-OptionDefinition CommandObjectCommandsAlias::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "help", 'h', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeHelpText, "Help text for this command"},
- {LLDB_OPT_SET_ALL, false, "long-help", 'H', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeHelpText, "Long help text for this command"},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
#pragma mark CommandObjectCommandsUnalias
//-------------------------------------------------------------------------
// CommandObjectCommandsUnalias
@@ -966,6 +953,14 @@ protected:
//-------------------------------------------------------------------------
// CommandObjectCommandsAddRegex
//-------------------------------------------------------------------------
+
+static OptionDefinition g_regex_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "help" , 'h', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeNone, "The help text to display for this command." },
+ { LLDB_OPT_SET_1, false, "syntax", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeNone, "A syntax string showing the typical usage syntax." },
+ // clang-format on
+};
+
#pragma mark CommandObjectCommandsAddRegex
class CommandObjectCommandsAddRegex : public CommandObjectParsed,
@@ -1248,11 +1243,9 @@ private:
m_syntax.clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_regex_options;
+ }
const char *GetHelp() {
return (m_help.empty() ? nullptr : m_help.c_str());
@@ -1274,15 +1267,6 @@ private:
CommandOptions m_options;
};
-OptionDefinition
- CommandObjectCommandsAddRegex::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "help" , 'h', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeNone, "The help text to display for this command."},
- {LLDB_OPT_SET_1, false, "syntax", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeNone, "A syntax string showing the typical usage syntax."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
class CommandObjectPythonFunction : public CommandObjectRaw {
public:
CommandObjectPythonFunction(CommandInterpreter &interpreter, std::string name,
@@ -1447,6 +1431,12 @@ private:
// CommandObjectCommandsScriptImport
//-------------------------------------------------------------------------
+OptionDefinition g_script_import_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "allow-reload", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Allow the script to be loaded even if it was already loaded before. This argument exists for backwards compatibility, but reloading is always allowed, whether you specify it or not." },
+ // clang-format on
+};
+
class CommandObjectCommandsScriptImport : public CommandObjectParsed {
public:
CommandObjectCommandsScriptImport(CommandInterpreter &interpreter)
@@ -1517,11 +1507,9 @@ protected:
m_allow_reload = true;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_script_import_options;
+ }
// Instance variables to hold the values for command options.
@@ -1578,18 +1566,28 @@ protected:
CommandOptions m_options;
};
-OptionDefinition
- CommandObjectCommandsScriptImport::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "allow-reload", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Allow the script to be loaded even if it was already loaded before. This argument exists for backwards compatibility, but reloading is always allowed, whether you specify it or not."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectCommandsScriptAdd
//-------------------------------------------------------------------------
+static OptionEnumValueElement g_script_synchro_type[] = {
+ {eScriptedCommandSynchronicitySynchronous, "synchronous",
+ "Run synchronous"},
+ {eScriptedCommandSynchronicityAsynchronous, "asynchronous",
+ "Run asynchronous"},
+ {eScriptedCommandSynchronicityCurrentValue, "current",
+ "Do not alter current setting"},
+ {0, nullptr, nullptr}};
+
+static OptionDefinition g_script_add_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "function", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonFunction, "Name of the Python function to bind to this command name." },
+ { LLDB_OPT_SET_2, false, "class", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonClass, "Name of the Python class to bind to this command name." },
+ { LLDB_OPT_SET_1, false, "help" , 'h', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeHelpText, "The help text to display for this command." },
+ { LLDB_OPT_SET_ALL, false, "synchronicity", 's', OptionParser::eRequiredArgument, nullptr, g_script_synchro_type, 0, eArgTypeScriptedCommandSynchronicity, "Set the synchronicity of this command's executions with regard to LLDB event system." },
+ // clang-format on
+};
+
class CommandObjectCommandsScriptAdd : public CommandObjectParsed,
public IOHandlerDelegateMultiline {
public:
@@ -1647,7 +1645,7 @@ protected:
case 's':
m_synchronicity =
(ScriptedCommandSynchronicity)Args::StringToOptionEnum(
- option_arg, g_option_table[option_idx].enum_values, 0, error);
+ option_arg, GetDefinitions()[option_idx].enum_values, 0, error);
if (!error.Success())
error.SetErrorStringWithFormat(
"unrecognized value for synchronicity '%s'", option_arg);
@@ -1668,11 +1666,9 @@ protected:
m_synchronicity = eScriptedCommandSynchronicitySynchronous;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_script_add_options;
+ }
// Instance variables to hold the values for command options.
@@ -1816,26 +1812,6 @@ protected:
ScriptedCommandSynchronicity m_synchronicity;
};
-static OptionEnumValueElement g_script_synchro_type[] = {
- {eScriptedCommandSynchronicitySynchronous, "synchronous",
- "Run synchronous"},
- {eScriptedCommandSynchronicityAsynchronous, "asynchronous",
- "Run asynchronous"},
- {eScriptedCommandSynchronicityCurrentValue, "current",
- "Do not alter current setting"},
- {0, nullptr, nullptr}};
-
-OptionDefinition
- CommandObjectCommandsScriptAdd::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "function", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonFunction, "Name of the Python function to bind to this command name."},
- {LLDB_OPT_SET_2, false, "class", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonClass, "Name of the Python class to bind to this command name."},
- {LLDB_OPT_SET_1, false, "help" , 'h', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeHelpText, "The help text to display for this command."},
- {LLDB_OPT_SET_ALL, false, "synchronicity", 's', OptionParser::eRequiredArgument, nullptr, g_script_synchro_type, 0, eArgTypeScriptedCommandSynchronicity, "Set the synchronicity of this command's executions with regard to LLDB event system."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectCommandsScriptList
//-------------------------------------------------------------------------
diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp
index 8dbcc3ef0af..ff8b782bab4 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -34,6 +34,33 @@
using namespace lldb;
using namespace lldb_private;
+static OptionDefinition g_disassemble_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "bytes", 'b', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Show opcode bytes when disassembling." },
+ { LLDB_OPT_SET_ALL, false, "context", 'C', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeNumLines, "Number of context lines of source to show." },
+ { LLDB_OPT_SET_ALL, false, "mixed", 'm', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable mixed source and assembly display." },
+ { LLDB_OPT_SET_ALL, false, "raw", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Print raw disassembly with no symbol information." },
+ { LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePlugin, "Name of the disassembler plugin you want to use." },
+ { LLDB_OPT_SET_ALL, false, "flavor", 'F', OptionParser::eRequiredArgument, nullptr, 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, 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, nullptr, 0, eArgTypeAddressOrExpression, "Address at which to start disassembling." },
+ { LLDB_OPT_SET_1, false, "end-address", 'e', OptionParser::eRequiredArgument, nullptr, 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, nullptr, 0, eArgTypeNumLines, "Number of instructions to display." },
+ { LLDB_OPT_SET_3, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "Disassemble entire contents of the given function name." },
+ { LLDB_OPT_SET_4, false, "frame", 'f', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Disassemble from the start of the current frame's function." },
+ { LLDB_OPT_SET_5, false, "pc", 'p', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Disassemble around the current pc." },
+ { LLDB_OPT_SET_6, false, "line", 'l', OptionParser::eNoArgument, nullptr, 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, nullptr, 0, eArgTypeAddressOrExpression, "Disassemble function containing this address." },
+ // clang-format on
+};
+
CommandObjectDisassemble::CommandOptions::CommandOptions()
: Options(), num_lines_context(0), num_instructions(0), func_name(),
current_function(false), start_addr(), end_addr(), at_pc(false),
@@ -207,39 +234,11 @@ Error CommandObjectDisassemble::CommandOptions::OptionParsingFinished(
return Error();
}
-const OptionDefinition *
+llvm::ArrayRef<OptionDefinition>
CommandObjectDisassemble::CommandOptions::GetDefinitions() {
- return g_option_table;
+ return g_disassemble_options;
}
-OptionDefinition CommandObjectDisassemble::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "bytes", 'b', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Show opcode bytes when disassembling."},
- {LLDB_OPT_SET_ALL, false, "context", 'C', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeNumLines, "Number of context lines of source to show."},
- {LLDB_OPT_SET_ALL, false, "mixed", 'm', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable mixed source and assembly display."},
- {LLDB_OPT_SET_ALL, false, "raw", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Print raw disassembly with no symbol information."},
- {LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePlugin, "Name of the disassembler plugin you want to use."},
- {LLDB_OPT_SET_ALL, false, "flavor", 'F', OptionParser::eRequiredArgument, nullptr, 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, 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, nullptr, 0, eArgTypeAddressOrExpression, "Address at which to start disassembling."},
- {LLDB_OPT_SET_1, false, "end-address", 'e', OptionParser::eRequiredArgument, nullptr, 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, nullptr, 0, eArgTypeNumLines, "Number of instructions to display."},
- {LLDB_OPT_SET_3, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "Disassemble entire contents of the given function name."},
- {LLDB_OPT_SET_4, false, "frame", 'f', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Disassemble from the start of the current frame's function."},
- {LLDB_OPT_SET_5, false, "pc", 'p', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Disassemble around the current pc."},
- {LLDB_OPT_SET_6, false, "line", 'l', OptionParser::eNoArgument, nullptr, 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, nullptr, 0, eArgTypeAddressOrExpression, "Disassemble function containing this address."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectDisassemble
//-------------------------------------------------------------------------
diff --git a/lldb/source/Commands/CommandObjectDisassemble.h b/lldb/source/Commands/CommandObjectDisassemble.h
index a4d132aa1e4..c60f70a3afe 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.h
+++ b/lldb/source/Commands/CommandObjectDisassemble.h
@@ -37,7 +37,7 @@ public:
void OptionParsingStarting(ExecutionContext *execution_context) override;
- const OptionDefinition *GetDefinitions() override;
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
const char *GetPluginName() {
return (plugin_name.empty() ? nullptr : plugin_name.c_str());
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index cc1fdf44b12..b2b1ed3ec3c 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -49,7 +49,7 @@ static OptionEnumValueElement g_description_verbosity_type[] = {
"Show the full output, including persistent variable's name and type"},
{0, nullptr, nullptr}};
-OptionDefinition CommandObjectExpression::CommandOptions::g_option_table[] = {
+static OptionDefinition g_expression_options[] = {
// clang-format off
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "all-threads", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Should we run all threads if the execution doesn't complete on one thread."},
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "ignore-breakpoints", 'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Ignore breakpoint hits while running expressions"},
@@ -69,17 +69,13 @@ OptionDefinition CommandObjectExpression::CommandOptions::g_option_table[] = {
// clang-format on
};
-uint32_t CommandObjectExpression::CommandOptions::GetNumDefinitions() {
- return llvm::array_lengthof(g_option_table);
-}
-
Error CommandObjectExpression::CommandOptions::SetOptionValue(
uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) {
Error error;
auto option_strref = llvm::StringRef::withNullAsEmpty(option_arg);
- const int short_option = g_option_table[option_idx].short_option;
+ const int short_option = GetDefinitions()[option_idx].short_option;
switch (short_option) {
case 'l':
@@ -151,7 +147,7 @@ Error CommandObjectExpression::CommandOptions::SetOptionValue(
}
m_verbosity =
(LanguageRuntimeDescriptionDisplayVerbosity)Args::StringToOptionEnum(
- option_arg, g_option_table[option_idx].enum_values, 0, error);
+ option_arg, GetDefinitions()[option_idx].enum_values, 0, error);
if (!error.Success())
error.SetErrorStringWithFormat(
"unrecognized value for description-verbosity '%s'", option_arg);
@@ -210,9 +206,9 @@ void CommandObjectExpression::CommandOptions::OptionParsingStarting(
allow_jit = true;
}
-const OptionDefinition *
+llvm::ArrayRef<OptionDefinition>
CommandObjectExpression::CommandOptions::GetDefinitions() {
- return g_option_table;
+ return g_expression_options;
}
CommandObjectExpression::CommandObjectExpression(
diff --git a/lldb/source/Commands/CommandObjectExpression.h b/lldb/source/Commands/CommandObjectExpression.h
index 5b8173f9dea..01593aeeec9 100644
--- a/lldb/source/Commands/CommandObjectExpression.h
+++ b/lldb/source/Commands/CommandObjectExpression.h
@@ -32,9 +32,7 @@ public:
~CommandOptions() override;
- uint32_t GetNumDefinitions() override;
-
- const OptionDefinition *GetDefinitions() override;
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
Error SetOptionValue(uint32_t option_idx, const char *option_value,
ExecutionContext *execution_context) override;
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 0c28bd0c2c4..af954ec9547 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -61,6 +61,14 @@ using namespace lldb_private;
// CommandObjectFrameDiagnose
//-------------------------------------------------------------------------
+static OptionDefinition g_frame_diag_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "register", 'r', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeRegisterName, "A register to diagnose." },
+ { LLDB_OPT_SET_1, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddress, "An address to diagnose." },
+ { LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOffset, "An optional offset. Requires --register." }
+ // clang-format on
+};
+
class CommandObjectFrameDiagnose : public CommandObjectParsed {
public:
class CommandOptions : public Options {
@@ -115,10 +123,9 @@ public:
offset.reset();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_frame_diag_options;
+ }
// Options.
llvm::Optional<lldb::addr_t> address;
@@ -215,16 +222,6 @@ protected:
CommandOptions m_options;
};
-OptionDefinition CommandObjectFrameDiagnose::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_1, false, "register", 'r', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeRegisterName, "A register to diagnose."},
- {LLDB_OPT_SET_1, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddress, "An address to diagnose."},
- {LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOffset, "An optional offset. Requires --register."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
#pragma mark CommandObjectFrameInfo
//-------------------------------------------------------------------------
@@ -257,6 +254,12 @@ protected:
// CommandObjectFrameSelect
//-------------------------------------------------------------------------
+static OptionDefinition g_frame_select_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "relative", 'r', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOffset, "A relative frame index offset from the current frame index." },
+ // clang-format on
+};
+
class CommandObjectFrameSelect : public CommandObjectParsed {
public:
class CommandOptions : public Options {
@@ -292,11 +295,10 @@ public:
relative_frame_offset = INT32_MIN;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_frame_select_options;
+ }
- static OptionDefinition g_option_table[];
int32_t relative_frame_offset;
};
@@ -420,13 +422,6 @@ protected:
CommandOptions m_options;
};
-OptionDefinition CommandObjectFrameSelect::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "relative", 'r', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOffset, "A relative frame index offset from the current frame index."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
#pragma mark CommandObjectFrameVariable
//----------------------------------------------------------------------
// List images with associated information
diff --git a/lldb/source/Commands/CommandObjectHelp.cpp b/lldb/source/Commands/CommandObjectHelp.cpp
index 8e9188838be..aa611ce64bf 100644
--- a/lldb/source/Commands/CommandObjectHelp.cpp
+++ b/lldb/source/Commands/CommandObjectHelp.cpp
@@ -66,15 +66,19 @@ CommandObjectHelp::CommandObjectHelp(CommandInterpreter &interpreter)
CommandObjectHelp::~CommandObjectHelp() = default;
-OptionDefinition CommandObjectHelp::CommandOptions::g_option_table[] = {
+static OptionDefinition g_help_options[] = {
// clang-format off
{LLDB_OPT_SET_ALL, false, "hide-aliases", 'a', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Hide aliases in the command list."},
{LLDB_OPT_SET_ALL, false, "hide-user-commands", 'u', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Hide user-defined commands from the list."},
{LLDB_OPT_SET_ALL, false, "show-hidden-commands", 'h', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Include commands prefixed with an underscore."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
// clang-format on
};
+llvm::ArrayRef<OptionDefinition>
+CommandObjectHelp::CommandOptions::GetDefinitions() {
+ return g_help_options;
+}
+
bool CommandObjectHelp::DoExecute(Args &command, CommandReturnObject &result) {
CommandObject::CommandMap::iterator pos;
CommandObject *cmd_obj;
diff --git a/lldb/source/Commands/CommandObjectHelp.h b/lldb/source/Commands/CommandObjectHelp.h
index 827eb574de3..df1c0ab1292 100644
--- a/lldb/source/Commands/CommandObjectHelp.h
+++ b/lldb/source/Commands/CommandObjectHelp.h
@@ -75,11 +75,7 @@ public:
m_show_hidden = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
// Instance variables to hold the values for command options.
diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp
index 85134442213..29b937f7c93 100644
--- a/lldb/source/Commands/CommandObjectLog.cpp
+++ b/lldb/source/Commands/CommandObjectLog.cpp
@@ -36,6 +36,21 @@
using namespace lldb;
using namespace lldb_private;
+static OptionDefinition g_log_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFilename, "Set the destination file to log to." },
+ { LLDB_OPT_SET_1, false, "threadsafe", 't', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable thread safe logging to avoid interweaved log lines." },
+ { LLDB_OPT_SET_1, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable verbose logging." },
+ { LLDB_OPT_SET_1, false, "debug", 'g', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable debug logging." },
+ { LLDB_OPT_SET_1, false, "sequence", 's', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Prepend all log lines with an increasing integer sequence id." },
+ { LLDB_OPT_SET_1, false, "timestamp", 'T', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Prepend all log lines with a timestamp." },
+ { LLDB_OPT_SET_1, false, "pid-tid", 'p', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Prepend all log lines with the process and thread ID that generates the log line." },
+ { LLDB_OPT_SET_1, false, "thread-name",'n', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Prepend all log lines with the thread name for the thread that generates the log line." },
+ { LLDB_OPT_SET_1, false, "stack", 'S', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Append a stack backtrace to each log line." },
+ { LLDB_OPT_SET_1, false, "append", 'a', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Append to the log file instead of overwriting." },
+ // clang-format on
+};
+
class CommandObjectLogEnable : public CommandObjectParsed {
public:
//------------------------------------------------------------------
@@ -151,11 +166,9 @@ public:
log_options = 0;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_log_options;
+ }
// Instance variables to hold the values for command options.
@@ -191,22 +204,6 @@ protected:
CommandOptions m_options;
};
-OptionDefinition CommandObjectLogEnable::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFilename, "Set the destination file to log to."},
- {LLDB_OPT_SET_1, false, "threadsafe", 't', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable thread safe logging to avoid interweaved log lines."},
- {LLDB_OPT_SET_1, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable verbose logging."},
- {LLDB_OPT_SET_1, false, "debug", 'g', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable debug logging."},
- {LLDB_OPT_SET_1, false, "sequence", 's', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Prepend all log lines with an increasing integer sequence id."},
- {LLDB_OPT_SET_1, false, "timestamp", 'T', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Prepend all log lines with a timestamp."},
- {LLDB_OPT_SET_1, false, "pid-tid", 'p', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Prepend all log lines with the process and thread ID that generates the log line."},
- {LLDB_OPT_SET_1, false, "thread-name",'n', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Prepend all log lines with the thread name for the thread that generates the log line."},
- {LLDB_OPT_SET_1, false, "stack", 'S', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Append a stack backtrace to each log line."},
- {LLDB_OPT_SET_1, false, "append", 'a', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Append to the log file instead of overwriting."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
class CommandObjectLogDisable : public CommandObjectParsed {
public:
//------------------------------------------------------------------
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 9a2180c5ed4..4be666e118b 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -48,7 +48,7 @@
using namespace lldb;
using namespace lldb_private;
-static OptionDefinition g_option_table[] = {
+static OptionDefinition g_read_memory_options[] = {
// clang-format off
{LLDB_OPT_SET_1, false, "num-per-line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeNumberPerLine, "The number of items per line to display." },
{LLDB_OPT_SET_2, false, "binary", 'b', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "If true, memory will be saved as binary. If false, the memory is saved save as an ASCII dump that "
@@ -69,16 +69,14 @@ public:
~OptionGroupReadMemory() override = default;
- uint32_t GetNumDefinitions() override {
- return sizeof(g_option_table) / sizeof(OptionDefinition);
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_read_memory_options;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
Error SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override {
Error error;
- const int short_option = g_option_table[option_idx].short_option;
+ const int short_option = g_read_memory_options[option_idx].short_option;
switch (short_option) {
case 'l':
@@ -906,11 +904,7 @@ public:
~OptionGroupFindMemory() override = default;
- uint32_t GetNumDefinitions() override {
- return sizeof(g_memory_find_option_table) / sizeof(OptionDefinition);
- }
-
- const OptionDefinition *GetDefinitions() override {
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
return g_memory_find_option_table;
}
@@ -1206,11 +1200,7 @@ public:
~OptionGroupWriteMemory() override = default;
- uint32_t GetNumDefinitions() override {
- return sizeof(g_memory_write_option_table) / sizeof(OptionDefinition);
- }
-
- const OptionDefinition *GetDefinitions() override {
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
return g_memory_write_option_table;
}
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index 295f4c7133c..db3e2aba9dc 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -144,11 +144,7 @@ public:
m_permissions = 0;
}
- uint32_t GetNumDefinitions() override {
- return llvm::array_lengthof(g_permissions_options);
- }
-
- const lldb_private::OptionDefinition *GetDefinitions() override {
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
return g_permissions_options;
}
@@ -621,6 +617,14 @@ public:
//----------------------------------------------------------------------
// "platform fread"
//----------------------------------------------------------------------
+
+static OptionDefinition g_platform_fread_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeIndex, "Offset into the file at which to start reading." },
+ { LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "Number of bytes to read from the file." },
+ // clang-format on
+};
+
class CommandObjectPlatformFRead : public CommandObjectParsed {
public:
CommandObjectPlatformFRead(CommandInterpreter &interpreter)
@@ -693,11 +697,9 @@ protected:
m_count = 1;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_platform_fread_options;
+ }
// Instance variables to hold the values for command options.
@@ -708,18 +710,17 @@ protected:
CommandOptions m_options;
};
-OptionDefinition CommandObjectPlatformFRead::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeIndex, "Offset into the file at which to start reading."},
- {LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "Number of bytes to read from the file."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//----------------------------------------------------------------------
// "platform fwrite"
//----------------------------------------------------------------------
+
+static OptionDefinition g_platform_fwrite_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeIndex, "Offset into the file at which to start reading." },
+ { LLDB_OPT_SET_1, false, "data", 'd', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeValue, "Text to write to the file." },
+ // clang-format on
+};
+
class CommandObjectPlatformFWrite : public CommandObjectParsed {
public:
CommandObjectPlatformFWrite(CommandInterpreter &interpreter)
@@ -789,11 +790,9 @@ protected:
m_data.clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_platform_fwrite_options;
+ }
// Instance variables to hold the values for command options.
@@ -804,15 +803,6 @@ protected:
CommandOptions m_options;
};
-OptionDefinition CommandObjectPlatformFWrite::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeIndex, "Offset into the file at which to start reading."},
- {LLDB_OPT_SET_1, false, "data", 'd', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeValue, "Text to write to the file."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
class CommandObjectPlatformFile : public CommandObjectMultiword {
public:
//------------------------------------------------------------------
@@ -1117,6 +1107,28 @@ protected:
//----------------------------------------------------------------------
// "platform process list"
//----------------------------------------------------------------------
+
+OptionDefinition g_platform_process_list_option_array[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "pid", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePid, "List the process info for a specific process ID." },
+ { LLDB_OPT_SET_2, true, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName, "Find processes with executable basenames that match a string." },
+ { LLDB_OPT_SET_3, true, "ends-with", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName, "Find processes with executable basenames that end with a string." },
+ { LLDB_OPT_SET_4, true, "starts-with", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName, "Find processes with executable basenames that start with a string." },
+ { LLDB_OPT_SET_5, true, "contains", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName, "Find processes with executable basenames that contain a string." },
+ { LLDB_OPT_SET_6, true, "regex", 'r', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeRegularExpression, "Find processes with executable basenames that match a regular expression." },
+ { LLDB_OPT_SET_FROM_TO(2, 6), false, "parent", 'P', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePid, "Find processes that have a matching parent process ID." },
+ { LLDB_OPT_SET_FROM_TO(2, 6), false, "uid", 'u', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Find processes that have a matching user ID." },
+ { LLDB_OPT_SET_FROM_TO(2, 6), false, "euid", 'U', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Find processes that have a matching effective user ID." },
+ { LLDB_OPT_SET_FROM_TO(2, 6), false, "gid", 'g', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Find processes that have a matching group ID." },
+ { LLDB_OPT_SET_FROM_TO(2, 6), false, "egid", 'G', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Find processes that have a matching effective group ID." },
+ { LLDB_OPT_SET_FROM_TO(2, 6), false, "arch", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeArchitecture, "Find processes that have a matching architecture." },
+ { LLDB_OPT_SET_FROM_TO(1, 6), false, "show-args", 'A', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Show process arguments instead of the process executable basename." },
+ { LLDB_OPT_SET_FROM_TO(1, 6), false, "verbose", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable verbose output." },
+ // clang-format on
+};
+llvm::MutableArrayRef<OptionDefinition>
+ g_platform_process_list_options(g_platform_process_list_option_array);
+
class CommandObjectPlatformProcessList : public CommandObjectParsed {
public:
CommandObjectPlatformProcessList(CommandInterpreter &interpreter)
@@ -1244,13 +1256,13 @@ protected:
std::call_once(g_once_flag, []() {
PosixPlatformCommandOptionValidator *posix_validator =
new PosixPlatformCommandOptionValidator();
- for (size_t i = 0; g_option_table[i].short_option != 0; ++i) {
- switch (g_option_table[i].short_option) {
+ for (auto &Option : g_platform_process_list_options) {
+ switch (Option.short_option) {
case 'u':
case 'U':
case 'g':
case 'G':
- g_option_table[i].validator = posix_validator;
+ Option.validator = posix_validator;
break;
default:
break;
@@ -1382,11 +1394,9 @@ protected:
verbose = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_platform_process_list_options;
+ }
// Instance variables to hold the values for command options.
@@ -1398,27 +1408,6 @@ protected:
CommandOptions m_options;
};
-OptionDefinition
- CommandObjectPlatformProcessList::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "pid", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePid, "List the process info for a specific process ID."},
- {LLDB_OPT_SET_2, true, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName, "Find processes with executable basenames that match a string."},
- {LLDB_OPT_SET_3, true, "ends-with", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName, "Find processes with executable basenames that end with a string."},
- {LLDB_OPT_SET_4, true, "starts-with", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName, "Find processes with executable basenames that start with a string."},
- {LLDB_OPT_SET_5, true, "contains", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName, "Find processes with executable basenames that contain a string."},
- {LLDB_OPT_SET_6, true, "regex", 'r', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeRegularExpression, "Find processes with executable basenames that match a regular expression."},
- {LLDB_OPT_SET_FROM_TO(2, 6), false, "parent", 'P', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePid, "Find processes that have a matching parent process ID."},
- {LLDB_OPT_SET_FROM_TO(2, 6), false, "uid", 'u', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Find processes that have a matching user ID."},
- {LLDB_OPT_SET_FROM_TO(2, 6), false, "euid", 'U', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Find processes that have a matching effective user ID."},
- {LLDB_OPT_SET_FROM_TO(2, 6), false, "gid", 'g', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Find processes that have a matching group ID."},
- {LLDB_OPT_SET_FROM_TO(2, 6), false, "egid", 'G', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Find processes that have a matching effective group ID."},
- {LLDB_OPT_SET_FROM_TO(2, 6), false, "arch", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeArchitecture, "Find processes that have a matching architecture."},
- {LLDB_OPT_SET_FROM_TO(1, 6), false, "show-args", 'A', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Show process arguments instead of the process executable basename."},
- {LLDB_OPT_SET_FROM_TO(1, 6), false, "verbose", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable verbose output."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//----------------------------------------------------------------------
// "platform process info"
//----------------------------------------------------------------------
@@ -1509,6 +1498,15 @@ protected:
}
};
+static OptionDefinition g_platform_process_attach_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePlugin, "Name of the process plugin you want to use." },
+ { LLDB_OPT_SET_1, false, "pid", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePid, "The process ID of an existing process to attach to." },
+ { LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName, "The name of the process to attach to." },
+ { LLDB_OPT_SET_2, false, "waitfor", 'w', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Wait for the process with <process-name> to launch." },
+ // clang-format on
+};
+
class CommandObjectPlatformProcessAttach : public CommandObjectParsed {
public:
class CommandOptions : public Options {
@@ -1561,7 +1559,9 @@ public:
attach_info.Clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_platform_process_attach_options;
+ }
bool HandleOptionArgumentCompletion(
Args &input, int cursor_index, int char_pos,
@@ -1574,8 +1574,7 @@ public:
// We are only completing the name option for now...
- const OptionDefinition *opt_defs = GetDefinitions();
- if (opt_defs[opt_defs_index].short_option == 'n') {
+ if (GetDefinitions()[opt_defs_index].short_option == 'n') {
// Are we in the name?
// Look to see if there is a -P argument provided, and if so use that
@@ -1654,17 +1653,6 @@ protected:
CommandOptions m_options;
};
-OptionDefinition
- CommandObjectPlatformProcessAttach::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
- {LLDB_OPT_SET_1, false, "pid", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePid, "The process ID of an existing process to attach to."},
- {LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName, "The name of the process to attach to."},
- {LLDB_OPT_SET_2, false, "waitfor", 'w', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Wait for the process with <process-name> to launch."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
class CommandObjectPlatformProcess : public CommandObjectMultiword {
public:
//------------------------------------------------------------------
@@ -1699,6 +1687,12 @@ private:
//----------------------------------------------------------------------
// "platform shell"
//----------------------------------------------------------------------
+static OptionDefinition g_platform_shell_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "timeout", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeValue, "Seconds to wait for the remote host to finish running the command." },
+ // clang-format on
+};
+
class CommandObjectPlatformShell : public CommandObjectRaw {
public:
class CommandOptions : public Options {
@@ -1707,15 +1701,15 @@ public:
~CommandOptions() override = default;
- virtual uint32_t GetNumDefinitions() { return 1; }
-
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_platform_shell_options;
+ }
Error SetOptionValue(uint32_t option_idx, const char *option_value,
ExecutionContext *execution_context) override {
Error error;
- const char short_option = (char)g_option_table[option_idx].short_option;
+ const char short_option = (char)GetDefinitions()[option_idx].short_option;
switch (short_option) {
case 't': {
@@ -1737,9 +1731,6 @@ public:
void OptionParsingStarting(ExecutionContext *execution_context) override {}
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
uint32_t timeout;
};
@@ -1841,14 +1832,6 @@ public:
CommandOptions m_options;
};
-OptionDefinition CommandObjectPlatformShell::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "timeout", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeValue, "Seconds to wait for the remote host to finish running the command."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//----------------------------------------------------------------------
// "platform install" - install a target to a remote end
//----------------------------------------------------------------------
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 26e7602493d..582e8983458 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -312,6 +312,18 @@ protected:
//-------------------------------------------------------------------------
// CommandObjectProcessAttach
//-------------------------------------------------------------------------
+
+static OptionDefinition g_process_attach_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "continue", 'c', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Immediately continue the process once attached." },
+ { LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePlugin, "Name of the process plugin you want to use." },
+ { LLDB_OPT_SET_1, false, "pid", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePid, "The process ID of an existing process to attach to." },
+ { LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName, "The name of the process to attach to." },
+ { LLDB_OPT_SET_2, false, "include-existing", 'i', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Include existing processes when doing attach -w." },
+ { LLDB_OPT_SET_2, false, "waitfor", 'w', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Wait for the process with <process-name> to launch." },
+ // clang-format on
+};
+
#pragma mark CommandObjectProcessAttach
class CommandObjectProcessAttach : public CommandObjectProcessLaunchOrAttach {
public:
@@ -373,7 +385,9 @@ public:
attach_info.Clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_process_attach_options;
+ }
bool HandleOptionArgumentCompletion(
Args &input, int cursor_index, int char_pos,
@@ -386,8 +400,7 @@ public:
// We are only completing the name option for now...
- const OptionDefinition *opt_defs = GetDefinitions();
- if (opt_defs[opt_defs_index].short_option == 'n') {
+ if (GetDefinitions()[opt_defs_index].short_option == 'n') {
// Are we in the name?
// Look to see if there is a -P argument provided, and if so use that
@@ -421,10 +434,6 @@ public:
return false;
}
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
-
// Instance variables to hold the values for command options.
ProcessAttachInfo attach_info;
@@ -559,22 +568,16 @@ protected:
CommandOptions m_options;
};
-OptionDefinition CommandObjectProcessAttach::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "continue", 'c', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Immediately continue the process once attached."},
- {LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
- {LLDB_OPT_SET_1, false, "pid", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePid, "The process ID of an existing process to attach to."},
- {LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName, "The name of the process to attach to."},
- {LLDB_OPT_SET_2, false, "include-existing", 'i', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Include existing processes when doing attach -w."},
- {LLDB_OPT_SET_2, false, "waitfor", 'w', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Wait for the process with <process-name> to launch."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectProcessContinue
//-------------------------------------------------------------------------
+
+static OptionDefinition g_process_continue_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "ignore-count",'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Ignore <N> crossings of the breakpoint (if it exists) for the currently selected thread." }
+ // clang-format on
+};
+
#pragma mark CommandObjectProcessContinue
class CommandObjectProcessContinue : public CommandObjectParsed {
@@ -627,11 +630,9 @@ protected:
m_ignore = 0;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_process_continue_options;
+ }
uint32_t m_ignore;
};
@@ -735,17 +736,15 @@ protected:
CommandOptions m_options;
};
-OptionDefinition
- CommandObjectProcessContinue::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "ignore-count",'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Ignore <N> crossings of the breakpoint (if it exists) for the currently selected thread."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectProcessDetach
//-------------------------------------------------------------------------
+static OptionDefinition g_process_detach_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "keep-stopped", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the process should be kept stopped on detach (if possible)." },
+ // clang-format on
+};
+
#pragma mark CommandObjectProcessDetach
class CommandObjectProcessDetach : public CommandObjectParsed {
@@ -789,11 +788,9 @@ public:
m_keep_stopped = eLazyBoolCalculate;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_process_detach_options;
+ }
// Instance variables to hold the values for command options.
LazyBool m_keep_stopped;
@@ -838,17 +835,16 @@ protected:
CommandOptions m_options;
};
-OptionDefinition CommandObjectProcessDetach::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_1, false, "keep-stopped", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the process should be kept stopped on detach (if possible)."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectProcessConnect
//-------------------------------------------------------------------------
+
+static OptionDefinition g_process_connect_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "plugin", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePlugin, "Name of the process plugin you want to use." },
+ // clang-format on
+};
+
#pragma mark CommandObjectProcessConnect
class CommandObjectProcessConnect : public CommandObjectParsed {
@@ -885,11 +881,9 @@ public:
plugin_name.clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_process_connect_options;
+ }
// Instance variables to hold the values for command options.
@@ -947,14 +941,6 @@ protected:
CommandOptions m_options;
};
-OptionDefinition CommandObjectProcessConnect::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "plugin", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectProcessPlugin
//-------------------------------------------------------------------------
@@ -981,6 +967,13 @@ public:
//-------------------------------------------------------------------------
// CommandObjectProcessLoad
//-------------------------------------------------------------------------
+
+static OptionDefinition g_process_load_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "install", 'i', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypePath, "Install the shared library to the target. If specified without an argument then the library will installed in the current working directory." },
+ // clang-format on
+};
+
#pragma mark CommandObjectProcessLoad
class CommandObjectProcessLoad : public CommandObjectParsed {
@@ -1018,10 +1011,9 @@ public:
install_path.Clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_process_load_options;
+ }
// Instance variables to hold the values for command options.
bool do_install;
@@ -1085,13 +1077,6 @@ protected:
CommandOptions m_options;
};
-OptionDefinition CommandObjectProcessLoad::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "install", 'i', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypePath, "Install the shared library to the target. If specified without an argument then the library will installed in the current working directory."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectProcessUnload
//-------------------------------------------------------------------------
@@ -1380,6 +1365,15 @@ public:
//-------------------------------------------------------------------------
// CommandObjectProcessHandle
//-------------------------------------------------------------------------
+
+static OptionDefinition g_process_handle_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "stop", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the process should be stopped if the signal is received." },
+ { LLDB_OPT_SET_1, false, "notify", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the debugger should notify the user if the signal is received." },
+ { LLDB_OPT_SET_1, false, "pass", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the signal should be passed to the process." }
+ // clang-format on
+};
+
#pragma mark CommandObjectProcessHandle
class CommandObjectProcessHandle : public CommandObjectParsed {
@@ -1419,11 +1413,9 @@ public:
pass.clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_process_handle_options;
+ }
// Instance variables to hold the values for command options.
@@ -1631,16 +1623,6 @@ protected:
CommandOptions m_options;
};
-OptionDefinition CommandObjectProcessHandle::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_1, false, "stop", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the process should be stopped if the signal is received."},
- {LLDB_OPT_SET_1, false, "notify", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the debugger should notify the user if the signal is received."},
- {LLDB_OPT_SET_1, false, "pass", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the signal should be passed to the process."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectMultiwordProcess
//-------------------------------------------------------------------------
diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp
index 47a079d52be..8ee6c65cdb6 100644
--- a/lldb/source/Commands/CommandObjectRegister.cpp
+++ b/lldb/source/Commands/CommandObjectRegister.cpp
@@ -38,6 +38,15 @@ using namespace lldb_private;
//----------------------------------------------------------------------
// "register read"
//----------------------------------------------------------------------
+
+static OptionDefinition g_register_read_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "alternate", 'A', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display register names using the alternate register name if there is one." },
+ { LLDB_OPT_SET_1, false, "set", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeIndex, "Specify which register sets to dump by index." },
+ { LLDB_OPT_SET_2, false, "all", 'a', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Show all register sets." },
+ // clang-format on
+};
+
class CommandObjectRegisterRead : public CommandObjectParsed {
public:
CommandObjectRegisterRead(CommandInterpreter &interpreter)
@@ -241,9 +250,9 @@ protected:
~CommandOptions() override = default;
- uint32_t GetNumDefinitions() override;
-
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_register_read_options;
+ }
void OptionParsingStarting(ExecutionContext *execution_context) override {
set_indexes.Clear();
@@ -254,7 +263,7 @@ protected:
Error SetOptionValue(uint32_t option_idx, const char *option_value,
ExecutionContext *execution_context) override {
Error error;
- const int short_option = g_option_table[option_idx].short_option;
+ const int short_option = GetDefinitions()[option_idx].short_option;
switch (short_option) {
case 's': {
OptionValueSP value_sp(OptionValueUInt64::Create(option_value, error));
@@ -286,10 +295,6 @@ protected:
return error;
}
- // Options table: Required for subclasses of Options.
-
- static const OptionDefinition g_option_table[];
-
// Instance variables to hold the values for command options.
OptionValueArray set_indexes;
OptionValueBoolean dump_all_sets;
@@ -301,19 +306,6 @@ protected:
CommandOptions m_command_options;
};
-const OptionDefinition
- CommandObjectRegisterRead::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "alternate", 'A', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display register names using the alternate register name if there is one."},
- {LLDB_OPT_SET_1, false, "set", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeIndex, "Specify which register sets to dump by index."},
- {LLDB_OPT_SET_2, false, "all", 'a', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Show all register sets."},
- // clang-format on
-};
-
-uint32_t CommandObjectRegisterRead::CommandOptions::GetNumDefinitions() {
- return llvm::array_lengthof(g_option_table);
-}
-
//----------------------------------------------------------------------
// "register write"
//----------------------------------------------------------------------
diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp
index 4d545d79382..f1420a23dbe 100644
--- a/lldb/source/Commands/CommandObjectSettings.cpp
+++ b/lldb/source/Commands/CommandObjectSettings.cpp
@@ -27,6 +27,12 @@ using namespace lldb_private;
// CommandObjectSettingsSet
//-------------------------------------------------------------------------
+static OptionDefinition g_settings_set_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_2, false, "global", 'g', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Apply the new value to the global default value." }
+ // clang-format on
+};
+
class CommandObjectSettingsSet : public CommandObjectRaw {
public:
CommandObjectSettingsSet(CommandInterpreter &interpreter)
@@ -118,11 +124,9 @@ insert-before or insert-after.");
m_global = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_settings_set_options;
+ }
// Instance variables to hold the values for command options.
@@ -242,13 +246,6 @@ private:
CommandOptions m_options;
};
-OptionDefinition CommandObjectSettingsSet::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_2, false, "global", 'g', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Apply the new value to the global default value."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectSettingsShow -- Show current values
//-------------------------------------------------------------------------
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index 237b3402e45..c03c724ec36 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -40,6 +40,18 @@ using namespace lldb_private;
// CommandObjectSourceInfo - debug line entries dumping command
//----------------------------------------------------------------------
+static OptionDefinition g_source_info_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "The number of line entries to display." },
+ { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "shlib", 's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Look up the source in the given module or shared library (can be specified more than once)." },
+ { LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source." },
+ { LLDB_OPT_SET_1, false, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "The line number at which to start the displaying lines." },
+ { LLDB_OPT_SET_1, false, "end-line", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "The line number at which to stop displaying lines." },
+ { LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeSymbol, "The name of a function whose source to display." },
+ { LLDB_OPT_SET_3, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Lookup the address and display the source information for the corresponding file and line." },
+ // clang-format on
+};
+
class CommandObjectSourceInfo : public CommandObjectParsed {
class CommandOptions : public Options {
public:
@@ -50,7 +62,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
Error SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override {
Error error;
- const int short_option = g_option_table[option_idx].short_option;
+ const int short_option = GetDefinitions()[option_idx].short_option;
switch (short_option) {
case 'l':
start_line = StringConvert::ToUInt32(option_arg, 0);
@@ -108,9 +120,9 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
modules.clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_source_info_options;
+ }
// Instance variables to hold the values for command options.
FileSpec file_spec;
@@ -649,24 +661,24 @@ protected:
ModuleList m_module_list;
};
-OptionDefinition CommandObjectSourceInfo::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "The number of line entries to display."},
- {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "shlib", 's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Look up the source in the given module or shared library (can be specified more than once)."},
- {LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source."},
- {LLDB_OPT_SET_1, false, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "The line number at which to start the displaying lines."},
- {LLDB_OPT_SET_1, false, "end-line", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "The line number at which to stop displaying lines."},
- {LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeSymbol, "The name of a function whose source to display."},
- {LLDB_OPT_SET_3, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Lookup the address and display the source information for the corresponding file and line."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
#pragma mark CommandObjectSourceList
//-------------------------------------------------------------------------
// CommandObjectSourceList
//-------------------------------------------------------------------------
+static OptionDefinition g_source_list_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "The number of source lines to display." },
+ { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "shlib", 's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Look up the source file in the given shared library." },
+ { LLDB_OPT_SET_ALL, false, "show-breakpoints", 'b', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Show the line table locations from the debug information that indicate valid places to set source level breakpoints." },
+ { LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source." },
+ { LLDB_OPT_SET_1, false, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "The line number at which to start the display source." },
+ { LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeSymbol, "The name of a function whose source to display." },
+ { LLDB_OPT_SET_3, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Lookup the address and display the source information for the corresponding file and line." },
+ { LLDB_OPT_SET_4, false, "reverse", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Reverse the listing to look backwards from the last displayed block of source." },
+ // clang-format on
+};
+
class CommandObjectSourceList : public CommandObjectParsed {
class CommandOptions : public Options {
public:
@@ -677,7 +689,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
Error SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override {
Error error;
- const int short_option = g_option_table[option_idx].short_option;
+ const int short_option = GetDefinitions()[option_idx].short_option;
switch (short_option) {
case 'l':
start_line = StringConvert::ToUInt32(option_arg, 0);
@@ -736,9 +748,9 @@ class CommandObjectSourceList : public CommandObjectParsed {
modules.clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_source_list_options;
+ }
// Instance variables to hold the values for command options.
FileSpec file_spec;
@@ -1306,20 +1318,6 @@ protected:
std::string m_reverse_name;
};
-OptionDefinition CommandObjectSourceList::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "The number of source lines to display."},
- {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "shlib", 's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Look up the source file in the given shared library."},
- {LLDB_OPT_SET_ALL, false, "show-breakpoints", 'b', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Show the line table locations from the debug information that indicate valid places to set source level breakpoints."},
- {LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source."},
- {LLDB_OPT_SET_1, false, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "The line number at which to start the display source."},
- {LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeSymbol, "The name of a function whose source to display."},
- {LLDB_OPT_SET_3, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Lookup the address and display the source information for the corresponding file and line."},
- {LLDB_OPT_SET_4, false, "reverse", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Reverse the listing to look backwards from the last displayed block of source."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
#pragma mark CommandObjectMultiwordSource
//-------------------------------------------------------------------------
// CommandObjectMultiwordSource
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 321341cd861..407aeac3f12 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -1940,6 +1940,19 @@ protected:
#pragma mark CommandObjectTargetModulesDumpSymtab
+static OptionEnumValueElement g_sort_option_enumeration[4] = {
+ {eSortOrderNone, "none",
+ "No sorting, use the original symbol table order."},
+ {eSortOrderByAddress, "address", "Sort output by symbol address."},
+ {eSortOrderByName, "name", "Sort output by symbol name."},
+ {0, nullptr, nullptr}};
+
+static OptionDefinition g_target_modules_dump_symtab_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "sort", 's', OptionParser::eRequiredArgument, nullptr, g_sort_option_enumeration, 0, eArgTypeSortOrder, "Supply a sort order when dumping the symbol table." }
+ // clang-format on
+};
+
class CommandObjectTargetModulesDumpSymtab
: public CommandObjectTargetModulesModuleAutoComplete {
public:
@@ -1967,8 +1980,8 @@ public:
switch (short_option) {
case 's':
m_sort_order = (SortOrder)Args::StringToOptionEnum(
- option_arg, g_option_table[option_idx].enum_values, eSortOrderNone,
- error);
+ option_arg, GetDefinitions()[option_idx].enum_values,
+ eSortOrderNone, error);
break;
default:
@@ -1983,10 +1996,9 @@ public:
m_sort_order = eSortOrderNone;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_target_modules_dump_symtab_options;
+ }
SortOrder m_sort_order;
};
@@ -2072,21 +2084,6 @@ protected:
CommandOptions m_options;
};
-static OptionEnumValueElement g_sort_option_enumeration[4] = {
- {eSortOrderNone, "none",
- "No sorting, use the original symbol table order."},
- {eSortOrderByAddress, "address", "Sort output by symbol address."},
- {eSortOrderByName, "name", "Sort output by symbol name."},
- {0, nullptr, nullptr}};
-
-OptionDefinition
- CommandObjectTargetModulesDumpSymtab::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "sort", 's', OptionParser::eRequiredArgument, nullptr, g_sort_option_enumeration, 0, eArgTypeSortOrder, "Supply a sort order when dumping the symbol table."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
#pragma mark CommandObjectTargetModulesDumpSections
//----------------------------------------------------------------------
@@ -2774,6 +2771,27 @@ protected:
//----------------------------------------------------------------------
// List images with associated information
//----------------------------------------------------------------------
+
+static OptionDefinition g_target_modules_list_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Display the image at this address." },
+ { LLDB_OPT_SET_1, false, "arch", 'A', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the architecture when listing images." },
+ { LLDB_OPT_SET_1, false, "triple", 't', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the triple when listing images." },
+ { LLDB_OPT_SET_1, false, "header", 'h', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display the image header address as a load address if debugging, a file address otherwise." },
+ { LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display the image header address offset from the header file address (the slide amount)." },
+ { LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display the UUID when listing images." },
+ { LLDB_OPT_SET_1, false, "fullpath", 'f', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the fullpath to the image object file." },
+ { LLDB_OPT_SET_1, false, "directory", 'd', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the directory with optional width for the image object file." },
+ { LLDB_OPT_SET_1, false, "basename", 'b', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the basename with optional width for the image object file." },
+ { LLDB_OPT_SET_1, false, "symfile", 's', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the fullpath to the image symbol file with optional width." },
+ { LLDB_OPT_SET_1, false, "symfile-unique", 'S', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the symbol file with optional width only if it is different from the executable object file." },
+ { LLDB_OPT_SET_1, false, "mod-time", 'm', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the modification time with optional width of the module." },
+ { LLDB_OPT_SET_1, false, "ref-count", 'r', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the reference count if the module is still in the shared module cache." },
+ { LLDB_OPT_SET_1, false, "pointer", 'p', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeNone, "Display the module pointer." },
+ { LLDB_OPT_SET_1, false, "global", 'g', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display the modules from the global module list, not just the current target." }
+ // clang-format on
+};
+
class CommandObjectTargetModulesList : public CommandObjectParsed {
public:
class CommandOptions : public Options {
@@ -2809,11 +2827,9 @@ public:
m_module_addr = LLDB_INVALID_ADDRESS;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_target_modules_list_options;
+ }
// Instance variables to hold the values for command options.
typedef std::vector<std::pair<char, uint32_t>> FormatWidthCollection;
@@ -3116,34 +3132,19 @@ protected:
CommandOptions m_options;
};
-OptionDefinition
- CommandObjectTargetModulesList::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Display the image at this address."},
- {LLDB_OPT_SET_1, false, "arch", 'A', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the architecture when listing images."},
- {LLDB_OPT_SET_1, false, "triple", 't', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the triple when listing images."},
- {LLDB_OPT_SET_1, false, "header", 'h', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display the image header address as a load address if debugging, a file address otherwise."},
- {LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display the image header address offset from the header file address (the slide amount)."},
- {LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display the UUID when listing images."},
- {LLDB_OPT_SET_1, false, "fullpath", 'f', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the fullpath to the image object file."},
- {LLDB_OPT_SET_1, false, "directory", 'd', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the directory with optional width for the image object file."},
- {LLDB_OPT_SET_1, false, "basename", 'b', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the basename with optional width for the image object file."},
- {LLDB_OPT_SET_1, false, "symfile", 's', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the fullpath to the image symbol file with optional width."},
- {LLDB_OPT_SET_1, false, "symfile-unique", 'S', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the symbol file with optional width only if it is different from the executable object file."},
- {LLDB_OPT_SET_1, false, "mod-time", 'm', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the modification time with optional width of the module."},
- {LLDB_OPT_SET_1, false, "ref-count", 'r', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeWidth, "Display the reference count if the module is still in the shared module cache."},
- {LLDB_OPT_SET_1, false, "pointer", 'p', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeNone, "Display the module pointer."},
- {LLDB_OPT_SET_1, false, "global", 'g', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display the modules from the global module list, not just the current target."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
#pragma mark CommandObjectTargetModulesShowUnwind
//----------------------------------------------------------------------
// Lookup unwind information in images
//----------------------------------------------------------------------
+static OptionDefinition g_target_modules_show_unwind_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFunctionName, "Show unwind instructions for a function or symbol name." },
+ { LLDB_OPT_SET_2, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Show unwind instructions for a function or symbol containing an address" }
+ // clang-format on
+};
+
class CommandObjectTargetModulesShowUnwind : public CommandObjectParsed {
public:
enum {
@@ -3200,11 +3201,9 @@ public:
m_addr = LLDB_INVALID_ADDRESS;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_target_modules_show_unwind_options;
+ }
// Instance variables to hold the values for command options.
@@ -3424,18 +3423,28 @@ protected:
CommandOptions m_options;
};
-OptionDefinition
- CommandObjectTargetModulesShowUnwind::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFunctionName, "Show unwind instructions for a function or symbol name."},
- {LLDB_OPT_SET_2, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Show unwind instructions for a function or symbol containing an address"},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//----------------------------------------------------------------------
// Lookup information in images
//----------------------------------------------------------------------
+
+static OptionDefinition g_target_modules_lookup_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, true, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Lookup an address in one or more target modules." },
+ { LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOffset, "When looking up an address subtract <offset> from any addresses before doing the lookup." },
+ /* FIXME: re-enable regex for types when the LookupTypeInModule actually uses the regex option: | LLDB_OPT_SET_6 */
+ { LLDB_OPT_SET_2 | LLDB_OPT_SET_4 | LLDB_OPT_SET_5, false, "regex", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "The <name> argument for name lookups are regular expressions." },
+ { LLDB_OPT_SET_2, true, "symbol", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeSymbol, "Lookup a symbol by name in the symbol tables in one or more target modules." },
+ { LLDB_OPT_SET_3, true, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFilename, "Lookup a file by fullpath or basename in one or more target modules." },
+ { LLDB_OPT_SET_3, false, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Lookup a line number in a file (must be used in conjunction with --file)." },
+ { LLDB_OPT_SET_FROM_TO(3,5), false, "no-inlines", 'i', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Ignore inline entries (must be used in conjunction with --file or --function)." },
+ { LLDB_OPT_SET_4, true, "function", 'F', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFunctionName, "Lookup a function by name in the debug symbols in one or more target modules." },
+ { LLDB_OPT_SET_5, true, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFunctionOrSymbol, "Lookup a function or symbol by name in one or more target modules." },
+ { LLDB_OPT_SET_6, true, "type", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Lookup a type by name in the debug symbols in one or more target modules." },
+ { LLDB_OPT_SET_ALL, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable verbose lookup information." },
+ { LLDB_OPT_SET_ALL, false, "all", 'A', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Print all matches, not just the best match, if a best match is available." },
+ // clang-format on
+};
+
class CommandObjectTargetModulesLookup : public CommandObjectParsed {
public:
enum {
@@ -3543,11 +3552,10 @@ public:
m_print_all = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_target_modules_lookup_options;
+ }
- static OptionDefinition g_option_table[];
int m_type; // Should be a eLookupTypeXXX enum after parsing options
std::string m_str; // Holds name lookup
FileSpec m_file; // Files for file lookups
@@ -3802,27 +3810,6 @@ protected:
CommandOptions m_options;
};
-OptionDefinition
- CommandObjectTargetModulesLookup::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_1, true, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Lookup an address in one or more target modules."},
- {LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOffset, "When looking up an address subtract <offset> from any addresses before doing the lookup."},
- /* FIXME: re-enable regex for types when the LookupTypeInModule actually uses the regex option: | LLDB_OPT_SET_6 */
- {LLDB_OPT_SET_2| LLDB_OPT_SET_4 | LLDB_OPT_SET_5, false, "regex", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "The <name> argument for name lookups are regular expressions."},
- {LLDB_OPT_SET_2, true, "symbol", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeSymbol, "Lookup a symbol by name in the symbol tables in one or more target modules."},
- {LLDB_OPT_SET_3, true, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFilename, "Lookup a file by fullpath or basename in one or more target modules."},
- {LLDB_OPT_SET_3, false, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Lookup a line number in a file (must be used in conjunction with --file)."},
- {LLDB_OPT_SET_FROM_TO(3,5), false, "no-inlines", 'i', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Ignore inline entries (must be used in conjunction with --file or --function)."},
- {LLDB_OPT_SET_4, true, "function", 'F', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFunctionName, "Lookup a function by name in the debug symbols in one or more target modules."},
- {LLDB_OPT_SET_5, true, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFunctionOrSymbol, "Lookup a function or symbol by name in one or more target modules."},
- {LLDB_OPT_SET_6, true, "type", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Lookup a type by name in the debug symbols in one or more target modules."},
- {LLDB_OPT_SET_ALL, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable verbose lookup information."},
- {LLDB_OPT_SET_ALL, false, "all", 'A', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Print all matches, not just the best match, if a best match is available."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
#pragma mark CommandObjectMultiwordImageSearchPaths
//-------------------------------------------------------------------------
@@ -4326,6 +4313,22 @@ private:
// CommandObjectTargetStopHookAdd
//-------------------------------------------------------------------------
+static OptionDefinition g_target_stop_hook_add_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "one-liner", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOneLiner, "Specify a one-line breakpoint command inline. Be sure to surround it with quotes." },
+ { LLDB_OPT_SET_ALL, false, "shlib", 's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Set the module within which the stop-hook is to be run." },
+ { LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadIndex, "The stop hook is run only for the thread whose index matches this argument." },
+ { LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadID, "The stop hook is run only for the thread whose TID matches this argument." },
+ { LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadName, "The stop hook is run only for the thread whose thread name matches this argument." },
+ { LLDB_OPT_SET_ALL, false, "queue-name", 'q', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeQueueName, "The stop hook is run only for threads in the queue whose name is given by this argument." },
+ { LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "Specify the source file within which the stop-hook is to be run." },
+ { LLDB_OPT_SET_1, false, "start-line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Set the start of the line range for which the stop-hook is to be run." },
+ { LLDB_OPT_SET_1, false, "end-line", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Set the end of the line range for which the stop-hook is to be run." },
+ { LLDB_OPT_SET_2, false, "classname", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeClassName, "Specify the class within which the stop-hook is to be run." },
+ { LLDB_OPT_SET_3, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "Set the function name within which the stop hook will be run." },
+ // clang-format on
+};
+
class CommandObjectTargetStopHookAdd : public CommandObjectParsed,
public IOHandlerDelegateMultiline {
public:
@@ -4339,7 +4342,9 @@ public:
~CommandOptions() override = default;
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_target_stop_hook_add_options;
+ }
Error SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override {
@@ -4453,8 +4458,6 @@ public:
m_one_liner.clear();
}
- static OptionDefinition g_option_table[];
-
std::string m_class_name;
std::string m_function_name;
uint32_t m_line_start;
@@ -4625,24 +4628,6 @@ private:
Target::StopHookSP m_stop_hook_sp;
};
-OptionDefinition
- CommandObjectTargetStopHookAdd::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "one-liner", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOneLiner, "Specify a one-line breakpoint command inline. Be sure to surround it with quotes."},
- {LLDB_OPT_SET_ALL, false, "shlib", 's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Set the module within which the stop-hook is to be run."},
- {LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadIndex, "The stop hook is run only for the thread whose index matches this argument."},
- {LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadID, "The stop hook is run only for the thread whose TID matches this argument."},
- {LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadName, "The stop hook is run only for the thread whose thread name matches this argument."},
- {LLDB_OPT_SET_ALL, false, "queue-name", 'q', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeQueueName, "The stop hook is run only for threads in the queue whose name is given by this argument."},
- {LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "Specify the source file within which the stop-hook is to be run."},
- {LLDB_OPT_SET_1, false, "start-line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Set the start of the line range for which the stop-hook is to be run."},
- {LLDB_OPT_SET_1, false, "end-line", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Set the end of the line range for which the stop-hook is to be run."},
- {LLDB_OPT_SET_2, false, "classname", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeClassName, "Specify the class within which the stop-hook is to be run."},
- {LLDB_OPT_SET_3, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "Set the function name within which the stop hook will be run."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
- // clang-format on
-};
-
#pragma mark CommandObjectTargetStopHookDelete
//-------------------------------------------------------------------------
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 6cefa6ee003..fdcd4b1bc46 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -141,6 +141,14 @@ protected:
// CommandObjectThreadBacktrace
//-------------------------------------------------------------------------
+static OptionDefinition g_thread_backtrace_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "How many frames to display (-1 for all)" },
+ { LLDB_OPT_SET_1, false, "start", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFrameIndex, "Frame in which to start the backtrace" },
+ { LLDB_OPT_SET_1, false, "extended", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Show the extended backtrace, if available" }
+ // clang-format on
+};
+
class CommandObjectThreadBacktrace : public CommandObjectIterateOverThreads {
public:
class CommandOptions : public Options {
@@ -201,11 +209,9 @@ public:
m_extended_backtrace = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_thread_backtrace_options;
+ }
// Instance variables to hold the values for command options.
uint32_t m_count;
@@ -288,18 +294,33 @@ protected:
CommandOptions m_options;
};
-OptionDefinition
- CommandObjectThreadBacktrace::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "How many frames to display (-1 for all)"},
- {LLDB_OPT_SET_1, false, "start", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFrameIndex, "Frame in which to start the backtrace"},
- {LLDB_OPT_SET_1, false, "extended", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Show the extended backtrace, if available"},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
enum StepScope { eStepScopeSource, eStepScopeInstruction };
+static OptionEnumValueElement g_tri_running_mode[] = {
+ {eOnlyThisThread, "this-thread", "Run only this thread"},
+ {eAllThreads, "all-threads", "Run all threads"},
+ {eOnlyDuringStepping, "while-stepping",
+ "Run only this thread while stepping"},
+ {0, nullptr, nullptr}};
+
+static OptionEnumValueElement g_duo_running_mode[] = {
+ {eOnlyThisThread, "this-thread", "Run only this thread"},
+ {eAllThreads, "all-threads", "Run all threads"},
+ {0, nullptr, nullptr}};
+
+static OptionDefinition g_thread_step_scope_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "step-in-avoids-no-debug", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "A boolean value that sets whether stepping into functions will step over functions with no debug information." },
+ { LLDB_OPT_SET_1, false, "step-out-avoids-no-debug", 'A', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "A boolean value, if true stepping out of functions will continue to step out till it hits a function with debug information." },
+ { LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 1, eArgTypeCount, "How many times to perform the stepping operation - currently only supported for step-inst and next-inst." },
+ { LLDB_OPT_SET_1, false, "end-linenumber", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 1, eArgTypeLineNum, "The line at which to stop stepping - defaults to the next line and only supported for step-in and step-over. You can also pass the string 'block' to step to the end of the current block. This is particularly useful in conjunction with --step-target to step through a complex calling sequence." },
+ { LLDB_OPT_SET_1, false, "run-mode", 'm', OptionParser::eRequiredArgument, nullptr, g_tri_running_mode, 0, eArgTypeRunMode, "Determine how to run other threads while stepping the current thread." },
+ { LLDB_OPT_SET_1, false, "step-over-regexp", 'r', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeRegularExpression, "A regular expression that defines function names to not to stop at when stepping in." },
+ { LLDB_OPT_SET_1, false, "step-in-target", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFunctionName, "The name of the directly called function step in should stop at when stepping into." },
+ { LLDB_OPT_SET_2, false, "python-class", 'C', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonClass, "The name of the class that will manage this step - only supported for Scripted Step." }
+ // clang-format on
+};
+
class CommandObjectThreadStepWithTypeAndScope : public CommandObjectParsed {
public:
class CommandOptions : public Options {
@@ -358,7 +379,7 @@ public:
case 'm': {
OptionEnumValueElement *enum_values =
- g_option_table[option_idx].enum_values;
+ GetDefinitions()[option_idx].enum_values;
m_run_mode = (lldb::RunMode)Args::StringToOptionEnum(
option_arg, enum_values, eOnlyDuringStepping, error);
} break;
@@ -415,11 +436,9 @@ public:
m_end_line_is_block_end = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_thread_step_scope_options;
+ }
// Instance variables to hold the values for command options.
LazyBool m_step_in_avoid_no_debug;
@@ -690,33 +709,6 @@ protected:
CommandOptions m_options;
};
-static OptionEnumValueElement g_tri_running_mode[] = {
- {eOnlyThisThread, "this-thread", "Run only this thread"},
- {eAllThreads, "all-threads", "Run all threads"},
- {eOnlyDuringStepping, "while-stepping",
- "Run only this thread while stepping"},
- {0, nullptr, nullptr}};
-
-static OptionEnumValueElement g_duo_running_mode[] = {
- {eOnlyThisThread, "this-thread", "Run only this thread"},
- {eAllThreads, "all-threads", "Run all threads"},
- {0, nullptr, nullptr}};
-
-OptionDefinition CommandObjectThreadStepWithTypeAndScope::CommandOptions::
- g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "step-in-avoids-no-debug", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "A boolean value that sets whether stepping into functions will step over functions with no debug information."},
- {LLDB_OPT_SET_1, false, "step-out-avoids-no-debug", 'A', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "A boolean value, if true stepping out of functions will continue to step out till it hits a function with debug information."},
- {LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 1, eArgTypeCount, "How many times to perform the stepping operation - currently only supported for step-inst and next-inst."},
- {LLDB_OPT_SET_1, false, "end-linenumber", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 1, eArgTypeLineNum, "The line at which to stop stepping - defaults to the next line and only supported for step-in and step-over. You can also pass the string 'block' to step to the end of the current block. This is particularly useful in conjunction with --step-target to step through a complex calling sequence."},
- {LLDB_OPT_SET_1, false, "run-mode", 'm', OptionParser::eRequiredArgument, nullptr, g_tri_running_mode, 0, eArgTypeRunMode, "Determine how to run other threads while stepping the current thread."},
- {LLDB_OPT_SET_1, false, "step-over-regexp", 'r', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeRegularExpression, "A regular expression that defines function names to not to stop at when stepping in."},
- {LLDB_OPT_SET_1, false, "step-in-target", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFunctionName, "The name of the directly called function step in should stop at when stepping into."},
- {LLDB_OPT_SET_2, false, "python-class", 'C', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonClass, "The name of the class that will manage this step - only supported for Scripted Step."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectThreadContinue
//-------------------------------------------------------------------------
@@ -907,6 +899,15 @@ public:
// CommandObjectThreadUntil
//-------------------------------------------------------------------------
+static OptionDefinition g_thread_until_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "frame", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFrameIndex, "Frame index for until operation - defaults to 0" },
+ { LLDB_OPT_SET_1, false, "thread", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadIndex, "Thread index for the thread for until operation" },
+ { LLDB_OPT_SET_1, false, "run-mode",'m', OptionParser::eRequiredArgument, nullptr, g_duo_running_mode, 0, eArgTypeRunMode, "Determine how to run other threads while stepping this one" },
+ { LLDB_OPT_SET_1, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Run until we reach the specified address, or leave the function - can be specified multiple times." }
+ // clang-format on
+};
+
class CommandObjectThreadUntil : public CommandObjectParsed {
public:
class CommandOptions : public Options {
@@ -954,7 +955,7 @@ public:
break;
case 'm': {
OptionEnumValueElement *enum_values =
- g_option_table[option_idx].enum_values;
+ GetDefinitions()[option_idx].enum_values;
lldb::RunMode run_mode = (lldb::RunMode)Args::StringToOptionEnum(
option_arg, enum_values, eOnlyDuringStepping, error);
@@ -980,16 +981,14 @@ public:
m_until_addrs.clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_thread_until_options;
+ }
uint32_t m_step_thread_idx;
bool m_stop_others;
std::vector<lldb::addr_t> m_until_addrs;
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
-
// Instance variables to hold the values for command options.
};
@@ -1224,16 +1223,6 @@ protected:
CommandOptions m_options;
};
-OptionDefinition CommandObjectThreadUntil::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "frame", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFrameIndex, "Frame index for until operation - defaults to 0"},
- {LLDB_OPT_SET_1, false, "thread", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadIndex, "Thread index for the thread for until operation"},
- {LLDB_OPT_SET_1, false, "run-mode",'m', OptionParser::eRequiredArgument, nullptr, g_duo_running_mode, 0, eArgTypeRunMode, "Determine how to run other threads while stepping this one"},
- {LLDB_OPT_SET_1, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Run until we reach the specified address, or leave the function - can be specified multiple times."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectThreadSelect
//-------------------------------------------------------------------------
@@ -1333,6 +1322,13 @@ protected:
// CommandObjectThreadInfo
//-------------------------------------------------------------------------
+static OptionDefinition g_thread_info_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "json", 'j', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display the thread info in JSON format." },
+ { LLDB_OPT_SET_ALL, false, "stop-info", 's', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display the extended stop info in JSON format." }
+ // clang-format on
+};
+
class CommandObjectThreadInfo : public CommandObjectIterateOverThreads {
public:
class CommandOptions : public Options {
@@ -1366,12 +1362,12 @@ public:
return error;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_thread_info_options;
+ }
bool m_json_thread;
bool m_json_stopinfo;
-
- static OptionDefinition g_option_table[];
};
CommandObjectThreadInfo(CommandInterpreter &interpreter)
@@ -1417,18 +1413,16 @@ public:
CommandOptions m_options;
};
-OptionDefinition CommandObjectThreadInfo::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "json", 'j', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display the thread info in JSON format."},
- {LLDB_OPT_SET_ALL, false, "stop-info", 's', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display the extended stop info in JSON format."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectThreadReturn
//-------------------------------------------------------------------------
+static OptionDefinition g_thread_return_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "from-expression", 'x', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Return from the innermost expression evaluation." }
+ // clang-format on
+};
+
class CommandObjectThreadReturn : public CommandObjectRaw {
public:
class CommandOptions : public Options {
@@ -1470,14 +1464,12 @@ public:
m_from_expression = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_thread_return_options;
+ }
bool m_from_expression;
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
-
// Instance variables to hold the values for command options.
};
@@ -1597,17 +1589,20 @@ protected:
CommandOptions m_options;
};
-OptionDefinition CommandObjectThreadReturn::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "from-expression", 'x', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Return from the innermost expression evaluation."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectThreadJump
//-------------------------------------------------------------------------
+static OptionDefinition g_thread_jump_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "Specifies the source file to jump to." },
+ { LLDB_OPT_SET_1, true, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Specifies the line number to jump to." },
+ { LLDB_OPT_SET_2, true, "by", 'b', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOffset, "Jumps by a relative line offset from the current line." },
+ { LLDB_OPT_SET_3, true, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Jumps to a specific address." },
+ { LLDB_OPT_SET_1 | LLDB_OPT_SET_2 | LLDB_OPT_SET_3, false, "force", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Allows the PC to leave the current function." }
+ // clang-format on
+};
+
class CommandObjectThreadJump : public CommandObjectParsed {
public:
class CommandOptions : public Options {
@@ -1659,15 +1654,15 @@ public:
return error;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_thread_jump_options;
+ }
FileSpecList m_filenames;
uint32_t m_line_num;
int32_t m_line_offset;
lldb::addr_t m_load_addr;
bool m_force;
-
- static OptionDefinition g_option_table[];
};
CommandObjectThreadJump(CommandInterpreter &interpreter)
@@ -1745,17 +1740,6 @@ protected:
CommandOptions m_options;
};
-OptionDefinition CommandObjectThreadJump::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "Specifies the source file to jump to."},
- {LLDB_OPT_SET_1, true, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Specifies the line number to jump to."},
- {LLDB_OPT_SET_2, true, "by", 'b', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOffset, "Jumps by a relative line offset from the current line."},
- {LLDB_OPT_SET_3, true, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Jumps to a specific address."},
- {LLDB_OPT_SET_1 | LLDB_OPT_SET_2 | LLDB_OPT_SET_3, false, "force", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Allows the PC to leave the current function."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// Next are the subcommands of CommandObjectMultiwordThreadPlan
//-------------------------------------------------------------------------
@@ -1764,6 +1748,13 @@ OptionDefinition CommandObjectThreadJump::CommandOptions::g_option_table[] = {
// CommandObjectThreadPlanList
//-------------------------------------------------------------------------
+static OptionDefinition g_thread_plan_list_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display more information about the thread plans" },
+ { LLDB_OPT_SET_1, false, "internal", 'i', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display internal as well as user thread plans" }
+ // clang-format on
+};
+
class CommandObjectThreadPlanList : public CommandObjectIterateOverThreads {
public:
class CommandOptions : public Options {
@@ -1801,11 +1792,9 @@ public:
m_internal = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_thread_plan_list_options;
+ }
// Instance variables to hold the values for command options.
bool m_verbose;
@@ -1853,15 +1842,6 @@ protected:
CommandOptions m_options;
};
-OptionDefinition CommandObjectThreadPlanList::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_1, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display more information about the thread plans"},
- {LLDB_OPT_SET_1, false, "internal", 'i', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display internal as well as user thread plans"},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
class CommandObjectThreadPlanDiscard : public CommandObjectParsed {
public:
CommandObjectThreadPlanDiscard(CommandInterpreter &interpreter)
diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp
index 0fbebb9a990..9df1da60e42 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -97,6 +97,26 @@ static bool WarnOnPotentialUnquotedUnsignedType(Args &command,
return false;
}
+static OptionDefinition g_type_summary_add_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "category", 'w', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Add this to the given category instead of the default one." },
+ { LLDB_OPT_SET_ALL, false, "cascade", 'C', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, cascade through typedef chains." },
+ { LLDB_OPT_SET_ALL, false, "no-value", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't show the value, just show the summary, for this type." },
+ { LLDB_OPT_SET_ALL, false, "skip-pointers", 'p', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for pointers-to-type objects." },
+ { LLDB_OPT_SET_ALL, false, "skip-references", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for references-to-type objects." },
+ { LLDB_OPT_SET_ALL, false, "regex", 'x', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Type names are actually regular expressions." },
+ { LLDB_OPT_SET_1, true, "inline-children", 'c', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "If true, inline all child values into summary string." },
+ { LLDB_OPT_SET_1, false, "omit-names", 'O', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "If true, omit value names in the summary display." },
+ { LLDB_OPT_SET_2, true, "summary-string", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeSummaryString, "Summary string used to display text and object contents." },
+ { LLDB_OPT_SET_3, false, "python-script", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonScript, "Give a one-liner Python script as part of the command." },
+ { LLDB_OPT_SET_3, false, "python-function", 'F', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonFunction, "Give the name of a Python function to use for this type." },
+ { LLDB_OPT_SET_3, false, "input-python", 'P', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Input Python code to use for this type manually." },
+ { LLDB_OPT_SET_2 | LLDB_OPT_SET_3, false, "expand", 'e', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Expand aggregate data types to show children on separate lines." },
+ { LLDB_OPT_SET_2 | LLDB_OPT_SET_3, false, "hide-empty", 'h', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Do not expand aggregate data types with no children." },
+ { LLDB_OPT_SET_2 | LLDB_OPT_SET_3, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "A name for this summary string." }
+ // clang-format on
+};
+
class CommandObjectTypeSummaryAdd : public CommandObjectParsed,
public IOHandlerDelegateMultiline {
private:
@@ -111,11 +131,9 @@ private:
void OptionParsingStarting(ExecutionContext *execution_context) override;
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_type_summary_add_options;
+ }
// Instance variables to hold the values for command options.
@@ -281,6 +299,18 @@ static const char *g_synth_addreader_instructions =
" '''Optional'''\n"
"class synthProvider:\n";
+static OptionDefinition g_type_synth_add_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "cascade", 'C', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, cascade through typedef chains." },
+ { LLDB_OPT_SET_ALL, false, "skip-pointers", 'p', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for pointers-to-type objects." },
+ { LLDB_OPT_SET_ALL, false, "skip-references", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for references-to-type objects." },
+ { LLDB_OPT_SET_ALL, false, "category", 'w', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Add this to the given category instead of the default one." },
+ { LLDB_OPT_SET_2, false, "python-class", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonClass, "Use this Python class to produce synthetic children." },
+ { LLDB_OPT_SET_3, false, "input-python", 'P', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Type Python code to generate a class that provides synthetic children." },
+ { LLDB_OPT_SET_ALL, false, "regex", 'x', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Type names are actually regular expressions." }
+ // clang-format on
+};
+
class CommandObjectTypeSynthAdd : public CommandObjectParsed,
public IOHandlerDelegateMultiline {
private:
@@ -343,11 +373,9 @@ private:
m_regex = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_type_synth_add_options;
+ }
// Instance variables to hold the values for command options.
@@ -502,6 +530,17 @@ public:
// CommandObjectTypeFormatAdd
//-------------------------------------------------------------------------
+static OptionDefinition g_type_format_add_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "category", 'w', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Add this to the given category instead of the default one." },
+ { LLDB_OPT_SET_ALL, false, "cascade", 'C', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, cascade through typedef chains." },
+ { LLDB_OPT_SET_ALL, false, "skip-pointers", 'p', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for pointers-to-type objects." },
+ { LLDB_OPT_SET_ALL, false, "skip-references", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for references-to-type objects." },
+ { LLDB_OPT_SET_ALL, false, "regex", 'x', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Type names are actually regular expressions." },
+ { LLDB_OPT_SET_2, false, "type", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Format variables as if they were of this type." }
+ // clang-format on
+};
+
class CommandObjectTypeFormatAdd : public CommandObjectParsed {
private:
class CommandOptions : public OptionGroup {
@@ -510,9 +549,9 @@ private:
~CommandOptions() override = default;
- uint32_t GetNumDefinitions() override;
-
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_type_format_add_options;
+ }
void OptionParsingStarting(ExecutionContext *execution_context) override {
m_cascade = true;
@@ -526,7 +565,8 @@ private:
Error SetOptionValue(uint32_t option_idx, const char *option_value,
ExecutionContext *execution_context) override {
Error error;
- const int short_option = g_option_table[option_idx].short_option;
+ const int short_option =
+ g_type_format_add_options[option_idx].short_option;
bool success;
switch (short_option) {
@@ -561,10 +601,6 @@ private:
return error;
}
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
-
// Instance variables to hold the values for command options.
bool m_cascade;
@@ -719,23 +755,14 @@ protected:
}
};
-OptionDefinition CommandObjectTypeFormatAdd::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "category", 'w', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Add this to the given category instead of the default one."},
- {LLDB_OPT_SET_ALL, false, "cascade", 'C', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, cascade through typedef chains."},
- {LLDB_OPT_SET_ALL, false, "skip-pointers", 'p', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for pointers-to-type objects."},
- {LLDB_OPT_SET_ALL, false, "skip-references", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for references-to-type objects."},
- {LLDB_OPT_SET_ALL, false, "regex", 'x', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Type names are actually regular expressions."},
- {LLDB_OPT_SET_2, false, "type", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Format variables as if they were of this type."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
+static OptionDefinition g_type_formatter_delete_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "all", 'a', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Delete from every category." },
+ { LLDB_OPT_SET_2, false, "category", 'w', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Delete from given category." },
+ { LLDB_OPT_SET_3, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Delete from given language's category." }
+ // clang-format on
};
-uint32_t CommandObjectTypeFormatAdd::CommandOptions::GetNumDefinitions() {
- return sizeof(g_option_table) / sizeof(OptionDefinition);
-}
-
class CommandObjectTypeFormatterDelete : public CommandObjectParsed {
protected:
class CommandOptions : public Options {
@@ -774,11 +801,9 @@ protected:
m_language = lldb::eLanguageTypeUnknown;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_type_formatter_delete_options;
+ }
// Instance variables to hold the values for command options.
@@ -872,14 +897,10 @@ protected:
}
};
-OptionDefinition
- CommandObjectTypeFormatterDelete::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "all", 'a', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Delete from every category."},
- {LLDB_OPT_SET_2, false, "category", 'w', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Delete from given category."},
- {LLDB_OPT_SET_3, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Delete from given language's category."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
+static OptionDefinition g_type_formatter_clear_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "all", 'a', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Clear every category." }
+ // clang-format on
};
class CommandObjectTypeFormatterClear : public CommandObjectParsed {
@@ -912,11 +933,9 @@ private:
m_delete_all = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_type_formatter_clear_options;
+ }
// Instance variables to hold the values for command options.
bool m_delete_all;
@@ -966,14 +985,6 @@ protected:
}
};
-OptionDefinition
- CommandObjectTypeFormatterClear::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "all", 'a', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Clear every category."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectTypeFormatDelete
//-------------------------------------------------------------------------
@@ -1045,22 +1056,16 @@ class CommandObjectTypeFormatterList : public CommandObjectParsed {
m_category_language.Clear();
}
- const OptionDefinition *GetDefinitions() override {
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
static OptionDefinition g_option_table[] = {
// clang-format off
- {LLDB_OPT_SET_1, false, "category-regex", 'w', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Only show categories matching this filter."},
- {LLDB_OPT_SET_2, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Only show the category for a specific language."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
+ {LLDB_OPT_SET_1, false, "category-regex", 'w', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Only show categories matching this filter."},
+ {LLDB_OPT_SET_2, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Only show the category for a specific language."}
// clang-format on
};
-
- return g_option_table;
+ return llvm::ArrayRef<OptionDefinition>(g_option_table);
}
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
-
// Instance variables to hold the values for command options.
OptionValueString m_category_regex;
@@ -1717,28 +1722,6 @@ bool CommandObjectTypeSummaryAdd::AddSummary(ConstString type_name,
}
}
-OptionDefinition CommandObjectTypeSummaryAdd::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "category", 'w', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Add this to the given category instead of the default one."},
- {LLDB_OPT_SET_ALL, false, "cascade", 'C', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, cascade through typedef chains."},
- {LLDB_OPT_SET_ALL, false, "no-value", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't show the value, just show the summary, for this type."},
- {LLDB_OPT_SET_ALL, false, "skip-pointers", 'p', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for pointers-to-type objects."},
- {LLDB_OPT_SET_ALL, false, "skip-references", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for references-to-type objects."},
- {LLDB_OPT_SET_ALL, false, "regex", 'x', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Type names are actually regular expressions."},
- {LLDB_OPT_SET_1, true, "inline-children", 'c', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "If true, inline all child values into summary string."},
- {LLDB_OPT_SET_1, false, "omit-names", 'O', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "If true, omit value names in the summary display."},
- {LLDB_OPT_SET_2, true, "summary-string", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeSummaryString, "Summary string used to display text and object contents."},
- {LLDB_OPT_SET_3, false, "python-script", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonScript, "Give a one-liner Python script as part of the command."},
- {LLDB_OPT_SET_3, false, "python-function", 'F', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonFunction, "Give the name of a Python function to use for this type."},
- {LLDB_OPT_SET_3, false, "input-python", 'P', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Input Python code to use for this type manually."},
- {LLDB_OPT_SET_2 | LLDB_OPT_SET_3, false, "expand", 'e', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Expand aggregate data types to show children on separate lines."},
- {LLDB_OPT_SET_2 | LLDB_OPT_SET_3, false, "hide-empty", 'h', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Do not expand aggregate data types with no children."},
- {LLDB_OPT_SET_2 | LLDB_OPT_SET_3, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "A name for this summary string."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectTypeSummaryDelete
//-------------------------------------------------------------------------
@@ -1808,6 +1791,13 @@ protected:
// CommandObjectTypeCategoryDefine
//-------------------------------------------------------------------------
+static OptionDefinition g_type_category_define_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "enabled", 'e', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "If specified, this category will be created enabled." },
+ { LLDB_OPT_SET_ALL, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Specify the language that this category is supported for." }
+ // clang-format on
+};
+
class CommandObjectTypeCategoryDefine : public CommandObjectParsed {
class CommandOptions : public Options {
public:
@@ -1843,11 +1833,9 @@ class CommandObjectTypeCategoryDefine : public CommandObjectParsed {
m_cate_language.Clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_type_category_define_options;
+ }
// Instance variables to hold the values for command options.
@@ -1907,19 +1895,16 @@ protected:
}
};
-OptionDefinition
- CommandObjectTypeCategoryDefine::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "enabled", 'e', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "If specified, this category will be created enabled."},
- {LLDB_OPT_SET_ALL, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Specify the language that this category is supported for."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectTypeCategoryEnable
//-------------------------------------------------------------------------
+static OptionDefinition g_type_category_enable_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Enable the category for this language." },
+ // clang-format on
+};
+
class CommandObjectTypeCategoryEnable : public CommandObjectParsed {
class CommandOptions : public Options {
public:
@@ -1954,11 +1939,9 @@ class CommandObjectTypeCategoryEnable : public CommandObjectParsed {
m_language = lldb::eLanguageTypeUnknown;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_type_category_enable_options;
+ }
// Instance variables to hold the values for command options.
@@ -2029,14 +2012,6 @@ protected:
}
};
-OptionDefinition
- CommandObjectTypeCategoryEnable::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Enable the category for this language."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectTypeCategoryDelete
//-------------------------------------------------------------------------
@@ -2101,6 +2076,12 @@ protected:
// CommandObjectTypeCategoryDisable
//-------------------------------------------------------------------------
+OptionDefinition g_type_category_disable_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Enable the category for this language." }
+ // clang-format on
+};
+
class CommandObjectTypeCategoryDisable : public CommandObjectParsed {
class CommandOptions : public Options {
public:
@@ -2135,11 +2116,9 @@ class CommandObjectTypeCategoryDisable : public CommandObjectParsed {
m_language = lldb::eLanguageTypeUnknown;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_type_category_disable_options;
+ }
// Instance variables to hold the values for command options.
@@ -2205,14 +2184,6 @@ protected:
}
};
-OptionDefinition
- CommandObjectTypeCategoryDisable::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Enable the category for this language."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectTypeCategoryList
//-------------------------------------------------------------------------
@@ -2531,21 +2502,19 @@ bool CommandObjectTypeSynthAdd::AddSynth(ConstString type_name,
}
}
-OptionDefinition CommandObjectTypeSynthAdd::CommandOptions::g_option_table[] = {
+#endif // LLDB_DISABLE_PYTHON
+
+static OptionDefinition g_type_filter_add_options[] = {
// clang-format off
- {LLDB_OPT_SET_ALL, false, "cascade", 'C', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, cascade through typedef chains."},
- {LLDB_OPT_SET_ALL, false, "skip-pointers", 'p', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for pointers-to-type objects."},
- {LLDB_OPT_SET_ALL, false, "skip-references", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for references-to-type objects."},
- {LLDB_OPT_SET_ALL, false, "category", 'w', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Add this to the given category instead of the default one."},
- {LLDB_OPT_SET_2, false, "python-class", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonClass, "Use this Python class to produce synthetic children."},
- {LLDB_OPT_SET_3, false, "input-python", 'P', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Type Python code to generate a class that provides synthetic children."},
- {LLDB_OPT_SET_ALL, false, "regex", 'x', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Type names are actually regular expressions."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
+ { LLDB_OPT_SET_ALL, false, "cascade", 'C', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, cascade through typedef chains." },
+ { LLDB_OPT_SET_ALL, false, "skip-pointers", 'p', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for pointers-to-type objects." },
+ { LLDB_OPT_SET_ALL, false, "skip-references", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for references-to-type objects." },
+ { LLDB_OPT_SET_ALL, false, "category", 'w', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Add this to the given category instead of the default one." },
+ { LLDB_OPT_SET_ALL, false, "child", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeExpressionPath, "Include this expression path in the synthetic view." },
+ { LLDB_OPT_SET_ALL, false, "regex", 'x', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Type names are actually regular expressions." }
// clang-format on
};
-#endif // LLDB_DISABLE_PYTHON
-
class CommandObjectTypeFilterAdd : public CommandObjectParsed {
private:
class CommandOptions : public Options {
@@ -2605,11 +2574,9 @@ private:
m_regex = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_type_filter_add_options;
+ }
// Instance variables to hold the values for command options.
@@ -2791,22 +2758,16 @@ protected:
}
};
-OptionDefinition CommandObjectTypeFilterAdd::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "cascade", 'C', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, cascade through typedef chains."},
- {LLDB_OPT_SET_ALL, false, "skip-pointers", 'p', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for pointers-to-type objects."},
- {LLDB_OPT_SET_ALL, false, "skip-references", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Don't use this format for references-to-type objects."},
- {LLDB_OPT_SET_ALL, false, "category", 'w', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Add this to the given category instead of the default one."},
- {LLDB_OPT_SET_ALL, false, "child", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeExpressionPath, "Include this expression path in the synthetic view."},
- {LLDB_OPT_SET_ALL, false, "regex", 'x', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Type names are actually regular expressions."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//----------------------------------------------------------------------
// "type lookup"
//----------------------------------------------------------------------
+static OptionDefinition g_type_lookup_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "show-help", 'h', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display available help for types" },
+ { LLDB_OPT_SET_ALL, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Which language's types should the search scope be" }
+ // clang-format on
+};
+
class CommandObjectTypeLookup : public CommandObjectRaw {
protected:
// this function is allowed to do a more aggressive job at guessing languages
@@ -2837,15 +2798,15 @@ protected:
~CommandOptions() override = default;
- uint32_t GetNumDefinitions() override { return 3; }
-
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_type_lookup_options;
+ }
Error SetOptionValue(uint32_t option_idx, const char *option_value,
ExecutionContext *execution_context) override {
Error error;
- const int short_option = g_option_table[option_idx].short_option;
+ const int short_option = g_type_lookup_options[option_idx].short_option;
switch (short_option) {
case 'h':
@@ -2872,7 +2833,6 @@ protected:
// Options table: Required for subclasses of Options.
- static OptionDefinition g_option_table[];
bool m_show_help;
lldb::LanguageType m_language;
};
@@ -3052,14 +3012,6 @@ public:
}
};
-OptionDefinition CommandObjectTypeLookup::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "show-help", 'h', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Display available help for types"},
- {LLDB_OPT_SET_ALL, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Which language's types should the search scope be"},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
- // clang-format on
-};
-
template <typename FormatterType>
class CommandObjectFormatterInfo : public CommandObjectRaw {
public:
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index 7ff4cce7457..83eb1dd9b7f 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -152,6 +152,20 @@ bool CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(
//-------------------------------------------------------------------------
// CommandObjectWatchpointList
//-------------------------------------------------------------------------
+
+//-------------------------------------------------------------------------
+// CommandObjectWatchpointList::Options
+//-------------------------------------------------------------------------
+#pragma mark List::CommandOptions
+
+static OptionDefinition g_watchpoint_list_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "brief", 'b', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Give a brief description of the watchpoint (no location info)." },
+ { LLDB_OPT_SET_2, false, "full", 'f', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Give a full description of the watchpoint and its locations." },
+ { LLDB_OPT_SET_3, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Explain everything we know about the watchpoint (for debugging debugger bugs)." }
+ // clang-format on
+};
+
#pragma mark List
class CommandObjectWatchpointList : public CommandObjectParsed {
@@ -211,11 +225,9 @@ public:
m_level = lldb::eDescriptionLevelFull;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_watchpoint_list_options;
+ }
// Instance variables to hold the values for command options.
@@ -291,21 +303,6 @@ private:
};
//-------------------------------------------------------------------------
-// CommandObjectWatchpointList::Options
-//-------------------------------------------------------------------------
-#pragma mark List::CommandOptions
-
-OptionDefinition CommandObjectWatchpointList::CommandOptions::g_option_table[] =
- {
- // clang-format off
- {LLDB_OPT_SET_1, false, "brief", 'b', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Give a brief description of the watchpoint (no location info)."},
- {LLDB_OPT_SET_2, false, "full", 'f', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Give a full description of the watchpoint and its locations."},
- {LLDB_OPT_SET_3, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Explain everything we know about the watchpoint (for debugging debugger bugs)."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
-//-------------------------------------------------------------------------
// CommandObjectWatchpointEnable
//-------------------------------------------------------------------------
#pragma mark Enable
@@ -531,6 +528,13 @@ protected:
// CommandObjectWatchpointIgnore
//-------------------------------------------------------------------------
+#pragma mark Ignore::CommandOptions
+static OptionDefinition g_watchpoint_ignore_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, true, "ignore-count", 'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "Set the number of times this watchpoint is skipped before stopping." }
+ // clang-format on
+};
+
class CommandObjectWatchpointIgnore : public CommandObjectParsed {
public:
CommandObjectWatchpointIgnore(CommandInterpreter &interpreter)
@@ -582,11 +586,9 @@ public:
m_ignore_count = 0;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_watchpoint_ignore_options;
+ }
// Instance variables to hold the values for command options.
@@ -644,19 +646,18 @@ private:
CommandOptions m_options;
};
-#pragma mark Ignore::CommandOptions
-
-OptionDefinition
- CommandObjectWatchpointIgnore::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, true, "ignore-count", 'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "Set the number of times this watchpoint is skipped before stopping."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectWatchpointModify
//-------------------------------------------------------------------------
+
+#pragma mark Modify::CommandOptions
+
+static OptionDefinition g_watchpoint_modify_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_ALL, false, "condition", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeExpression, "The watchpoint stops only if this condition expression evaluates to true." }
+ // clang-format on
+};
+
#pragma mark Modify
class CommandObjectWatchpointModify : public CommandObjectParsed {
@@ -716,11 +717,9 @@ public:
m_condition_passed = false;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_watchpoint_modify_options;
+ }
// Instance variables to hold the values for command options.
@@ -781,16 +780,6 @@ private:
CommandOptions m_options;
};
-#pragma mark Modify::CommandOptions
-
-OptionDefinition
- CommandObjectWatchpointModify::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_ALL, false, "condition", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeExpression, "The watchpoint stops only if this condition expression evaluates to true."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectWatchpointSetVariable
//-------------------------------------------------------------------------
diff --git a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
index c67bae015d4..a0214ad04ab 100644
--- a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
@@ -31,6 +31,28 @@ using namespace lldb_private;
// CommandObjectWatchpointCommandAdd
//-------------------------------------------------------------------------
+// FIXME: "script-type" needs to have its contents determined dynamically, so
+// somebody can add a new scripting
+// language to lldb and have it pickable here without having to change this
+// enumeration by hand and rebuild lldb proper.
+
+static OptionEnumValueElement g_script_option_enumeration[4] = {
+ {eScriptLanguageNone, "command",
+ "Commands are in the lldb command interpreter language"},
+ {eScriptLanguagePython, "python", "Commands are in the Python language."},
+ {eSortOrderByName, "default-script",
+ "Commands are in the default scripting language."},
+ {0, nullptr, nullptr}};
+
+static OptionDefinition g_watchpoint_command_add_options[] = {
+ // clang-format off
+ { LLDB_OPT_SET_1, false, "one-liner", 'o', OptionParser::eRequiredArgument, nullptr, 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, nullptr, 0, eArgTypeBoolean, "Specify whether watchpoint command execution should terminate on error." },
+ { LLDB_OPT_SET_ALL, false, "script-type", 's', OptionParser::eRequiredArgument, nullptr, g_script_option_enumeration, 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, 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
+};
+
class CommandObjectWatchpointCommandAdd : public CommandObjectParsed,
public IOHandlerDelegateMultiline {
public:
@@ -309,7 +331,7 @@ are no syntax errors may indicate that a function was declared but never called.
case 's':
m_script_language = (lldb::ScriptLanguage)Args::StringToOptionEnum(
- option_arg, g_option_table[option_idx].enum_values,
+ option_arg, GetDefinitions()[option_idx].enum_values,
eScriptLanguageNone, error);
m_use_script_language = (m_script_language == eScriptLanguagePython ||
@@ -348,11 +370,9 @@ are no syntax errors may indicate that a function was declared but never called.
m_function_name.clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_watchpoint_command_add_options;
+ }
// Instance variables to hold the values for command options.
@@ -459,30 +479,6 @@ private:
CommandOptions m_options;
};
-// FIXME: "script-type" needs to have its contents determined dynamically, so
-// somebody can add a new scripting
-// language to lldb and have it pickable here without having to change this
-// enumeration by hand and rebuild lldb proper.
-
-static OptionEnumValueElement g_script_option_enumeration[4] = {
- {eScriptLanguageNone, "command",
- "Commands are in the lldb command interpreter language"},
- {eScriptLanguagePython, "python", "Commands are in the Python language."},
- {eSortOrderByName, "default-script",
- "Commands are in the default scripting language."},
- {0, nullptr, nullptr}};
-
-OptionDefinition
- CommandObjectWatchpointCommandAdd::CommandOptions::g_option_table[] = {
- // clang-format off
- {LLDB_OPT_SET_1, false, "one-liner", 'o', OptionParser::eRequiredArgument, nullptr, 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, nullptr, 0, eArgTypeBoolean, "Specify whether watchpoint command execution should terminate on error."},
- {LLDB_OPT_SET_ALL, false, "script-type", 's', OptionParser::eRequiredArgument, nullptr, g_script_option_enumeration, 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, 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."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
- // clang-format on
-};
-
//-------------------------------------------------------------------------
// CommandObjectWatchpointCommandDelete
//-------------------------------------------------------------------------
OpenPOWER on IntegriCloud