summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectThread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Commands/CommandObjectThread.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp210
1 files changed, 95 insertions, 115 deletions
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)
OpenPOWER on IntegriCloud