45#define LLDB_OPTIONS_thread_backtrace
46#include "CommandOptions.inc"
65 switch (short_option) {
67 if (option_arg.getAsInteger(0,
m_count)) {
69 error.SetErrorStringWithFormat(
70 "invalid integer value for option '%c'", short_option);
74 if (option_arg.getAsInteger(0,
m_start))
75 error.SetErrorStringWithFormat(
76 "invalid integer value for option '%c'", short_option);
83 error.SetErrorStringWithFormat(
84 "invalid boolean value for option '%c'", short_option);
87 llvm_unreachable(
"Unimplemented option");
99 return llvm::ArrayRef(g_thread_backtrace_options);
110 interpreter,
"thread backtrace",
111 "Show thread call stacks. Defaults to the current thread, thread "
112 "indexes can be specified as arguments.\n"
113 "Use the thread-index \"all\" to see all threads.\n"
114 "Use the thread-index \"unique\" to see threads grouped by unique "
116 "Use 'settings set frame-format' to customize the printing of "
117 "frames in the backtrace and 'settings set thread-format' to "
118 "customize the thread header.",
120 eCommandRequiresProcess | eCommandRequiresThread |
121 eCommandTryTargetAPILock | eCommandProcessMustBeLaunched |
122 eCommandProcessMustBePaused) {}
130 llvm::StringRef count_opt(
"--count");
131 llvm::StringRef start_opt(
"--start");
138 Args copy_args(current_args);
141 size_t count_idx = 0;
142 size_t start_idx = 0;
143 size_t count_val = 0;
144 size_t start_val = 0;
146 for (
size_t idx = 0; idx < num_entries; idx++) {
147 llvm::StringRef arg_string = copy_args[idx].ref();
148 if (arg_string.equals(
"-c") || count_opt.startswith(arg_string)) {
150 if (idx == num_entries)
153 if (copy_args[idx].ref().getAsInteger(0, count_val))
155 }
else if (arg_string.equals(
"-s") || start_opt.startswith(arg_string)) {
157 if (idx == num_entries)
160 if (copy_args[idx].ref().getAsInteger(0, start_val))
167 std::string new_start_val = llvm::formatv(
"{0}", start_val + count_val);
168 if (start_idx == 0) {
174 std::string repeat_command;
177 return repeat_command;
185 const std::vector<ConstString> &types =
187 for (
auto type : types) {
189 thread->shared_from_this(), type);
190 if (ext_thread_sp && ext_thread_sp->IsValid()) {
191 const uint32_t num_frames_with_source = 0;
192 const bool stop_format =
false;
196 num_frames_with_source, stop_format)) {
209 "thread disappeared while computing backtraces: 0x%" PRIx64
"\n",
214 Thread *thread = thread_sp.get();
222 const uint32_t num_frames_with_source = 0;
223 const bool stop_format =
true;
225 num_frames_with_source, stop_format, only_stacks)) {
227 "error displaying backtrace for thread: \"0x%4.4x\"\n",
243#define LLDB_OPTIONS_thread_step_scope
244#include "CommandOptions.inc"
257 return llvm::ArrayRef(g_thread_step_scope_options);
263 const int short_option =
264 g_thread_step_scope_options[option_idx].short_option;
266 switch (short_option) {
269 bool avoid_no_debug =
272 error.SetErrorStringWithFormat(
"invalid boolean value for option '%c'",
281 bool avoid_no_debug =
284 error.SetErrorStringWithFormat(
"invalid boolean value for option '%c'",
293 error.SetErrorStringWithFormat(
"invalid step count '%s'",
294 option_arg.str().c_str());
304 if (option_arg ==
"block") {
309 error.SetErrorStringWithFormat(
"invalid end line number '%s'",
310 option_arg.str().c_str());
324 llvm_unreachable(
"Unimplemented option");
336 execution_context ? execution_context->
GetTargetSP() : TargetSP();
337 ProcessSP process_sp =
338 execution_context ? execution_context->
GetProcessSP() : ProcessSP();
339 if (process_sp && process_sp->GetSteppingRunsAllThreads())
363 const char *name,
const char *help,
368 eCommandRequiresProcess | eCommandRequiresThread |
369 eCommandTryTargetAPILock |
370 eCommandProcessMustBeLaunched |
371 eCommandProcessMustBePaused),
383 arg.push_back(thread_id_arg);
422 if (thread ==
nullptr) {
423 result.
AppendError(
"no selected thread in process");
430 if (!llvm::to_integer(thread_idx_cstr, step_thread_idx)) {
437 if (thread ==
nullptr) {
439 "Thread index %u is out of range (valid values are 0 - %u).\n",
440 step_thread_idx, num_threads);
449 }
else if (!
GetDebugger().GetScriptInterpreter()->CheckObjectExists(
452 "class for scripted step: \"%s\" does not exist.",
461 "end line option is only valid for step into");
465 const bool abort_other_plans =
false;
470 bool bool_stop_other_threads;
472 bool_stop_other_threads =
false;
476 bool_stop_other_threads =
true;
478 ThreadPlanSP new_plan_sp;
483 assert(frame !=
nullptr);
509 "Could not find the current block address.");
523 abort_other_plans, range,
536 false, abort_other_plans, bool_stop_other_threads, new_plan_status);
545 stop_other_threads, new_plan_status,
549 true, abort_other_plans, bool_stop_other_threads, new_plan_status);
552 false, abort_other_plans, bool_stop_other_threads, new_plan_status);
555 true, abort_other_plans, bool_stop_other_threads, new_plan_status);
558 abort_other_plans,
nullptr,
false, bool_stop_other_threads,
eVoteYes,
576 new_plan_sp->SetIsControllingPlan(
true);
577 new_plan_sp->SetOkayToDiscard(
false);
582 "step operation does not support iteration count.");
592 if (synchronous_execution)
597 if (!
error.Success()) {
606 process->
SyncIOHandler(iohandler_id, std::chrono::seconds(2));
608 if (synchronous_execution) {
639 interpreter,
"thread continue",
640 "Continue execution of the current target process. One "
641 "or more threads may be specified, by default all "
644 eCommandRequiresThread | eCommandTryTargetAPILock |
645 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {
655 arg.push_back(thread_idx_arg);
675 if (process ==
nullptr) {
676 result.
AppendError(
"no process exists. Cannot continue");
688 std::lock_guard<std::recursive_mutex> guard(
691 std::vector<Thread *> resume_threads;
692 for (
auto &entry : command.
entries()) {
694 if (entry.ref().getAsInteger(0, thread_idx)) {
696 "invalid thread index argument: \"%s\".\n", entry.c_str());
703 resume_threads.push_back(thread);
711 if (resume_threads.empty()) {
712 result.
AppendError(
"no valid thread indexes were specified");
715 if (resume_threads.size() == 1)
720 for (
uint32_t idx = 0; idx < num_threads; ++idx) {
723 std::vector<Thread *>::iterator this_thread_pos =
724 find(resume_threads.begin(), resume_threads.end(), thread);
726 if (this_thread_pos != resume_threads.end()) {
727 resume_threads.erase(this_thread_pos);
728 if (!resume_threads.empty())
733 const bool override_suspend =
true;
746 std::lock_guard<std::recursive_mutex> guard(
750 if (current_thread ==
nullptr) {
751 result.
AppendError(
"the process doesn't have a current thread");
755 for (
uint32_t idx = 0; idx < num_threads; ++idx) {
757 if (thread == current_thread) {
759 " in process %" PRIu64
"\n",
761 const bool override_suspend =
true;
771 if (synchronous_execution)
777 if (
error.Success()) {
780 if (synchronous_execution) {
797 "Process cannot be continued from its current state (%s).\n",
807#define LLDB_OPTIONS_thread_until
808#include "CommandOptions.inc"
830 switch (short_option) {
840 error.SetErrorStringWithFormat(
"invalid thread index '%s'",
841 option_arg.str().c_str());
847 error.SetErrorStringWithFormat(
"invalid frame index '%s'",
848 option_arg.str().c_str());
856 if (
error.Success()) {
864 llvm_unreachable(
"Unimplemented option");
877 return llvm::ArrayRef(g_thread_until_options);
889 interpreter,
"thread until",
890 "Continue until a line number or address is reached by the "
891 "current or specified thread. Stops when returning from "
892 "the current function as a safety measure. "
893 "The target line number(s) are given as arguments, and if more "
895 " is provided, stepping will stop when the first one is hit.",
897 eCommandRequiresThread | eCommandTryTargetAPILock |
898 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {
908 arg.push_back(line_num_arg);
925 if (process ==
nullptr) {
926 result.
AppendError(
"need a valid process to step");
929 std::vector<uint32_t> line_numbers;
933 for (
size_t i = 0; i < num_args; i++) {
940 line_numbers.push_back(line_number);
956 if (thread ==
nullptr) {
959 "Thread index %u is out of range (valid values are 0 - %u).\n",
964 const bool abort_other_plans =
false;
968 if (frame ==
nullptr) {
970 "Frame index %u is out of range for thread id %" PRIu64
".\n",
975 ThreadPlanSP new_plan_sp;
986 if (line_table ==
nullptr) {
988 "frame %u of thread id %" PRIu64
".\n",
995 std::vector<addr_t> address_list;
1001 "function info - can't get until range.");
1014 bool all_in_function =
true;
1023 for (
uint32_t line_number : line_numbers) {
1026 uint32_t start_idx_ptr = index_ptr;
1028 index_ptr, line_number,
nullptr, exact, &line_entry);
1030 line_number = line_entry.
line;
1032 start_idx_ptr = index_ptr;
1033 while (start_idx_ptr <= end_ptr) {
1035 start_idx_ptr, line_number,
nullptr, exact, &line_entry);
1043 address_list.push_back(address);
1045 all_in_function =
false;
1053 address_list.push_back(address);
1055 all_in_function =
false;
1058 if (address_list.empty()) {
1059 if (all_in_function)
1061 "No line entries matching until target.\n");
1064 "Until target outside of the current function.\n");
1070 abort_other_plans, &address_list.front(), address_list.size(),
1078 new_plan_sp->SetIsControllingPlan(
true);
1079 new_plan_sp->SetOkayToDiscard(
false);
1086 " has no debug information.\n",
1093 "Failed to set the selected thread to thread id %" PRIu64
".\n",
1100 if (synchronous_execution)
1105 if (
error.Success()) {
1108 if (synchronous_execution) {
1136 "Change the currently selected thread.", nullptr,
1137 eCommandRequiresProcess | eCommandTryTargetAPILock |
1138 eCommandProcessMustBeLaunched |
1139 eCommandProcessMustBePaused) {
1149 arg.push_back(thread_idx_arg);
1171 if (process ==
nullptr) {
1176 "'%s' takes exactly one thread index argument:\nUsage: %s\n",
1190 if (new_thread ==
nullptr) {
1209 interpreter,
"thread list",
1210 "Show a summary of each thread in the current target process. "
1211 "Use 'settings set thread-format' to customize the individual "
1214 eCommandRequiresProcess | eCommandTryTargetAPILock |
1215 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {}
1224 const bool only_threads_with_stop_reason =
false;
1227 const uint32_t num_frames_with_source = 0;
1229 process->
GetThreadStatus(strm, only_threads_with_stop_reason, start_frame,
1230 num_frames, num_frames_with_source,
false);
1236#define LLDB_OPTIONS_thread_info
1237#include "CommandOptions.inc"
1257 switch (short_option) {
1267 llvm_unreachable(
"Unimplemented option");
1273 return llvm::ArrayRef(g_thread_info_options);
1282 interpreter,
"thread info",
1283 "Show an extended summary of one or "
1284 "more threads. Defaults to the "
1287 eCommandRequiresProcess | eCommandTryTargetAPILock |
1288 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {
1305 ThreadSP thread_sp =
1313 Thread *thread = thread_sp.get();
1335 interpreter,
"thread exception",
1336 "Display the current exception object for a thread. Defaults to "
1337 "the current thread.",
1339 eCommandRequiresProcess | eCommandTryTargetAPILock |
1340 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {}
1353 ThreadSP thread_sp =
1362 ValueObjectSP exception_object_sp = thread_sp->GetCurrentException();
1363 if (exception_object_sp) {
1364 exception_object_sp->Dump(strm);
1367 ThreadSP exception_thread_sp = thread_sp->GetCurrentExceptionBacktrace();
1368 if (exception_thread_sp && exception_thread_sp->IsValid()) {
1369 const uint32_t num_frames_with_source = 0;
1370 const bool stop_format =
false;
1371 exception_thread_sp->GetStatus(strm, 0,
UINT32_MAX,
1372 num_frames_with_source, stop_format);
1383 interpreter,
"thread siginfo",
1384 "Display the current siginfo object for a thread. Defaults to "
1385 "the current thread.",
1387 eCommandRequiresProcess | eCommandTryTargetAPILock |
1388 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {}
1401 ThreadSP thread_sp =
1412 thread_sp->GetIndexID());
1415 ValueObjectSP exception_object_sp = thread_sp->GetSiginfoValue();
1416 if (exception_object_sp)
1417 exception_object_sp->Dump(strm);
1419 strm.
Printf(
"(no siginfo)\n");
1427#define LLDB_OPTIONS_thread_return
1428#include "CommandOptions.inc"
1447 switch (short_option) {
1455 error.SetErrorStringWithFormat(
1456 "invalid boolean value '%s' for 'x' option",
1457 option_arg.str().c_str());
1461 llvm_unreachable(
"Unimplemented option");
1471 return llvm::ArrayRef(g_thread_return_options);
1481 "Prematurely return from a stack frame, "
1482 "short-circuiting execution of newer frames "
1483 "and optionally yielding a specified value. Defaults "
1484 "to the exiting the current stack "
1487 eCommandRequiresFrame | eCommandTryTargetAPILock |
1488 eCommandProcessMustBeLaunched |
1489 eCommandProcessMustBePaused) {
1499 arg.push_back(expression_arg);
1515 if (command.startswith(
"-x")) {
1516 if (command.size() != 2U)
1517 result.
AppendWarning(
"Return values ignored when returning from user "
1518 "called expressions");
1523 if (!
error.Success()) {
1534 "Could not select 0th frame after unwinding expression.");
1540 ValueObjectSP return_valobj_sp;
1543 uint32_t frame_idx = frame_sp->GetFrameIndex();
1545 if (frame_sp->IsInlined()) {
1546 result.
AppendError(
"Don't know how to return from inlined frames.");
1550 if (!command.empty()) {
1559 return_valobj_sp, options);
1561 if (return_valobj_sp)
1563 "Error evaluating result expression: %s",
1564 return_valobj_sp->GetError().AsCString());
1567 "Unknown error evaluating result expression.");
1574 const bool broadcast =
true;
1575 error = thread_sp->ReturnFromFrame(frame_sp, return_valobj_sp, broadcast);
1576 if (!
error.Success()) {
1578 "Error returning from frame %d of thread %d: %s.", frame_idx,
1579 thread_sp->GetIndexID(),
error.AsCString());
1591#define LLDB_OPTIONS_thread_jump
1592#include "CommandOptions.inc"
1615 switch (short_option) {
1619 return Status(
"only one source file expected.");
1623 return Status(
"invalid line number: '%s'.", option_arg.str().c_str());
1627 return Status(
"invalid line offset: '%s'.", option_arg.str().c_str());
1637 llvm_unreachable(
"Unimplemented option");
1643 return llvm::ArrayRef(g_thread_jump_options);
1655 interpreter,
"thread jump",
1656 "Sets the program counter to a new address.",
"thread jump",
1657 eCommandRequiresFrame | eCommandTryTargetAPILock |
1658 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {}
1683 if (!reg_ctx->
SetPC(callAddr)) {
1701 "No source file available for the current location.");
1705 std::string warnings;
1713 if (!warnings.empty())
1727#define LLDB_OPTIONS_thread_plan_list
1728#include "CommandOptions.inc"
1746 switch (short_option) {
1752 if (option_arg.getAsInteger(0, tid))
1753 return Status(
"invalid tid: '%s'.", option_arg.str().c_str());
1763 llvm_unreachable(
"Unimplemented option");
1777 return llvm::ArrayRef(g_thread_plan_list_options);
1789 interpreter,
"thread plan list",
1790 "Show thread plans for one or more threads. If no threads are "
1791 "specified, show the "
1792 "current thread. Use the thread-index \"all\" to see all threads.",
1794 eCommandRequiresProcess | eCommandRequiresThread |
1795 eCommandTryTargetAPILock | eCommandProcessMustBeLaunched |
1796 eCommandProcessMustBePaused) {}
1863 "Discards thread plans up to and including the "
1864 "specified index (see 'thread plan list'.) "
1865 "Only user visible plans can be discarded.",
1867 eCommandRequiresProcess | eCommandRequiresThread |
1868 eCommandTryTargetAPILock |
1869 eCommandProcessMustBeLaunched |
1870 eCommandProcessMustBePaused) {
1880 arg.push_back(plan_index_arg);
1901 "thread plan index - but got %zu.",
1909 "Invalid thread index: \"%s\" - should be unsigned int.",
1914 if (thread_plan_idx == 0) {
1916 "You wouldn't really want me to discard the base thread plan.");
1925 "Could not find User thread plan with index %s.",
1936 "Removes any thread plans associated with "
1937 "currently unreported threads. "
1938 "Specify one or more TID's to remove, or if no "
1939 "TID's are provides, remove threads for all "
1940 "unreported threads",
1942 eCommandRequiresProcess |
1943 eCommandTryTargetAPILock |
1944 eCommandProcessMustBeLaunched |
1945 eCommandProcessMustBePaused) {
1955 arg.push_back(tid_arg);
1974 std::lock_guard<std::recursive_mutex> guard(
1977 for (
size_t i = 0; i < num_args; i++) {
2001 interpreter,
"plan",
2002 "Commands for managing thread plans that control execution.",
2003 "thread plan <subcommand> [<subcommand objects]") {
2025 interpreter,
"trace thread export",
2026 "Commands for exporting traces of the threads in the current "
2027 "process to different formats.",
2028 "thread trace export <export-plugin> [<subcommand objects>]") {
2031 for (llvm::StringRef plugin_name =
2033 !plugin_name.empty();
2035 if (ThreadTraceExportCommandCreator command_creator =
2049 true, interpreter,
"thread trace start",
2050 "Start tracing threads with the corresponding trace "
2051 "plug-in for the current process.",
2052 "thread trace start [<trace-options>]") {}
2066 interpreter,
"thread trace stop",
2067 "Stop tracing threads, including the ones traced with the "
2068 "\"process trace start\" command."
2069 "Defaults to the current thread. Thread indices can be "
2070 "specified as arguments.\n Use the thread-index \"all\" to stop "
2072 "for all existing threads.",
2073 "thread trace stop [<thread-index> <thread-index> ...]",
2074 eCommandRequiresProcess | eCommandTryTargetAPILock |
2075 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused |
2076 eCommandProcessMustBeTraced) {}
2081 llvm::ArrayRef<lldb::tid_t> tids)
override {
2084 TraceSP trace_sp = process_sp->GetTarget().GetTrace();
2086 if (llvm::Error err = trace_sp->Stop(tids))
2103 if (!llvm::to_integer(arg, thread_idx)) {
2107 ThreadSP thread_sp =
2115#define LLDB_OPTIONS_thread_trace_dump_function_calls
2116#include "CommandOptions.inc"
2131 switch (short_option) {
2146 llvm_unreachable(
"Unimplemented option");
2157 return llvm::ArrayRef(g_thread_trace_dump_function_calls_options);
2169 interpreter,
"thread trace dump function-calls",
2170 "Dump the traced function-calls for one thread. If no "
2171 "thread is specified, the current thread is used.",
2173 eCommandRequiresProcess | eCommandRequiresThread |
2174 eCommandTryTargetAPILock | eCommandProcessMustBeLaunched |
2175 eCommandProcessMustBePaused | eCommandProcessMustBeTraced) {
2192 llvm::Expected<TraceCursorSP> cursor_or_error =
2195 if (!cursor_or_error) {
2196 result.
AppendError(llvm::toString(cursor_or_error.takeError()));
2199 TraceCursorSP &cursor_sp = *cursor_or_error;
2201 std::optional<StreamFile> out_file;
2222#define LLDB_OPTIONS_thread_trace_dump_instructions
2223#include "CommandOptions.inc"
2238 switch (short_option) {
2241 if (option_arg.empty() || option_arg.getAsInteger(0, count) ||
2243 error.SetErrorStringWithFormat(
2244 "invalid integer value for option '%s'",
2245 option_arg.str().c_str());
2256 if (option_arg.empty() || option_arg.getAsInteger(0, skip) || skip < 0)
2257 error.SetErrorStringWithFormat(
2258 "invalid integer value for option '%s'",
2259 option_arg.str().c_str());
2266 if (option_arg.empty() || option_arg.getAsInteger(0,
id))
2267 error.SetErrorStringWithFormat(
2268 "invalid integer value for option '%s'",
2269 option_arg.str().c_str());
2317 llvm_unreachable(
"Unimplemented option");
2330 return llvm::ArrayRef(g_thread_trace_dump_instructions_options);
2344 interpreter,
"thread trace dump instructions",
2345 "Dump the traced instructions for one thread. If no "
2346 "thread is specified, show the current thread.",
2348 eCommandRequiresProcess | eCommandRequiresThread |
2349 eCommandTryTargetAPILock | eCommandProcessMustBeLaunched |
2350 eCommandProcessMustBePaused | eCommandProcessMustBeTraced) {
2363 if (cmd.find(
" --continue") == std::string::npos)
2364 cmd +=
" --continue";
2383 llvm::Expected<TraceCursorSP> cursor_or_error =
2386 if (!cursor_or_error) {
2387 result.
AppendError(llvm::toString(cursor_or_error.takeError()));
2390 TraceCursorSP &cursor_sp = *cursor_or_error;
2398 std::optional<StreamFile> out_file;
2427#define LLDB_OPTIONS_thread_trace_dump_info
2428#include "CommandOptions.inc"
2443 switch (short_option) {
2453 llvm_unreachable(
"Unimplemented option");
2464 return llvm::ArrayRef(g_thread_trace_dump_info_options);
2474 interpreter,
"thread trace dump info",
2475 "Dump the traced information for one or more threads. If no "
2476 "threads are specified, show the current thread. Use the "
2477 "thread-index \"all\" to see all threads.",
2479 eCommandRequiresProcess | eCommandTryTargetAPILock |
2480 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused |
2481 eCommandProcessMustBeTraced) {}
2490 ThreadSP thread_sp =
2505 interpreter,
"dump",
2506 "Commands for displaying trace information of the threads "
2507 "in the current process.",
2508 "thread trace dump <subcommand> [<subcommand objects>]") {
2526 interpreter,
"trace",
2527 "Commands for operating on traces of the threads in the current "
2529 "thread trace <subcommand> [<subcommand objects>]") {
2548 "Commands for operating on "
2549 "one or more threads in "
2550 "the current process.",
2551 "thread <subcommand> [<subcommand-options>]") {
2574 interpreter,
"thread step-in",
2575 "Source level single step, stepping into calls. Defaults "
2576 "to current thread unless specified.",
2581 interpreter,
"thread step-out",
2582 "Finish executing the current stack frame and stop after "
2583 "returning. Defaults to current thread unless specified.",
2588 interpreter,
"thread step-over",
2589 "Source level single step, stepping over calls. Defaults "
2590 "to current thread unless specified.",
2595 interpreter,
"thread step-inst",
2596 "Instruction level single step, stepping into calls. "
2597 "Defaults to current thread unless specified.",
2602 interpreter,
"thread step-inst-over",
2603 "Instruction level single step, stepping over calls. "
2604 "Defaults to current thread unless specified.",
2610 interpreter,
"thread step-scripted",
2611 "Step as instructed by the script class passed in the -C option. "
2612 "You can also specify a dictionary of key (-k) and value (-v) pairs "
2613 "that will be used to populate an SBStructuredData Dictionary, which "
2614 "will be passed to the constructor of the class implementing the "
2615 "scripted step. See the Python Reference for more details.",
static ThreadSP GetSingleThreadFromArgs(ExecutionContext &exe_ctx, Args &args, CommandReturnObject &result)
static llvm::raw_ostream & error(Stream &strm)
~CommandObjectMultiwordThreadPlan() override=default
CommandObjectMultiwordThreadPlan(CommandInterpreter &interpreter)
~CommandObjectMultiwordTraceDump() override=default
CommandObjectMultiwordTraceDump(CommandInterpreter &interpreter)
CommandObjectMultiwordTrace(CommandInterpreter &interpreter)
~CommandObjectMultiwordTrace() override=default
~CommandOptions() override=default
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
bool m_extended_backtrace
Options * GetOptions() override
CommandObjectThreadBacktrace(CommandInterpreter &interpreter)
std::optional< std::string > GetRepeatCommand(Args ¤t_args, uint32_t idx) override
Get the command that appropriate for a "repeat" of the current command.
void DoExtendedBacktrace(Thread *thread, CommandReturnObject &result)
bool HandleOneThread(lldb::tid_t tid, CommandReturnObject &result) override
~CommandObjectThreadBacktrace() override=default
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
~CommandObjectThreadContinue() override=default
bool DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectThreadContinue(CommandInterpreter &interpreter)
CommandObjectThreadException(CommandInterpreter &interpreter)
bool HandleOneThread(lldb::tid_t tid, CommandReturnObject &result) override
~CommandObjectThreadException() override=default
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
~CommandOptions() override=default
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
CommandObjectThreadInfo(CommandInterpreter &interpreter)
bool HandleOneThread(lldb::tid_t tid, CommandReturnObject &result) override
~CommandObjectThreadInfo() override=default
Options * GetOptions() override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
~CommandOptions() override=default
CommandObjectThreadJump(CommandInterpreter &interpreter)
bool DoExecute(Args &args, CommandReturnObject &result) override
~CommandObjectThreadJump() override=default
Options * GetOptions() override
bool DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectThreadList() override=default
CommandObjectThreadList(CommandInterpreter &interpreter)
bool DoExecute(Args &args, CommandReturnObject &result) override
CommandObjectThreadPlanDiscard(CommandInterpreter &interpreter)
~CommandObjectThreadPlanDiscard() override=default
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
~CommandOptions() override=default
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
std::vector< lldb::tid_t > m_tids
void OptionParsingStarting(ExecutionContext *execution_context) override
bool DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
CommandObjectThreadPlanList(CommandInterpreter &interpreter)
bool HandleOneThread(lldb::tid_t tid, CommandReturnObject &result) override
~CommandObjectThreadPlanList() override=default
CommandObjectThreadPlanPrune(CommandInterpreter &interpreter)
bool DoExecute(Args &args, CommandReturnObject &result) override
~CommandObjectThreadPlanPrune() override=default
~CommandOptions() override=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Options * GetOptions() override
bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override
CommandObjectThreadReturn(CommandInterpreter &interpreter)
~CommandObjectThreadReturn() override=default
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
bool DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectThreadSelect(CommandInterpreter &interpreter)
~CommandObjectThreadSelect() override=default
~CommandObjectThreadSiginfo() override=default
bool HandleOneThread(lldb::tid_t tid, CommandReturnObject &result) override
CommandObjectThreadSiginfo(CommandInterpreter &interpreter)
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
OptionGroupPythonClassWithDict m_class_options
~CommandObjectThreadStepWithTypeAndScope() override=default
OptionGroupOptions m_all_options
Options * GetOptions() override
ThreadStepScopeOptionGroup m_options
CommandObjectThreadStepWithTypeAndScope(CommandInterpreter &interpreter, const char *name, const char *help, const char *syntax, StepType step_type, StepScope step_scope)
bool DoExecute(Args &command, CommandReturnObject &result) override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
uint32_t m_step_thread_idx
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
void OptionParsingStarting(ExecutionContext *execution_context) override
~CommandOptions() override=default
std::vector< lldb::addr_t > m_until_addrs
Options * GetOptions() override
CommandObjectThreadUntil(CommandInterpreter &interpreter)
~CommandObjectThreadUntil() override=default
bool DoExecute(Args &command, CommandReturnObject &result) override
TraceDumperOptions m_dumper_options
~CommandOptions() override=default
static const size_t kDefaultCount
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
std::optional< FileSpec > m_output_file
bool DoExecute(Args &args, CommandReturnObject &result) override
CommandObjectTraceDumpFunctionCalls(CommandInterpreter &interpreter)
~CommandObjectTraceDumpFunctionCalls() override=default
Options * GetOptions() override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
void OptionParsingStarting(ExecutionContext *execution_context) override
~CommandOptions() override=default
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
~CommandObjectTraceDumpInfo() override=default
Options * GetOptions() override
bool HandleOneThread(lldb::tid_t tid, CommandReturnObject &result) override
CommandObjectTraceDumpInfo(CommandInterpreter &interpreter)
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
std::optional< FileSpec > m_output_file
~CommandOptions() override=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
TraceDumperOptions m_dumper_options
static const size_t kDefaultCount
void OptionParsingStarting(ExecutionContext *execution_context) override
CommandObjectTraceDumpInstructions(CommandInterpreter &interpreter)
Options * GetOptions() override
bool DoExecute(Args &args, CommandReturnObject &result) override
~CommandObjectTraceDumpInstructions() override=default
std::optional< std::string > GetRepeatCommand(Args ¤t_command_args, uint32_t index) override
Get the command that appropriate for a "repeat" of the current command.
std::optional< lldb::user_id_t > m_last_id
CommandObjectTraceExport(CommandInterpreter &interpreter)
lldb::CommandObjectSP GetDelegateCommand(Trace &trace) override
CommandObjectTraceStart(CommandInterpreter &interpreter)
~CommandObjectTraceStop() override=default
bool DoExecuteOnThreads(Args &command, CommandReturnObject &result, llvm::ArrayRef< lldb::tid_t > tids) override
CommandObjectTraceStop(CommandInterpreter &interpreter)
void OptionParsingStarting(ExecutionContext *execution_context) override
LazyBool m_step_in_avoid_no_debug
~ThreadStepScopeOptionGroup() override=default
std::string m_avoid_regexp
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
std::string m_step_in_target
bool m_end_line_is_block_end
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
LazyBool m_step_out_avoid_no_debug
ThreadStepScopeOptionGroup()
A section + offset based address range class.
Address & GetBaseAddress()
Get accessor for the base address of the range.
bool ContainsLoadAddress(const Address &so_addr, Target *target) const
Check if a section offset so_addr when represented as a load address is contained within this object'...
lldb::addr_t GetByteSize() const
Get accessor for the byte size of this range.
A section + offset based address class.
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
lldb::addr_t GetCallableLoadAddress(Target *target, bool is_indirect=false) const
Get the load address as a callable code load address.
lldb::SectionSP GetSection() const
Get const accessor for the section.
lldb::addr_t GetFileAddress() const
Get the file address.
lldb::addr_t GetOffset() const
Get the section relative offset value.
bool IsValid() const
Check if the object state is valid.
A command line argument class.
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
void ReplaceArgumentAtIndex(size_t idx, llvm::StringRef arg_str, char quote_char='\0')
Replaces the argument value at index idx to arg_str if idx is a valid argument index.
void AppendArgument(llvm::StringRef arg_str, char quote_char='\0')
Appends a new argument to the end of the list argument list.
llvm::ArrayRef< ArgEntry > entries() const
const char * GetArgumentAtIndex(size_t idx) const
Gets the NULL terminated C string argument pointer for the argument at index idx.
bool GetCommandString(std::string &command) const
bool GetQuotedCommandString(std::string &command) const
A class that describes a single lexical block.
bool GetRangeContainingAddress(const Address &addr, AddressRange &range)
static bool InvokeCommonCompletionCallbacks(CommandInterpreter &interpreter, uint32_t completion_mask, lldb_private::CompletionRequest &request, SearchFilter *searcher)
bool DoExecute(Args &command, CommandReturnObject &result) override
Class similar to CommandObjectIterateOverThreads, but which performs an action on multiple threads at...
CommandObjectMultiwordThread(CommandInterpreter &interpreter)
~CommandObjectMultiwordThread() override
bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj) override
This class works by delegating the logic to the actual trace plug-in that can support the current pro...
std::vector< CommandArgumentData > CommandArgumentEntry
ExecutionContext m_exe_ctx
std::vector< CommandArgumentEntry > m_arguments
CommandInterpreter & GetCommandInterpreter()
Target & GetSelectedTarget()
CommandInterpreter & m_interpreter
Thread * GetDefaultThread()
virtual llvm::StringRef GetSyntax()
void AppendMessage(llvm::StringRef in_string)
void void AppendError(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
void AppendMessageWithFormat(const char *format,...) __attribute__((format(printf
void SetDidChangeProcessState(bool b)
void void AppendWarning(llvm::StringRef in_string)
void SetError(const Status &error, const char *fallback_error_cstr=nullptr)
Stream & GetOutputStream()
uint32_t FindLineEntry(uint32_t start_idx, uint32_t line, const FileSpec *file_spec_ptr, bool exact, LineEntry *line_entry)
Find the line entry by line and optional inlined file spec.
LineTable * GetLineTable()
Get the line table for the compile unit.
"lldb/Utility/ArgCompletionRequest.h"
size_t GetCursorIndex() const
void SetUnwindOnError(bool unwind=false)
void SetUseDynamic(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void SetFrameSP(const lldb::StackFrameSP &frame_sp)
Set accessor to set only the frame shared pointer.
bool HasThreadScope() const
Returns true the ExecutionContext object contains a valid target, process, and thread.
const lldb::TargetSP & GetTargetSP() const
Get accessor to get the target shared pointer.
const lldb::ProcessSP & GetProcessSP() const
Get accessor to get the process shared pointer.
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
const lldb::StackFrameSP & GetFrameSP() const
Get accessor to get the frame shared pointer.
Process & GetProcessRef() const
Returns a reference to the process object.
Target * GetTargetPtr() const
Returns a pointer to the target object.
const lldb::ThreadSP & GetThreadSP() const
Get accessor to get the thread shared pointer.
Process * GetProcessPtr() const
Returns a pointer to the process object.
RegisterContext * GetRegisterContext() const
Thread * GetThreadPtr() const
Returns a pointer to the thread object.
const AddressRange & GetAddressRange()
bool FindLineEntryByAddress(const Address &so_addr, LineEntry &line_entry, uint32_t *index_ptr=nullptr)
Find a line entry that contains the section offset address so_addr.
void Append(OptionGroup *group)
Append options from a OptionGroup class.
const std::string & GetName()
const StructuredData::DictionarySP GetStructuredData()
A command line option parsing protocol class.
std::vector< Option > m_getopt_table
static llvm::StringRef GetTraceExporterPluginNameAtIndex(uint32_t index)
static ThreadTraceExportCommandCreator GetThreadTraceExportCommandCreatorAtIndex(uint32_t index)
Return the callback used to create the CommandObject that will be listed under "thread trace export".
A plug-in interface definition class for debugging a process.
lldb::pid_t GetID() const
Returns the pid of the process or LLDB_INVALID_PROCESS_ID if there is no known pid.
ThreadList & GetThreadList()
Status Resume()
Resumes all of a process's threads as configured using the Thread run control functions.
void PruneThreadPlans()
Prune ThreadPlanStacks for all unreported threads.
bool PruneThreadPlansForTID(lldb::tid_t tid)
Prune ThreadPlanStacks for unreported threads.
bool DumpThreadPlansForTID(Stream &strm, lldb::tid_t tid, lldb::DescriptionLevel desc_level, bool internal, bool condense_trivial, bool skip_unreported_plans)
Dump the thread plans associated with thread with tid.
Status ResumeSynchronous(Stream *stream)
size_t GetThreadStatus(Stream &ostrm, bool only_threads_with_stop_reason, uint32_t start_frame, uint32_t num_frames, uint32_t num_frames_with_source, bool stop_format)
lldb::StateType GetState()
Get accessor for the current process state.
void GetStatus(Stream &ostrm)
uint32_t GetIOHandlerID() const
void DumpThreadPlans(Stream &strm, lldb::DescriptionLevel desc_level, bool internal, bool condense_trivial, bool skip_unreported_plans)
Dump all the thread plans for this process.
void SyncIOHandler(uint32_t iohandler_id, const Timeout< std::micro > &timeout)
Waits for the process state to be running within a given msec timeout.
This base class provides an interface to stack frames.
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
bool HasDebugInformation()
Determine whether this StackFrame has debug information available or not.
const Address & GetFrameCodeAddress()
Get an Address for the current pc value in this StackFrame.
bool Fail() const
Test for error condition.
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
Block * block
The Block for a given query.
CompileUnit * comp_unit
The CompileUnit for a given query.
LineEntry line_entry
The LineEntry for a given query.
bool GetAddressRangeFromHereToEndLine(uint32_t end_line, AddressRange &range, Status &error)
A plug-in interface definition class for system runtimes.
virtual lldb::ThreadSP GetExtendedBacktraceThread(lldb::ThreadSP thread, ConstString type)
Return a Thread which shows the origin of this thread's creation.
virtual const std::vector< ConstString > & GetExtendedBacktraceTypes()
Return a list of thread origin extended backtraces that may be available.
lldb::ExpressionResults EvaluateExpression(llvm::StringRef expression, ExecutionContextScope *exe_scope, lldb::ValueObjectSP &result_valobj_sp, const EvaluateExpressionOptions &options=EvaluateExpressionOptions(), std::string *fixed_expression=nullptr, ValueObject *ctx_obj=nullptr)
uint32_t GetSize(bool can_update=true)
bool SetSelectedThreadByID(lldb::tid_t tid, bool notify=false)
lldb::ThreadSP FindThreadByIndexID(uint32_t index_id, bool can_update=true)
lldb::ThreadSP GetThreadAtIndex(uint32_t idx, bool can_update=true)
std::recursive_mutex & GetMutex() const override
lldb::ThreadSP FindThreadByID(lldb::tid_t tid, bool can_update=true)
void SetAvoidRegexp(const char *name)
virtual lldb::ThreadPlanSP QueueThreadPlanForStepOut(bool abort_other_plans, SymbolContext *addr_context, bool first_insn, bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote, uint32_t frame_idx, Status &status, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
Queue the plan used to step out of the function at the current PC of thread.
Status UnwindInnermostExpression()
Unwinds the thread stack for the innermost expression plan currently on the thread plan stack.
virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx)
virtual lldb::ThreadPlanSP QueueThreadPlanForStepUntil(bool abort_other_plans, lldb::addr_t *address_list, size_t num_addresses, bool stop_others, uint32_t frame_idx, Status &status)
void AutoCompleteThreadPlans(CompletionRequest &request) const
Format the thread plan information for auto completion.
uint32_t GetIndexID() const
bool GetDescription(Stream &s, lldb::DescriptionLevel level, bool print_json_thread, bool print_json_stopinfo)
void SetResumeState(lldb::StateType state, bool override_suspend=false)
Sets the USER resume state for this thread.
uint32_t GetSelectedFrameIndex()
lldb::StackFrameSP GetSelectedFrame()
bool DiscardUserThreadPlansUpToIndex(uint32_t thread_index)
Discards the plans queued on the plan stack of the current thread up to and including the plan in tha...
lldb::ProcessSP GetProcess() const
virtual lldb::ThreadPlanSP QueueThreadPlanForStepInRange(bool abort_other_plans, const AddressRange &range, const SymbolContext &addr_context, const char *step_in_target, lldb::RunMode stop_other_threads, Status &status, LazyBool step_in_avoids_code_without_debug_info=eLazyBoolCalculate, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
Queues the plan used to step through an address range, stepping into functions.
virtual lldb::ThreadPlanSP QueueThreadPlanForStepScripted(bool abort_other_plans, const char *class_name, StructuredData::ObjectSP extra_args_sp, bool stop_other_threads, Status &status)
virtual lldb::ThreadPlanSP QueueThreadPlanForStepSingleInstruction(bool step_over, bool abort_other_plans, bool stop_other_threads, Status &status)
Queues the plan used to step one instruction from the current PC of thread.
Status JumpToLine(const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings=nullptr)
virtual lldb::ThreadPlanSP QueueThreadPlanForStepOverRange(bool abort_other_plans, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_other_threads, Status &status, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
Queues the plan used to step through an address range, stepping over function calls.
size_t GetStatus(Stream &strm, uint32_t start_frame, uint32_t num_frames, uint32_t num_frames_with_source, bool stop_format, bool only_stacks=false)
bool SetSelectedFrameByIndexNoisily(uint32_t frame_idx, Stream &output_stream)
Class used to dump the instructions of a TraceCursor using its current state and granularity.
std::optional< lldb::user_id_t > DumpInstructions(size_t count)
Dump count instructions of the thread trace starting at the current cursor position.
void DumpFunctionCalls()
Dump all function calls forwards chronologically and hierarchically.
A plug-in interface definition class for trace information.
virtual lldb::CommandObjectSP GetThreadTraceStartCommand(CommandInterpreter &interpreter)=0
Get the command handle for the "thread trace start" command.
#define LLDB_INVALID_LINE_NUMBER
#define LLDB_INVALID_THREAD_ID
#define LLDB_INVALID_INDEX32
#define LLDB_INVALID_ADDRESS
#define LLDB_INVALID_FRAME_ID
A class that represents a running process on the host machine.
std::vector< OptionArgElement > OptionElementVector
const char * StateAsCString(lldb::StateType state)
Converts a StateType to a C string.
const char * toString(AppleArm64ExceptionClass EC)
@ eStepTypeTraceOver
Single step one instruction, stepping over.
@ eStepTypeOut
Single step out a specified context.
@ eStepTypeScripted
A step type implemented by the script interpreter.
@ eStepTypeInto
Single step into a specified context.
@ eStepTypeOver
Single step over a specified context.
@ eStepTypeTrace
Single step one instruction.
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelVerbose
StateType
Process and Thread States.
@ eStateStopped
Process or thread is stopped and can be examined.
@ eStateSuspended
Process or thread is in a suspended state as far as the debugger is concerned while other processes o...
@ eStateRunning
Process or thread is running and can't be examined.
@ eStateCrashed
Process or thread has crashed and can be examined.
ExpressionResults
The results of expression evaluation.
@ eReturnStatusSuccessContinuingNoResult
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
@ eArgTypeUnsignedInteger
@ eTraceCursorSeekTypeEnd
The end of the trace, i.e the most recent item.
Used to build individual command argument lists.
ArgumentRepetitionType arg_repetition
lldb::CommandArgumentType arg_type
A line table entry class.
FileSpec file
The source file, possibly mapped by the target.source-map setting.
AddressRange range
The section offset address range for this line entry.
uint32_t line
The source line number, or zero if there is no line number information.
static int64_t ToOptionEnum(llvm::StringRef s, const OptionEnumValues &enum_values, int32_t fail_value, Status &error)
static lldb::addr_t ToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, lldb::addr_t fail_value, Status *error_ptr)
Try to parse an address.
static bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr)
Class that holds the configuration used by TraceDumper for traversing and dumping instructions.
bool show_control_flow_kind
For each instruction, print the instruction kind.
bool only_events
Dump events and none of the instructions.
bool show_timestamps
For each trace item, print the corresponding timestamp in nanoseconds if available.
std::optional< uint64_t > id
Optional custom id to start traversing from.
bool pretty_print_json
When dumping in JSON format, pretty print the output.
std::optional< size_t > skip
Optional number of instructions to skip from the starting position of the cursor.
bool json
Dump in json format.
bool show_events
Dump the events that happened between instructions.
bool raw
Dump only instruction addresses without disassembly nor symbol information.
bool forwards
If true, the cursor will be iterated forwards starting from the oldest instruction.
lldb::user_id_t GetID() const
Get accessor for the user ID.