38#include "llvm/ADT/ScopeExit.h"
49 const char *name,
const char *help,
50 const char *syntax, uint32_t flags,
51 const char *new_process_action)
68 llvm::formatv(
"There is a pending attach, abort it and {0}?",
71 message = llvm::formatv(
72 "There is a running process, detach from it and {0}?",
76 llvm::formatv(
"There is a running process, kill it and {0}?",
84 bool keep_stopped =
false;
91 "Failed to detach from process: %s\n",
114#pragma mark CommandObjectProcessLaunch
119 interpreter,
"process launch",
120 "Launch the executable in the debugger.", nullptr,
121 eCommandRequiresTarget,
"restart"),
138 arg.push_back(run_args_arg);
157 uint32_t index)
override {
159 return std::string(
"");
175 result.
AppendError(
"no file in target, create a debug target using the "
176 "'target create' command");
190 bool disable_aslr =
false;
228 llvm::StringRef target_settings_argv0 = target->
GetArg0();
230 if (!target_settings_argv0.empty()) {
232 target_settings_argv0);
235 exe_module_sp->GetPlatformFileSpec(),
false);
241 exe_module_sp->GetPlatformFileSpec(),
true);
258 if (
error.Success()) {
265 process_sp->SyncIOHandler(0, std::chrono::seconds(2));
271 if (!exe_module_sp) {
272 result.
AppendWarning(
"Could not get executable module after launch.");
275 const char *archname =
276 exe_module_sp->GetArchitecture().GetArchitectureName();
278 "Process %" PRIu64
" launched: '%s' (%s)\n", process_sp->GetID(),
279 exe_module_sp->GetFileSpec().GetPath().c_str(), archname);
284 llvm::StringRef data = stream.
GetString();
290 "no error returned from Target::Launch, and target has no process");
302#define LLDB_OPTIONS_process_attach
303#include "CommandOptions.inc"
305#pragma mark CommandObjectProcessAttach
310 interpreter,
"process attach",
"Attach to a process.",
311 "process attach <cmd-options>", 0,
"attach"),
326 GetDebugger().GetPlatformList().GetSelectedPlatform());
340 if (target ==
nullptr) {
349 target = new_target_sp.get();
350 if (target ==
nullptr ||
error.Fail()) {
373 if (
error.Success()) {
381 "no error returned from Target::Attach, and target has no process");
394 if (!old_exec_module_sp) {
396 if (new_exec_module_sp) {
397 new_exec_module_sp->GetFileSpec().GetPath(new_path,
PATH_MAX);
401 }
else if (old_exec_module_sp->GetFileSpec() !=
402 new_exec_module_sp->GetFileSpec()) {
405 old_exec_module_sp->GetFileSpec().GetPath(old_path,
PATH_MAX);
406 new_exec_module_sp->GetFileSpec().GetPath(new_path,
PATH_MAX);
409 "Executable module changed from \"%s\" to \"%s\".\n", old_path,
413 if (!old_arch_spec.
IsValid()) {
415 "Architecture set to: %s.\n",
419 "Architecture changed from %s to %s.\n",
420 old_arch_spec.
GetTriple().getTriple().c_str(),
442#define LLDB_OPTIONS_process_continue
443#include "CommandOptions.inc"
445#pragma mark CommandObjectProcessContinue
451 interpreter,
"process continue",
452 "Continue execution of all threads in the current process.",
454 eCommandRequiresProcess | eCommandTryTargetAPILock |
455 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {}
474 switch (short_option) {
476 if (option_arg.getAsInteger(0,
m_ignore))
477 error.SetErrorStringWithFormat(
478 "invalid value for ignore option: \"%s\", should be a number.",
479 option_arg.str().c_str());
486 llvm_unreachable(
"Unimplemented option");
498 return llvm::ArrayRef(g_process_continue_options);
514 StopInfoSP stop_info_sp = sel_thread_sp->GetStopInfo();
522 const size_t num_owners = bp_site_sp->GetNumberOfConstituents();
523 for (
size_t i = 0; i < num_owners; i++) {
525 bp_site_sp->GetConstituentAtIndex(i)->GetBreakpoint();
548 result.
AppendError(
"continue-to breakpoints did not specify any actual "
549 "breakpoints or locations");
555 size_t num_run_to_bkpt_ids = run_to_bkpt_ids.
GetSize();
556 std::vector<break_id_t> bkpts_disabled;
557 std::vector<BreakpointID> locs_disabled;
558 if (num_run_to_bkpt_ids != 0) {
564 std::unordered_set<break_id_t> bkpts_seen;
565 std::unordered_set<break_id_t> bkpts_with_locs_seen;
567 bool any_enabled =
false;
569 for (
size_t idx = 0; idx < num_run_to_bkpt_ids; idx++) {
577 if (bp_sp->IsEnabled()) {
581 size_t num_locations = bp_sp->GetNumLocations();
582 for (
size_t loc_idx = 0; loc_idx < num_locations; loc_idx++) {
584 = bp_sp->GetLocationAtIndex(loc_idx);
585 if (loc_sp->IsEnabled()) {
593 if (loc_sp->IsEnabled())
611 result.
AppendError(
"at least one of the continue-to breakpoints must "
620 for (
break_id_t bp_id : bkpts_with_locs_seen) {
621 if (bkpts_seen.count(bp_id)) {
623 "one of its locations: {0}", bp_id);
634 if (!bkpts_with_locs_seen.count(bp_id)) {
635 if (!bkpts_seen.count(bp_id) && bp_sp->IsEnabled()) {
636 bkpts_disabled.push_back(bp_id);
637 bp_sp->SetEnabled(
false);
644 size_t num_locations = bp_sp->GetNumLocations();
646 for (
size_t loc_idx = 0; loc_idx < num_locations; loc_idx++) {
651 && loc_sp->IsEnabled()) {
652 locs_disabled.push_back(tmp_id);
653 loc_sp->SetEnabled(
false);
660 std::lock_guard<std::recursive_mutex> guard(
665 for (uint32_t idx = 0; idx < num_threads; ++idx) {
666 const bool override_suspend =
false;
679 if (run_to_bkpt_ids.
GetSize() != 0) {
681 synchronous_execution =
true;
683 if (synchronous_execution)
688 if (run_to_bkpt_ids.
GetSize() != 0) {
697 bp_sp->SetEnabled(
true);
704 = bp_sp->FindLocationByID(bkpt_id.GetLocationID());
706 loc_sp->SetEnabled(
true);
710 if (
error.Success()) {
715 process->
SyncIOHandler(iohandler_id, std::chrono::seconds(2));
719 if (synchronous_execution) {
735 "Process cannot be continued from its current state (%s).\n",
746#define LLDB_OPTIONS_process_detach
747#include "CommandOptions.inc"
749#pragma mark CommandObjectProcessDetach
764 switch (short_option) {
770 error.SetErrorStringWithFormat(
"invalid boolean option: \"%s\"",
771 option_arg.str().c_str());
780 llvm_unreachable(
"Unimplemented option");
790 return llvm::ArrayRef(g_process_detach_options);
799 "Detach from the current target process.",
801 eCommandRequiresProcess | eCommandTryTargetAPILock |
802 eCommandProcessMustBeLaunched) {}
819 keep_stopped =
false;
822 if (
error.Success()) {
833#define LLDB_OPTIONS_process_connect
834#include "CommandOptions.inc"
836#pragma mark CommandObjectProcessConnect
855 switch (short_option) {
861 llvm_unreachable(
"Unimplemented option");
871 return llvm::ArrayRef(g_process_connect_options);
881 "Connect to a remote debug service.",
882 "process connect <remote-url>", 0) {
895 "'%s' takes exactly one argument:\nUsage: %s\n",
m_cmd_name.c_str(),
901 if (process && process->
IsAlive()) {
904 " is currently being debugged, kill the process before connecting.\n",
909 const char *plugin_name =
nullptr;
918 ? platform_sp->ConnectProcess(
921 : platform_sp->ConnectProcessSynchronous(
925 if (
error.Fail() || process_sp ==
nullptr) {
934#pragma mark CommandObjectProcessPlugin
940 interpreter,
"process plugin",
941 "Send a custom command to the current target process plug-in.",
942 "process plugin <args>", 0) {}
955#define LLDB_OPTIONS_process_load
956#include "CommandOptions.inc"
958#pragma mark CommandObjectProcessLoad
976 switch (short_option) {
979 if (!option_arg.empty())
983 llvm_unreachable(
"Unimplemented option");
994 return llvm::ArrayRef(g_process_load_options);
1004 "Load a shared library into the current process.",
1005 "process load <filename> [<filename> ...]",
1006 eCommandRequiresProcess | eCommandTryTargetAPILock |
1007 eCommandProcessMustBeLaunched |
1008 eCommandProcessMustBePaused) {
1031 for (
auto &entry : command.
entries()) {
1034 llvm::StringRef image_path = entry.ref();
1039 platform->ResolveRemotePath(image_spec, image_spec);
1041 platform->LoadImage(process,
FileSpec(), image_spec,
error);
1047 image_token = platform->LoadImage(process, image_spec,
1053 platform->LoadImage(process, image_spec,
FileSpec(),
error);
1058 "Loading \"%s\"...ok\nImage %u loaded.\n", image_path.str().c_str(),
1063 image_path.str().c_str(),
1073#pragma mark CommandObjectProcessUnload
1079 interpreter,
"process unload",
1080 "Unload a shared library from the current process using the index "
1081 "returned by a previous call to \"process load\".",
1082 "process unload <index>",
1083 eCommandRequiresProcess | eCommandTryTargetAPILock |
1084 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {
1100 const std::vector<lldb::addr_t> &tokens = process->
GetImageTokens();
1101 const size_t token_num = tokens.size();
1102 for (
size_t i = 0; i < token_num; ++i) {
1113 for (
auto &entry : command.
entries()) {
1114 uint32_t image_token;
1115 if (entry.ref().getAsInteger(0, image_token)) {
1117 entry.ref().str().c_str());
1121 process, image_token));
1122 if (
error.Success()) {
1124 "Unloading shared library with index %u...ok\n", image_token);
1137#pragma mark CommandObjectProcessSignal
1143 interpreter,
"process signal",
1144 "Send a UNIX signal to the current target process.", nullptr,
1145 eCommandRequiresProcess | eCommandTryTargetAPILock) {
1155 arg.push_back(signal_arg);
1170 int signo = signals->GetFirstSignalNumber();
1173 signo = signals->GetNextSignalNumber(signo);
1185 if (::isxdigit(signal_name[0])) {
1186 if (!llvm::to_integer(signal_name, signo))
1189 signo = process->
GetUnixSignals()->GetSignalNumberFromName(signal_name);
1196 if (
error.Success()) {
1205 "'%s' takes exactly one signal number argument:\nUsage: %s\n",
1212#pragma mark CommandObjectProcessInterrupt
1218 "Interrupt the current target process.",
1219 "process interrupt",
1220 eCommandRequiresProcess | eCommandTryTargetAPILock |
1221 eCommandProcessMustBeLaunched) {}
1228 if (process ==
nullptr) {
1233 bool clear_thread_plans =
true;
1235 if (
error.Success()) {
1245#pragma mark CommandObjectProcessKill
1251 "Terminate the current target process.",
1253 eCommandRequiresProcess | eCommandTryTargetAPILock |
1254 eCommandProcessMustBeLaunched) {}
1261 if (process ==
nullptr) {
1267 if (
error.Success()) {
1276#define LLDB_OPTIONS_process_save_core
1277#include "CommandOptions.inc"
1283 interpreter,
"process save-core",
1284 "Save the current process as a core file using an "
1285 "appropriate file type.",
1286 "process save-core [-s corefile-style -p plugin-name] FILE",
1287 eCommandRequiresProcess | eCommandTryTargetAPILock |
1288 eCommandProcessMustBeLaunched) {
1311 return llvm::ArrayRef(g_process_save_core_options);
1319 switch (short_option) {
1330 llvm_unreachable(
"Unimplemented option");
1357 if (
error.Success()) {
1358 if (corefile_style == SaveCoreStyle::eSaveCoreDirtyOnly ||
1359 corefile_style == SaveCoreStyle::eSaveCoreStackOnly) {
1361 "\nModified-memory or stack-memory only corefile "
1362 "created. This corefile may \n"
1363 "not show library/framework/app binaries "
1364 "on a different system, or when \n"
1365 "those binaries have "
1366 "been updated/modified. Copies are not included\n"
1367 "in this corefile. Use --style full to include all "
1368 "process memory.\n");
1373 "Failed to save core file for process: %s\n",
error.AsCString());
1388#pragma mark CommandObjectProcessStatus
1389#define LLDB_OPTIONS_process_status
1390#include "CommandOptions.inc"
1396 interpreter,
"process status",
1397 "Show status and stop location for the current target process.",
1399 eCommandRequiresProcess | eCommandTryTargetAPILock) {}
1415 switch (short_option) {
1420 llvm_unreachable(
"Unimplemented option");
1431 return llvm::ArrayRef(g_process_status_options);
1446 const bool only_threads_with_stop_reason =
true;
1447 const uint32_t start_frame = 0;
1448 const uint32_t num_frames = 1;
1449 const uint32_t num_frames_with_source = 1;
1450 const bool stop_format =
true;
1452 process->
GetThreadStatus(strm, only_threads_with_stop_reason, start_frame,
1453 num_frames, num_frames_with_source, stop_format);
1458 if (code_mask != 0) {
1459 int bits = std::bitset<64>(~code_mask).count();
1461 "Addressable code address mask: 0x%" PRIx64
"\n", code_mask);
1463 "Addressable data address mask: 0x%" PRIx64
"\n", data_mask);
1465 "Number of bits used in addressing (code): %d\n",
bits);
1470 result.
AppendError(
"Couldn'retrieve the target's platform");
1474 auto expected_crash_info =
1475 platform_sp->FetchExtendedCrashInformation(*process);
1477 if (!expected_crash_info) {
1478 result.
AppendError(llvm::toString(expected_crash_info.takeError()));
1484 if (crash_info_sp) {
1486 strm.
PutCString(
"Extended Crash Information:\n");
1487 crash_info_sp->GetDescription(strm);
1497#define LLDB_OPTIONS_process_handle
1498#include "CommandOptions.inc"
1500#pragma mark CommandObjectProcessHandle
1515 switch (short_option) {
1523 stop = std::string(option_arg);
1526 notify = std::string(option_arg);
1529 pass = std::string(option_arg);
1535 llvm_unreachable(
"Unimplemented option");
1550 return llvm::ArrayRef(g_process_handle_options);
1565 "Manage LLDB handling of OS signals for the "
1566 "current target process. Defaults to showing "
1569 SetHelpLong(
"\nIf no signals are specified but one or more actions are, "
1570 "and there is a live process, update them all. If no action "
1571 "is specified, list the current values.\n"
1572 "If you specify actions with no target (e.g. in an init file) "
1573 "or in a target with no process "
1574 "the values will get copied into subsequent targets, but "
1575 "lldb won't be able to spell-check the options since it can't "
1576 "know which signal set will later be in force."
1577 "\nYou can see the signal modifications held by the target"
1578 "by passing the -t option."
1579 "\nYou can also clear the target modification for a signal"
1580 "by passing the -c option");
1587 arg.push_back(signal_arg);
1598 bool success =
false;
1601 if (success && tmp_value)
1603 else if (success && !tmp_value)
1607 if (!llvm::to_integer(option, real_value))
1609 if (real_value != 0 && real_value != 1)
1617 str.
Printf(
"NAME PASS STOP NOTIFY\n");
1618 str.
Printf(
"=========== ===== ===== ======\n");
1627 str.
Format(
"{0, -11} ", sig_name);
1628 if (signals_sp->GetSignalInfo(signo, suppress, stop, notify)) {
1629 bool pass = !suppress;
1630 str.
Printf(
"%s %s %s", (pass ?
"true " :
"false"),
1631 (stop ?
"true " :
"false"), (notify ?
"true " :
"false"));
1637 int num_valid_signals,
1641 if (num_valid_signals > 0) {
1643 for (
size_t i = 0; i < num_args; ++i) {
1644 int32_t signo = signals_sp->GetSignalNumberFromName(
1652 int32_t signo = signals_sp->GetFirstSignalNumber();
1654 PrintSignal(str, signo, signals_sp->GetSignalAsStringRef(signo),
1656 signo = signals_sp->GetNextSignalNumber(signo);
1671 int stop_action = -1;
1672 int pass_action = -1;
1673 int notify_action = -1;
1677 result.
AppendError(
"Invalid argument for command option --stop; must be "
1678 "true or false.\n");
1684 result.
AppendError(
"Invalid argument for command option --notify; must "
1685 "be true or false.\n");
1691 result.
AppendError(
"Invalid argument for command option --pass; must be "
1692 "true or false.\n");
1696 bool no_actions = (stop_action == -1 && pass_action == -1
1697 && notify_action == -1);
1699 result.
AppendError(
"-t is for reporting, not setting, target values.");
1706 signals_sp = process_sp->GetUnixSignals();
1708 int num_signals_set = 0;
1729 for (
const auto &arg : signal_args) {
1733 int32_t signo = signals_sp->GetSignalNumberFromName(arg.c_str());
1737 if (stop_action != -1)
1738 signals_sp->SetShouldStop(signo, stop_action);
1739 if (pass_action != -1) {
1740 bool suppress = !pass_action;
1741 signals_sp->SetShouldSuppress(signo, suppress);
1743 if (notify_action != -1)
1744 signals_sp->SetShouldNotify(signo, notify_action);
1757 if (llvm::to_integer(arg.c_str(), signo)) {
1759 "number with no process");
1762 num_signals_set = num_args;
1764 auto set_lazy_bool = [] (
int action) ->
LazyBool {
1778 set_lazy_bool(pass_action),
1779 set_lazy_bool(notify_action),
1780 set_lazy_bool(stop_action));
1786 if (((notify_action != -1) || (stop_action != -1) || (pass_action != -1))
1789 "Do you really want to update all the signals?",
false)) {
1790 int32_t signo = signals_sp->GetFirstSignalNumber();
1792 if (notify_action != -1)
1793 signals_sp->SetShouldNotify(signo, notify_action);
1794 if (stop_action != -1)
1795 signals_sp->SetShouldStop(signo, stop_action);
1796 if (pass_action != -1) {
1797 bool suppress = !pass_action;
1798 signals_sp->SetShouldSuppress(signo, suppress);
1800 signo = signals_sp->GetNextSignalNumber(signo);
1808 num_signals_set, signals_sp);
1813 if (num_signals_set > 0)
1830 "process trace start",
1831 "Start tracing this process with the corresponding trace "
1833 "process trace start [<trace-options>]") {}
1846 "Stop tracing this process. This does not affect "
1847 "traces started with the "
1848 "\"thread trace start\" command.",
1849 "process trace stop",
1850 eCommandRequiresProcess | eCommandTryTargetAPILock |
1851 eCommandProcessMustBeLaunched |
1852 eCommandProcessMustBePaused |
1853 eCommandProcessMustBeTraced) {}
1860 TraceSP trace_sp = process_sp->GetTarget().GetTrace();
1862 if (llvm::Error err = trace_sp->Stop())
1874 interpreter,
"trace",
"Commands for tracing the current process.",
1875 "process trace <subcommand> [<subcommand objects>]") {
1890 interpreter,
"process",
1891 "Commands for interacting with processes on the current platform.",
1892 "process <subcommand> [<subcommand-options>]") {
static llvm::raw_ostream & error(Stream &strm)
~CommandObjectMultiwordProcessTrace() override=default
CommandObjectMultiwordProcessTrace(CommandInterpreter &interpreter)
CommandOptionsProcessAttach m_options
~CommandObjectProcessAttach() override=default
OptionGroupOptions m_all_options
OptionGroupPythonClassWithDict m_class_options
CommandObjectProcessAttach(CommandInterpreter &interpreter)
Options * GetOptions() override
void DoExecute(Args &command, CommandReturnObject &result) 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
~CommandObjectProcessConnect() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectProcessConnect(CommandInterpreter &interpreter)
Options * GetOptions() override
~CommandOptions() override=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *exe_ctx) override
Set the value of an option.
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
bool m_any_bkpts_specified
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectProcessContinue(CommandInterpreter &interpreter)
~CommandObjectProcessContinue() override=default
Options * GetOptions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
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.
~CommandOptions() override=default
Options * GetOptions() override
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectProcessDetach(CommandInterpreter &interpreter)
~CommandObjectProcessDetach() override=default
~CommandOptions() override=default
void OptionParsingStarting(ExecutionContext *execution_context) override
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.
bool VerifyCommandOptionValue(const std::string &option, int &real_value)
CommandObjectProcessHandle(CommandInterpreter &interpreter)
~CommandObjectProcessHandle() override=default
void PrintSignalHeader(Stream &str)
Options * GetOptions() override
void DoExecute(Args &signal_args, CommandReturnObject &result) override
void PrintSignalInformation(Stream &str, Args &signal_args, int num_valid_signals, const UnixSignalsSP &signals_sp)
void PrintSignal(Stream &str, int32_t signo, llvm::StringRef sig_name, const UnixSignalsSP &signals_sp)
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectProcessInterrupt(CommandInterpreter &interpreter)
~CommandObjectProcessInterrupt() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectProcessKill() override=default
CommandObjectProcessKill(CommandInterpreter &interpreter)
std::string m_new_process_action
bool StopProcessIfNecessary(Process *process, StateType &state, CommandReturnObject &result)
CommandObjectProcessLaunchOrAttach(CommandInterpreter &interpreter, const char *name, const char *help, const char *syntax, uint32_t flags, const char *new_process_action)
~CommandObjectProcessLaunchOrAttach() override=default
void DoExecute(Args &launch_args, CommandReturnObject &result) override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
OptionGroupPythonClassWithDict m_class_options
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.
OptionGroupOptions m_all_options
~CommandObjectProcessLaunch() override=default
Options * GetOptions() override
CommandOptionsProcessLaunch m_options
CommandObjectProcessLaunch(CommandInterpreter &interpreter)
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.
~CommandOptions() override=default
void OptionParsingStarting(ExecutionContext *execution_context) override
~CommandObjectProcessLoad() override=default
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
void DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
CommandObjectProcessLoad(CommandInterpreter &interpreter)
~CommandObjectProcessPlugin() override=default
CommandObjectProcessPlugin(CommandInterpreter &interpreter)
CommandObject * GetProxyCommandObject() override
void OptionParsingStarting(ExecutionContext *execution_context) override
SaveCoreStyle m_requested_save_core_style
~CommandOptions() override=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
std::string m_requested_plugin_name
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
Options * GetOptions() override
~CommandObjectProcessSaveCore() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectProcessSaveCore(CommandInterpreter &interpreter)
CommandObjectProcessSignal(CommandInterpreter &interpreter)
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
~CommandObjectProcessSignal() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
~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
CommandObjectProcessStatus(CommandInterpreter &interpreter)
~CommandObjectProcessStatus() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectProcessTraceStart(CommandInterpreter &interpreter)
lldb::CommandObjectSP GetDelegateCommand(Trace &trace) override
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectProcessTraceStop(CommandInterpreter &interpreter)
~CommandObjectProcessTraceStop() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectProcessUnload(CommandInterpreter &interpreter)
~CommandObjectProcessUnload() override=default
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
An architecture specification class.
bool IsValid() const
Tests if this ArchSpec is valid.
llvm::Triple & GetTriple()
Architecture triple accessor.
bool IsExactMatch(const ArchSpec &rhs) const
Shorthand for IsMatch(rhs, ExactMatch).
A command line argument class.
void AppendArguments(const Args &rhs)
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
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.
void Clear()
Clear the arguments.
const BreakpointID & GetBreakpointIDAtIndex(size_t index) const
bool AddBreakpointID(BreakpointID bp_id)
bool FindBreakpointID(BreakpointID &bp_id, size_t *position) const
void SetBreakpointLocationID(lldb::break_id_t loc_id)
lldb::break_id_t GetBreakpointID() const
lldb::break_id_t GetLocationID() const
General Outline: Allows adding and removing breakpoints and find by ID and index.
BreakpointIterable Breakpoints()
lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID) const
Returns a shared pointer to the breakpoint with id breakID.
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
void SetIgnoreCount(uint32_t count)
Set the breakpoint to ignore the next count breakpoint hits.
bool IsInternal() const
Tell whether this breakpoint is an "internal" breakpoint.
static bool InvokeCommonCompletionCallbacks(CommandInterpreter &interpreter, uint32_t completion_mask, lldb_private::CompletionRequest &request, SearchFilter *searcher)
bool Confirm(llvm::StringRef message, bool default_answer)
bool HandleCommand(const char *command_line, LazyBool add_to_history, const ExecutionContext &override_context, CommandReturnObject &result)
ExecutionContext GetExecutionContext() const
lldb::PlatformSP GetPlatform(bool prefer_target_platform)
static void VerifyBreakpointOrLocationIDs(Args &args, Target *target, CommandReturnObject &result, BreakpointIDList *valid_ids, BreakpointName::Permissions ::PermissionKinds purpose)
CommandObjectMultiwordProcess(CommandInterpreter &interpreter)
~CommandObjectMultiwordProcess() 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
virtual void SetHelpLong(llvm::StringRef str)
Target & GetDummyTarget()
ExecutionContext m_exe_ctx
std::vector< CommandArgumentEntry > m_arguments
CommandInterpreter & GetCommandInterpreter()
CommandInterpreter & m_interpreter
Thread * GetDefaultThread()
Target & GetSelectedOrDummyTarget(bool prefer_dummy=false)
lldb_private::ProcessAttachInfo attach_info
lldb_private::LazyBool disable_aslr
lldb_private::ProcessLaunchInfo launch_info
void AppendErrorWithFormatv(const char *format, Args &&... args)
void AppendMessage(llvm::StringRef in_string)
void void AppendError(llvm::StringRef in_string)
void AppendWarningWithFormat(const char *format,...) __attribute__((format(printf
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)
Stream & GetOutputStream()
"lldb/Utility/ArgCompletionRequest.h"
void TryCompleteCurrentArg(llvm::StringRef completion, llvm::StringRef description="")
Adds a possible completion string if the completion would complete the current argument.
size_t GetCursorIndex() const
A class to manage flag bits.
lldb::TargetSP GetSelectedTarget()
void SetAsyncExecution(bool async)
TargetList & GetTargetList()
Get accessor for the target list.
std::pair< iterator, bool > insert(llvm::StringRef KeyEqValue)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
bool HasProcessScope() const
Returns true the ExecutionContext object contains a valid target and process.
const lldb::ProcessSP & GetProcessSP() const
Get accessor to get the process shared pointer.
Target * GetTargetPtr() const
Returns a pointer to the target object.
Process * GetProcessPtr() const
Returns a pointer to the process object.
void SetFile(llvm::StringRef path, Style style, const Checksum &checksum={})
Change the file specified with a new path.
void Clear()
Clears the object state.
void Resolve(llvm::SmallVectorImpl< char > &path)
Resolve path to make it canonical.
static FileSystem & Instance()
ValueType Clear(ValueType mask=~static_cast< ValueType >(0))
Clear one or more flags.
ValueType Set(ValueType mask)
Set one or more flags by logical OR'ing mask with the current flags.
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 Status SaveCore(const lldb::ProcessSP &process_sp, const FileSpec &outfile, lldb::SaveCoreStyle &core_style, llvm::StringRef plugin_name)
void SetProcessPluginName(llvm::StringRef plugin)
bool GetContinueOnceAttached() const
void SetExecutableFile(const FileSpec &exe_file, bool add_exe_file_as_first_arg)
void SetScriptedMetadata(lldb::ScriptedMetadataSP metadata_sp)
FileSpec & GetExecutableFile()
Environment & GetEnvironment()
void SetProcessPluginName(llvm::StringRef plugin)
bool GetDetachKeepsStopped() const
A plug-in interface definition class for debugging a process.
StopPointSiteList< lldb_private::BreakpointSite > & GetBreakpointSiteList()
lldb::pid_t GetID() const
Returns the pid of the process or LLDB_INVALID_PROCESS_ID if there is no known pid.
Status Destroy(bool force_kill)
Kills the process and shuts down all threads that were spawned to track and monitor the process.
ThreadList & GetThreadList()
Status Resume()
Resumes all of a process's threads as configured using the Thread run control functions.
Status ResumeSynchronous(Stream *stream)
Resume a process, and wait for it to stop.
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)
Status Detach(bool keep_stopped)
Detaches from a running or stopped process.
Status Signal(int signal)
Sends a process a UNIX signal signal.
lldb::StateType GetState()
Get accessor for the current process state.
void GetStatus(Stream &ostrm)
uint32_t GetIOHandlerID() const
bool GetShouldDetach() const
const std::vector< lldb::addr_t > & GetImageTokens()
Get the image vector for the current process.
virtual bool IsAlive()
Check if a process is still alive.
virtual CommandObject * GetPluginCommandObject()
Return a multi-word command object that can be used to expose plug-in specific commands.
void SyncIOHandler(uint32_t iohandler_id, const Timeout< std::micro > &timeout)
Waits for the process state to be running within a given msec timeout.
lldb::addr_t GetDataAddressMask()
const lldb::UnixSignalsSP & GetUnixSignals()
lldb::addr_t GetCodeAddressMask()
Status Halt(bool clear_thread_plans=false, bool use_run_lock=true)
Halts a running process.
Target & GetTarget()
Get the target object pointer for this module.
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
bool Success() const
Test for success condition.
StopPointSiteSP FindByID(typename StopPointSite::SiteID site_id)
Returns a shared pointer to the site with id site_id.
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
void Format(const char *format, Args &&... args)
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
size_t EOL()
Output and End of Line character to the stream.
std::shared_ptr< Dictionary > DictionarySP
Status CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, llvm::StringRef triple_str, LoadDependentFiles get_dependent_modules, const OptionGroupPlatform *platform_options, lldb::TargetSP &target_sp)
Create a new Target.
bool GetDisableSTDIO() const
llvm::StringRef GetArg0() const
void SetRunArguments(const Args &args)
bool GetDisableASLR() const
const ProcessLaunchInfo & GetProcessLaunchInfo() const
bool GetInheritTCC() const
Environment GetEnvironment() const
void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info)
bool GetDetachOnError() const
void ClearDummySignals(Args &signal_names)
Clear the dummy signals in signal_names from the target, or all signals if signal_names is empty.
BreakpointList & GetBreakpointList(bool internal=false)
const lldb::ProcessSP & GetProcessSP() const
Status Launch(ProcessLaunchInfo &launch_info, Stream *stream)
lldb::ModuleSP GetExecutableModule()
Gets the module for the main executable.
lldb::PlatformSP GetPlatform()
const ArchSpec & GetArchitecture() const
void AddDummySignal(llvm::StringRef name, LazyBool pass, LazyBool print, LazyBool stop)
Add a signal to the Target's list of stored signals/actions.
void PrintDummySignals(Stream &strm, Args &signals)
Print all the signals set in this target.
Status Attach(ProcessAttachInfo &attach_info, Stream *stream)
uint32_t GetSize(bool can_update=true)
lldb::ThreadSP GetThreadAtIndex(uint32_t idx, bool can_update=true)
std::recursive_mutex & GetMutex() const override
A plug-in interface definition class for trace information.
virtual lldb::CommandObjectSP GetProcessTraceStartCommand(CommandInterpreter &interpreter)=0
Get the command handle for the "process trace start" command.
#define LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_SIGNAL_NUMBER
#define LLDB_INVALID_IMAGE_TOKEN
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)
static uint32_t bits(const uint32_t val, const uint32_t msbit, const uint32_t lsbit)
std::shared_ptr< lldb_private::Trace > TraceSP
std::shared_ptr< lldb_private::BreakpointSite > BreakpointSiteSP
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ScriptedMetadata > ScriptedMetadataSP
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
std::shared_ptr< lldb_private::UnixSignals > UnixSignalsSP
std::shared_ptr< lldb_private::Platform > PlatformSP
StateType
Process and Thread States.
@ eStateConnected
Process is connected to remote debug services, but not launched or attached to anything yet.
@ eStateStopped
Process or thread is stopped and can be examined.
@ eStateRunning
Process or thread is running and can't be examined.
@ eStateAttaching
Process is currently trying to attach.
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
std::shared_ptr< lldb_private::Process > ProcessSP
@ eReturnStatusSuccessContinuingNoResult
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
@ eArgTypeUnsignedInteger
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::Module > ModuleSP
Used to build individual command argument lists.
ArgumentRepetitionType arg_repetition
lldb::CommandArgumentType arg_type
static int64_t ToOptionEnum(llvm::StringRef s, const OptionEnumValues &enum_values, int32_t fail_value, Status &error)
static bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr)