summaryrefslogtreecommitdiff
path: root/source/Commands/CommandObjectThread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Commands/CommandObjectThread.cpp')
-rw-r--r--source/Commands/CommandObjectThread.cpp105
1 files changed, 28 insertions, 77 deletions
diff --git a/source/Commands/CommandObjectThread.cpp b/source/Commands/CommandObjectThread.cpp
index e792887d4ff3..ed7cf0a1a48d 100644
--- a/source/Commands/CommandObjectThread.cpp
+++ b/source/Commands/CommandObjectThread.cpp
@@ -1,9 +1,8 @@
//===-- CommandObjectThread.cpp ---------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -38,9 +37,7 @@
using namespace lldb;
using namespace lldb_private;
-//-------------------------------------------------------------------------
// CommandObjectIterateOverThreads
-//-------------------------------------------------------------------------
class CommandObjectIterateOverThreads : public CommandObjectParsed {
@@ -239,16 +236,11 @@ protected:
bool m_add_return = true;
};
-//-------------------------------------------------------------------------
// CommandObjectThreadBacktrace
-//-------------------------------------------------------------------------
static constexpr OptionDefinition g_thread_backtrace_options[] = {
- // clang-format off
- { LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeCount, "How many frames to display (-1 for all)" },
- { LLDB_OPT_SET_1, false, "start", 's', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeFrameIndex, "Frame in which to start the backtrace" },
- { LLDB_OPT_SET_1, false, "extended", 'e', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Show the extended backtrace, if available" }
- // clang-format on
+#define LLDB_OPTIONS_thread_backtrace
+#include "CommandOptions.inc"
};
class CommandObjectThreadBacktrace : public CommandObjectIterateOverThreads {
@@ -322,7 +314,10 @@ public:
"indexes can be specified as arguments.\n"
"Use the thread-index \"all\" to see all threads.\n"
"Use the thread-index \"unique\" to see threads grouped by unique "
- "call stacks.",
+ "call stacks.\n"
+ "Use 'settings set frame-format' to customize the printing of "
+ "frames in the backtrace and 'settings set thread-format' to "
+ "customize the thread header.",
nullptr,
eCommandRequiresProcess | eCommandRequiresThread |
eCommandTryTargetAPILock | eCommandProcessMustBeLaunched |
@@ -409,16 +404,8 @@ static constexpr OptionEnumValues TriRunningModes() {
}
static constexpr OptionDefinition g_thread_step_scope_options[] = {
- // clang-format off
- { LLDB_OPT_SET_1, false, "step-in-avoids-no-debug", 'a', OptionParser::eRequiredArgument, 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, {}, 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, {}, 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, {}, 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, TriRunningModes(), 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, {}, 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, {}, 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, {}, 0, eArgTypePythonClass, "The name of the class that will manage this step - only supported for Scripted Step." }
- // clang-format on
+#define LLDB_OPTIONS_thread_step_scope
+#include "CommandOptions.inc"
};
class CommandObjectThreadStepWithTypeAndScope : public CommandObjectParsed {
@@ -484,7 +471,7 @@ public:
case 'e':
if (option_arg == "block") {
- m_end_line_is_block_end = 1;
+ m_end_line_is_block_end = true;
break;
}
if (option_arg.getAsInteger(0, m_end_line))
@@ -617,7 +604,7 @@ protected:
result.AppendErrorWithFormat("empty class name for scripted step.");
result.SetStatus(eReturnStatusFailed);
return false;
- } else if (!m_interpreter.GetScriptInterpreter()->CheckObjectExists(
+ } else if (!GetDebugger().GetScriptInterpreter()->CheckObjectExists(
m_options.m_class_name.c_str())) {
result.AppendErrorWithFormat(
"class for scripted step: \"%s\" does not exist.",
@@ -808,9 +795,7 @@ protected:
CommandOptions m_options;
};
-//-------------------------------------------------------------------------
// CommandObjectThreadContinue
-//-------------------------------------------------------------------------
class CommandObjectThreadContinue : public CommandObjectParsed {
public:
@@ -843,7 +828,7 @@ public:
bool DoExecute(Args &command, CommandReturnObject &result) override {
bool synchronous_execution = m_interpreter.GetSynchronous();
- if (!m_interpreter.GetDebugger().GetSelectedTarget()) {
+ if (!GetDebugger().GetSelectedTarget()) {
result.AppendError("invalid target, create a debug target using the "
"'target create' command");
result.SetStatus(eReturnStatusFailed);
@@ -988,9 +973,7 @@ public:
}
};
-//-------------------------------------------------------------------------
// CommandObjectThreadUntil
-//-------------------------------------------------------------------------
static constexpr OptionEnumValueElement g_duo_running_mode[] = {
{eOnlyThisThread, "this-thread", "Run only this thread"},
@@ -1001,12 +984,8 @@ static constexpr OptionEnumValues DuoRunningModes() {
}
static constexpr OptionDefinition g_thread_until_options[] = {
- // clang-format off
- { LLDB_OPT_SET_1, false, "frame", 'f', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeFrameIndex, "Frame index for until operation - defaults to 0" },
- { LLDB_OPT_SET_1, false, "thread", 't', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeThreadIndex, "Thread index for the thread for until operation" },
- { LLDB_OPT_SET_1, false, "run-mode",'m', OptionParser::eRequiredArgument, nullptr, DuoRunningModes(), 0, eArgTypeRunMode, "Determine how to run other threads while stepping this one" },
- { LLDB_OPT_SET_1, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeAddressOrExpression, "Run until we reach the specified address, or leave the function - can be specified multiple times." }
- // clang-format on
+#define LLDB_OPTIONS_thread_until
+#include "CommandOptions.inc"
};
class CommandObjectThreadUntil : public CommandObjectParsed {
@@ -1125,7 +1104,7 @@ protected:
bool DoExecute(Args &command, CommandReturnObject &result) override {
bool synchronous_execution = m_interpreter.GetSynchronous();
- Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+ Target *target = GetDebugger().GetSelectedTarget().get();
if (target == nullptr) {
result.AppendError("invalid target, create a debug target using the "
"'target create' command");
@@ -1329,9 +1308,7 @@ protected:
CommandOptions m_options;
};
-//-------------------------------------------------------------------------
// CommandObjectThreadSelect
-//-------------------------------------------------------------------------
class CommandObjectThreadSelect : public CommandObjectParsed {
public:
@@ -1392,16 +1369,16 @@ protected:
}
};
-//-------------------------------------------------------------------------
// CommandObjectThreadList
-//-------------------------------------------------------------------------
class CommandObjectThreadList : public CommandObjectParsed {
public:
CommandObjectThreadList(CommandInterpreter &interpreter)
: CommandObjectParsed(
interpreter, "thread list",
- "Show a summary of each thread in the current target process.",
+ "Show a summary of each thread in the current target process. "
+ "Use 'settings set thread-format' to customize the individual "
+ "thread listings.",
"thread list",
eCommandRequiresProcess | eCommandTryTargetAPILock |
eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {}
@@ -1424,15 +1401,11 @@ protected:
}
};
-//-------------------------------------------------------------------------
// CommandObjectThreadInfo
-//-------------------------------------------------------------------------
static constexpr OptionDefinition g_thread_info_options[] = {
- // clang-format off
- { LLDB_OPT_SET_ALL, false, "json", 'j', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Display the thread info in JSON format." },
- { LLDB_OPT_SET_ALL, false, "stop-info", 's', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Display the extended stop info in JSON format." }
- // clang-format on
+#define LLDB_OPTIONS_thread_info
+#include "CommandOptions.inc"
};
class CommandObjectThreadInfo : public CommandObjectIterateOverThreads {
@@ -1519,9 +1492,7 @@ public:
CommandOptions m_options;
};
-//-------------------------------------------------------------------------
// CommandObjectThreadException
-//-------------------------------------------------------------------------
class CommandObjectThreadException : public CommandObjectIterateOverThreads {
public:
@@ -1564,14 +1535,11 @@ class CommandObjectThreadException : public CommandObjectIterateOverThreads {
}
};
-//-------------------------------------------------------------------------
// CommandObjectThreadReturn
-//-------------------------------------------------------------------------
static constexpr OptionDefinition g_thread_return_options[] = {
- // clang-format off
- { LLDB_OPT_SET_ALL, false, "from-expression", 'x', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Return from the innermost expression evaluation." }
- // clang-format on
+#define LLDB_OPTIONS_thread_return
+#include "CommandOptions.inc"
};
class CommandObjectThreadReturn : public CommandObjectRaw {
@@ -1742,18 +1710,11 @@ protected:
CommandOptions m_options;
};
-//-------------------------------------------------------------------------
// CommandObjectThreadJump
-//-------------------------------------------------------------------------
static constexpr OptionDefinition g_thread_jump_options[] = {
- // clang-format off
- { LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, {}, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "Specifies the source file to jump to." },
- { LLDB_OPT_SET_1, true, "line", 'l', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeLineNum, "Specifies the line number to jump to." },
- { LLDB_OPT_SET_2, true, "by", 'b', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeOffset, "Jumps by a relative line offset from the current line." },
- { LLDB_OPT_SET_3, true, "address", 'a', OptionParser::eRequiredArgument, 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, {}, 0, eArgTypeNone, "Allows the PC to leave the current function." }
- // clang-format on
+#define LLDB_OPTIONS_thread_jump
+#include "CommandOptions.inc"
};
class CommandObjectThreadJump : public CommandObjectParsed {
@@ -1890,19 +1851,13 @@ protected:
CommandOptions m_options;
};
-//-------------------------------------------------------------------------
// Next are the subcommands of CommandObjectMultiwordThreadPlan
-//-------------------------------------------------------------------------
-//-------------------------------------------------------------------------
// CommandObjectThreadPlanList
-//-------------------------------------------------------------------------
static constexpr OptionDefinition g_thread_plan_list_options[] = {
- // clang-format off
- { LLDB_OPT_SET_1, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Display more information about the thread plans" },
- { LLDB_OPT_SET_1, false, "internal", 'i', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Display internal as well as user thread plans" }
- // clang-format on
+#define LLDB_OPTIONS_thread_plan_list
+#include "CommandOptions.inc"
};
class CommandObjectThreadPlanList : public CommandObjectIterateOverThreads {
@@ -2062,9 +2017,7 @@ public:
}
};
-//-------------------------------------------------------------------------
// CommandObjectMultiwordThreadPlan
-//-------------------------------------------------------------------------
class CommandObjectMultiwordThreadPlan : public CommandObjectMultiword {
public:
@@ -2083,9 +2036,7 @@ public:
~CommandObjectMultiwordThreadPlan() override = default;
};
-//-------------------------------------------------------------------------
// CommandObjectMultiwordThread
-//-------------------------------------------------------------------------
CommandObjectMultiwordThread::CommandObjectMultiwordThread(
CommandInterpreter &interpreter)