36#include "llvm/ADT/ScopeExit.h"
47 const char *name,
const char *help,
49 const char *new_process_action)
66 llvm::formatv(
"There is a pending attach, abort it and {0}?",
69 message = llvm::formatv(
70 "There is a running process, detach from it and {0}?",
74 llvm::formatv(
"There is a running process, kill it and {0}?",
82 bool keep_stopped =
false;
89 "Failed to detach from process: %s\n",
112#pragma mark CommandObjectProcessLaunch
117 interpreter,
"process launch",
118 "Launch the executable in the debugger.", nullptr,
119 eCommandRequiresTarget,
"restart"),
136 arg.push_back(run_args_arg);
158 return std::string(
"");
174 result.
AppendError(
"no file in target, create a debug target using the "
175 "'target create' command");
189 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));
267 llvm::StringRef data = stream.
GetString();
274 if (!exe_module_sp) {
275 result.
AppendWarning(
"Could not get executable module after launch.");
278 const char *archname =
279 exe_module_sp->GetArchitecture().GetArchitectureName();
281 "Process %" PRIu64
" launched: '%s' (%s)\n", process_sp->GetID(),
282 exe_module_sp->GetFileSpec().GetPath().c_str(), archname);
288 "no error returned from Target::Launch, and target has no process");
301#define LLDB_OPTIONS_process_attach
302#include "CommandOptions.inc"
304#pragma mark CommandObjectProcessAttach
321 switch (short_option) {
328 if (option_arg.getAsInteger(0, pid)) {
329 error.SetErrorStringWithFormat(
"invalid process ID '%s'",
330 option_arg.str().c_str());
342 FileSpec::Style::native);
354 llvm_unreachable(
"Unimplemented option");
364 return llvm::ArrayRef(g_process_attach_options);
372 interpreter,
"process attach",
"Attach to a process.",
373 "process attach <cmd-options>", 0,
"attach") {}
381 PlatformSP platform_sp(
382 GetDebugger().GetPlatformList().GetSelectedPlatform());
396 if (target ==
nullptr) {
398 TargetSP new_target_sp;
405 target = new_target_sp.get();
406 if (target ==
nullptr ||
error.Fail()) {
420 ProcessSP process_sp;
422 if (
error.Success()) {
430 "no error returned from Target::Attach, and target has no process");
443 if (!old_exec_module_sp) {
445 if (new_exec_module_sp) {
446 new_exec_module_sp->GetFileSpec().GetPath(new_path,
PATH_MAX);
450 }
else if (old_exec_module_sp->GetFileSpec() !=
451 new_exec_module_sp->GetFileSpec()) {
454 old_exec_module_sp->GetFileSpec().GetPath(old_path,
PATH_MAX);
455 new_exec_module_sp->GetFileSpec().GetPath(new_path,
PATH_MAX);
458 "Executable module changed from \"%s\" to \"%s\".\n", old_path,
462 if (!old_arch_spec.
IsValid()) {
464 "Architecture set to: %s.\n",
468 "Architecture changed from %s to %s.\n",
469 old_arch_spec.
GetTriple().getTriple().c_str(),
491#define LLDB_OPTIONS_process_continue
492#include "CommandOptions.inc"
494#pragma mark CommandObjectProcessContinue
500 interpreter,
"process continue",
501 "Continue execution of all threads in the current process.",
503 eCommandRequiresProcess | eCommandTryTargetAPILock |
504 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {}
523 switch (short_option) {
525 if (option_arg.getAsInteger(0,
m_ignore))
526 error.SetErrorStringWithFormat(
527 "invalid value for ignore option: \"%s\", should be a number.",
528 option_arg.str().c_str());
535 llvm_unreachable(
"Unimplemented option");
547 return llvm::ArrayRef(g_process_continue_options);
564 StopInfoSP stop_info_sp = sel_thread_sp->GetStopInfo();
569 BreakpointSiteSP bp_site_sp(
572 const size_t num_owners = bp_site_sp->GetNumberOfOwners();
573 for (
size_t i = 0; i < num_owners; i++) {
575 bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint();
598 result.
AppendError(
"continue-to breakpoints did not specify any actual "
599 "breakpoints or locations");
605 size_t num_run_to_bkpt_ids = run_to_bkpt_ids.
GetSize();
606 std::vector<break_id_t> bkpts_disabled;
607 std::vector<BreakpointID> locs_disabled;
608 if (num_run_to_bkpt_ids != 0) {
614 std::unordered_set<break_id_t> bkpts_seen;
615 std::unordered_set<break_id_t> bkpts_with_locs_seen;
617 bool any_enabled =
false;
619 for (
size_t idx = 0; idx < num_run_to_bkpt_ids; idx++) {
627 if (bp_sp->IsEnabled()) {
631 size_t num_locations = bp_sp->GetNumLocations();
632 for (
size_t loc_idx = 0; loc_idx < num_locations; loc_idx++) {
633 BreakpointLocationSP loc_sp
634 = bp_sp->GetLocationAtIndex(loc_idx);
635 if (loc_sp->IsEnabled()) {
642 BreakpointLocationSP loc_sp = bp_sp->FindLocationByID(loc_id);
643 if (loc_sp->IsEnabled())
661 result.
AppendError(
"at least one of the continue-to breakpoints must "
670 for (
break_id_t bp_id : bkpts_with_locs_seen) {
671 if (bkpts_seen.count(bp_id)) {
673 "one of its locations: {0}", bp_id);
679 for (BreakpointSP bp_sp : bkpt_list.
Breakpoints()) {
684 if (!bkpts_with_locs_seen.count(bp_id)) {
685 if (!bkpts_seen.count(bp_id) && bp_sp->IsEnabled()) {
686 bkpts_disabled.push_back(bp_id);
687 bp_sp->SetEnabled(
false);
694 size_t num_locations = bp_sp->GetNumLocations();
696 for (
size_t loc_idx = 0; loc_idx < num_locations; loc_idx++) {
697 BreakpointLocationSP loc_sp = bp_sp->GetLocationAtIndex(loc_idx);
701 && loc_sp->IsEnabled()) {
702 locs_disabled.push_back(tmp_id);
703 loc_sp->SetEnabled(
false);
710 std::lock_guard<std::recursive_mutex> guard(
715 for (
uint32_t idx = 0; idx < num_threads; ++idx) {
716 const bool override_suspend =
false;
729 if (run_to_bkpt_ids.
GetSize() != 0) {
731 synchronous_execution =
true;
733 if (synchronous_execution)
738 if (run_to_bkpt_ids.
GetSize() != 0) {
747 bp_sp->SetEnabled(
true);
753 BreakpointLocationSP loc_sp
754 = bp_sp->FindLocationByID(bkpt_id.GetLocationID());
756 loc_sp->SetEnabled(
true);
760 if (
error.Success()) {
765 process->
SyncIOHandler(iohandler_id, std::chrono::seconds(2));
769 if (synchronous_execution) {
785 "Process cannot be continued from its current state (%s).\n",
797#define LLDB_OPTIONS_process_detach
798#include "CommandOptions.inc"
800#pragma mark CommandObjectProcessDetach
815 switch (short_option) {
821 error.SetErrorStringWithFormat(
"invalid boolean option: \"%s\"",
822 option_arg.str().c_str());
831 llvm_unreachable(
"Unimplemented option");
841 return llvm::ArrayRef(g_process_detach_options);
850 "Detach from the current target process.",
852 eCommandRequiresProcess | eCommandTryTargetAPILock |
853 eCommandProcessMustBeLaunched) {}
870 keep_stopped =
false;
873 if (
error.Success()) {
886#define LLDB_OPTIONS_process_connect
887#include "CommandOptions.inc"
889#pragma mark CommandObjectProcessConnect
908 switch (short_option) {
914 llvm_unreachable(
"Unimplemented option");
924 return llvm::ArrayRef(g_process_connect_options);
934 "Connect to a remote debug service.",
935 "process connect <remote-url>", 0) {
948 "'%s' takes exactly one argument:\nUsage: %s\n",
m_cmd_name.c_str(),
954 if (process && process->
IsAlive()) {
957 " is currently being debugged, kill the process before connecting.\n",
962 const char *plugin_name =
nullptr;
969 ProcessSP process_sp =
971 ? platform_sp->ConnectProcess(
974 : platform_sp->ConnectProcessSynchronous(
978 if (
error.Fail() || process_sp ==
nullptr) {
989#pragma mark CommandObjectProcessPlugin
995 interpreter,
"process plugin",
996 "Send a custom command to the current target process plug-in.",
997 "process plugin <args>", 0) {}
1010#define LLDB_OPTIONS_process_load
1011#include "CommandOptions.inc"
1013#pragma mark CommandObjectProcessLoad
1031 switch (short_option) {
1034 if (!option_arg.empty())
1038 llvm_unreachable(
"Unimplemented option");
1049 return llvm::ArrayRef(g_process_load_options);
1059 "Load a shared library into the current process.",
1060 "process load <filename> [<filename> ...]",
1061 eCommandRequiresProcess | eCommandTryTargetAPILock |
1062 eCommandProcessMustBeLaunched |
1063 eCommandProcessMustBePaused) {
1087 for (
auto &entry : command.
entries()) {
1090 llvm::StringRef image_path = entry.ref();
1095 platform->ResolveRemotePath(image_spec, image_spec);
1097 platform->LoadImage(process,
FileSpec(), image_spec,
error);
1103 image_token = platform->LoadImage(process, image_spec,
1109 platform->LoadImage(process, image_spec,
FileSpec(),
error);
1114 "Loading \"%s\"...ok\nImage %u loaded.\n", image_path.str().c_str(),
1119 image_path.str().c_str(),
1130#pragma mark CommandObjectProcessUnload
1136 interpreter,
"process unload",
1137 "Unload a shared library from the current process using the index "
1138 "returned by a previous call to \"process load\".",
1139 "process unload <index>",
1140 eCommandRequiresProcess | eCommandTryTargetAPILock |
1141 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {
1157 const std::vector<lldb::addr_t> &tokens = process->
GetImageTokens();
1158 const size_t token_num = tokens.size();
1159 for (
size_t i = 0; i < token_num; ++i) {
1170 for (
auto &entry : command.
entries()) {
1172 if (entry.ref().getAsInteger(0, image_token)) {
1174 entry.ref().str().c_str());
1178 process, image_token));
1179 if (
error.Success()) {
1181 "Unloading shared library with index %u...ok\n", image_token);
1195#pragma mark CommandObjectProcessSignal
1201 interpreter,
"process signal",
1202 "Send a UNIX signal to the current target process.", nullptr,
1203 eCommandRequiresProcess | eCommandTryTargetAPILock) {
1213 arg.push_back(signal_arg);
1228 int signo = signals->GetFirstSignalNumber();
1231 signo = signals->GetNextSignalNumber(signo);
1243 if (::isxdigit(signal_name[0])) {
1244 if (!llvm::to_integer(signal_name, signo))
1247 signo = process->
GetUnixSignals()->GetSignalNumberFromName(signal_name);
1254 if (
error.Success()) {
1263 "'%s' takes exactly one signal number argument:\nUsage: %s\n",
1271#pragma mark CommandObjectProcessInterrupt
1277 "Interrupt the current target process.",
1278 "process interrupt",
1279 eCommandRequiresProcess | eCommandTryTargetAPILock |
1280 eCommandProcessMustBeLaunched) {}
1287 if (process ==
nullptr) {
1292 bool clear_thread_plans =
true;
1294 if (
error.Success()) {
1305#pragma mark CommandObjectProcessKill
1311 "Terminate the current target process.",
1313 eCommandRequiresProcess | eCommandTryTargetAPILock |
1314 eCommandProcessMustBeLaunched) {}
1321 if (process ==
nullptr) {
1327 if (
error.Success()) {
1337#define LLDB_OPTIONS_process_save_core
1338#include "CommandOptions.inc"
1344 interpreter,
"process save-core",
1345 "Save the current process as a core file using an "
1346 "appropriate file type.",
1347 "process save-core [-s corefile-style -p plugin-name] FILE",
1348 eCommandRequiresProcess | eCommandTryTargetAPILock |
1349 eCommandProcessMustBeLaunched) {
1365 return llvm::ArrayRef(g_process_save_core_options);
1373 switch (short_option) {
1384 llvm_unreachable(
"Unimplemented option");
1410 if (
error.Success()) {
1411 if (corefile_style == SaveCoreStyle::eSaveCoreDirtyOnly ||
1412 corefile_style == SaveCoreStyle::eSaveCoreStackOnly) {
1414 "\nModified-memory or stack-memory only corefile "
1415 "created. This corefile may \n"
1416 "not show library/framework/app binaries "
1417 "on a different system, or when \n"
1418 "those binaries have "
1419 "been updated/modified. Copies are not included\n"
1420 "in this corefile. Use --style full to include all "
1421 "process memory.\n");
1426 "Failed to save core file for process: %s\n",
error.AsCString());
1444#pragma mark CommandObjectProcessStatus
1445#define LLDB_OPTIONS_process_status
1446#include "CommandOptions.inc"
1452 interpreter,
"process status",
1453 "Show status and stop location for the current target process.",
1455 eCommandRequiresProcess | eCommandTryTargetAPILock) {}
1471 switch (short_option) {
1476 llvm_unreachable(
"Unimplemented option");
1487 return llvm::ArrayRef(g_process_status_options);
1502 const bool only_threads_with_stop_reason =
true;
1505 const uint32_t num_frames_with_source = 1;
1506 const bool stop_format =
true;
1508 process->
GetThreadStatus(strm, only_threads_with_stop_reason, start_frame,
1509 num_frames, num_frames_with_source, stop_format);
1514 if (code_mask != 0) {
1515 int bits = std::bitset<64>(~code_mask).count();
1517 "Addressable code address mask: 0x%" PRIx64
"\n", code_mask);
1519 "Addressable data address mask: 0x%" PRIx64
"\n", data_mask);
1521 "Number of bits used in addressing (code): %d\n",
bits);
1526 result.
AppendError(
"Couldn'retrieve the target's platform");
1530 auto expected_crash_info =
1531 platform_sp->FetchExtendedCrashInformation(*process);
1533 if (!expected_crash_info) {
1534 result.
AppendError(llvm::toString(expected_crash_info.takeError()));
1540 if (crash_info_sp) {
1542 strm.
PutCString(
"Extended Crash Information:\n");
1543 crash_info_sp->GetDescription(strm);
1555#define LLDB_OPTIONS_process_handle
1556#include "CommandOptions.inc"
1558#pragma mark CommandObjectProcessHandle
1573 switch (short_option) {
1581 stop = std::string(option_arg);
1584 notify = std::string(option_arg);
1587 pass = std::string(option_arg);
1593 llvm_unreachable(
"Unimplemented option");
1608 return llvm::ArrayRef(g_process_handle_options);
1623 "Manage LLDB handling of OS signals for the "
1624 "current target process. Defaults to showing "
1627 SetHelpLong(
"\nIf no signals are specified but one or more actions are, "
1628 "and there is a live process, update them all. If no action "
1629 "is specified, list the current values.\n"
1630 "If you specify actions with no target (e.g. in an init file) "
1631 "or in a target with no process "
1632 "the values will get copied into subsequent targets, but "
1633 "lldb won't be able to spell-check the options since it can't "
1634 "know which signal set will later be in force."
1635 "\nYou can see the signal modifications held by the target"
1636 "by passing the -t option."
1637 "\nYou can also clear the target modification for a signal"
1638 "by passing the -c option");
1645 arg.push_back(signal_arg);
1656 bool success =
false;
1659 if (success && tmp_value)
1661 else if (success && !tmp_value)
1665 if (!llvm::to_integer(option, real_value))
1667 if (real_value != 0 && real_value != 1)
1675 str.
Printf(
"NAME PASS STOP NOTIFY\n");
1676 str.
Printf(
"=========== ===== ===== ======\n");
1680 const UnixSignalsSP &signals_sp) {
1685 str.
Printf(
"%-11s ", sig_name);
1686 if (signals_sp->GetSignalInfo(signo, suppress, stop, notify)) {
1687 bool pass = !suppress;
1688 str.
Printf(
"%s %s %s", (pass ?
"true " :
"false"),
1689 (stop ?
"true " :
"false"), (notify ?
"true " :
"false"));
1695 int num_valid_signals,
1696 const UnixSignalsSP &signals_sp) {
1699 if (num_valid_signals > 0) {
1701 for (
size_t i = 0; i < num_args; ++i) {
1702 int32_t signo = signals_sp->GetSignalNumberFromName(
1710 int32_t signo = signals_sp->GetFirstSignalNumber();
1712 PrintSignal(str, signo, signals_sp->GetSignalAsCString(signo),
1714 signo = signals_sp->GetNextSignalNumber(signo);
1729 int stop_action = -1;
1730 int pass_action = -1;
1731 int notify_action = -1;
1735 result.
AppendError(
"Invalid argument for command option --stop; must be "
1736 "true or false.\n");
1742 result.
AppendError(
"Invalid argument for command option --notify; must "
1743 "be true or false.\n");
1749 result.
AppendError(
"Invalid argument for command option --pass; must be "
1750 "true or false.\n");
1754 bool no_actions = (stop_action == -1 && pass_action == -1
1755 && notify_action == -1);
1757 result.
AppendError(
"-t is for reporting, not setting, target values.");
1762 UnixSignalsSP signals_sp;
1764 signals_sp = process_sp->GetUnixSignals();
1766 int num_signals_set = 0;
1787 for (
const auto &arg : signal_args) {
1791 int32_t signo = signals_sp->GetSignalNumberFromName(arg.c_str());
1795 if (stop_action != -1)
1796 signals_sp->SetShouldStop(signo, stop_action);
1797 if (pass_action != -1) {
1798 bool suppress = !pass_action;
1799 signals_sp->SetShouldSuppress(signo, suppress);
1801 if (notify_action != -1)
1802 signals_sp->SetShouldNotify(signo, notify_action);
1815 if (llvm::to_integer(arg.c_str(), signo)) {
1817 "number with no process");
1820 num_signals_set = num_args;
1822 auto set_lazy_bool = [] (
int action) ->
LazyBool {
1836 set_lazy_bool(pass_action),
1837 set_lazy_bool(notify_action),
1838 set_lazy_bool(stop_action));
1844 if (((notify_action != -1) || (stop_action != -1) || (pass_action != -1))
1847 "Do you really want to update all the signals?",
false)) {
1848 int32_t signo = signals_sp->GetFirstSignalNumber();
1850 if (notify_action != -1)
1851 signals_sp->SetShouldNotify(signo, notify_action);
1852 if (stop_action != -1)
1853 signals_sp->SetShouldStop(signo, stop_action);
1854 if (pass_action != -1) {
1855 bool suppress = !pass_action;
1856 signals_sp->SetShouldSuppress(signo, suppress);
1858 signo = signals_sp->GetNextSignalNumber(signo);
1866 num_signals_set, signals_sp);
1871 if (num_signals_set > 0)
1890 "process trace start",
1891 "Start tracing this process with the corresponding trace "
1893 "process trace start [<trace-options>]") {}
1906 "Stop tracing this process. This does not affect "
1907 "traces started with the "
1908 "\"thread trace start\" command.",
1909 "process trace stop",
1910 eCommandRequiresProcess | eCommandTryTargetAPILock |
1911 eCommandProcessMustBeLaunched |
1912 eCommandProcessMustBePaused |
1913 eCommandProcessMustBeTraced) {}
1920 TraceSP trace_sp = process_sp->GetTarget().GetTrace();
1922 if (llvm::Error err = trace_sp->Stop())
1936 interpreter,
"trace",
"Commands for tracing the current process.",
1937 "process trace <subcommand> [<subcommand objects>]") {
1952 interpreter,
"process",
1953 "Commands for interacting with processes on the current platform.",
1954 "process <subcommand> [<subcommand-options>]") {
static llvm::raw_ostream & error(Stream &strm)
~CommandObjectMultiwordProcessTrace() override=default
CommandObjectMultiwordProcessTrace(CommandInterpreter &interpreter)
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
~CommandOptions() override=default
ProcessAttachInfo attach_info
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
~CommandObjectProcessAttach() override=default
bool DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectProcessAttach(CommandInterpreter &interpreter)
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
~CommandObjectProcessConnect() override=default
bool 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
CommandObjectProcessContinue(CommandInterpreter &interpreter)
~CommandObjectProcessContinue() override=default
Options * GetOptions() override
bool DoExecute(Args &command, CommandReturnObject &result) 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
bool 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 PrintSignal(Stream &str, int32_t signo, const char *sig_name, const UnixSignalsSP &signals_sp)
void PrintSignalHeader(Stream &str)
Options * GetOptions() override
bool DoExecute(Args &signal_args, CommandReturnObject &result) override
void PrintSignalInformation(Stream &str, Args &signal_args, int num_valid_signals, const UnixSignalsSP &signals_sp)
bool DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectProcessInterrupt(CommandInterpreter &interpreter)
~CommandObjectProcessInterrupt() override=default
bool 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 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)
bool DoExecute(Args &launch_args, CommandReturnObject &result) 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
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.
bool 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
Options * GetOptions() override
bool DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectProcessSaveCore() override=default
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.
bool DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectProcessSignal() 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
bool DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
CommandObjectProcessStatus(CommandInterpreter &interpreter)
~CommandObjectProcessStatus() override=default
CommandObjectProcessTraceStart(CommandInterpreter &interpreter)
lldb::CommandObjectSP GetDelegateCommand(Trace &trace) override
CommandObjectProcessTraceStop(CommandInterpreter &interpreter)
~CommandObjectProcessTraceStop() override=default
bool DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectProcessUnload(CommandInterpreter &interpreter)
bool DoExecute(Args &command, CommandReturnObject &result) override
~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.
lldb::BreakpointSiteSP FindByID(lldb::break_id_t breakID)
Returns a shared pointer to the breakpoint site 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::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)
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 SetContinueOnceAttached(bool b)
void SetWaitForLaunch(bool b)
void SetProcessPluginName(llvm::StringRef plugin)
bool GetContinueOnceAttached() const
void SetIgnoreExisting(bool b)
void SetExecutableFile(const FileSpec &exe_file, bool add_exe_file_as_first_arg)
void SetProcessID(lldb::pid_t pid)
FileSpec & GetExecutableFile()
Environment & GetEnvironment()
void SetScriptedProcessClassName(std::string name)
void SetProcessPluginName(llvm::StringRef plugin)
void SetScriptedProcessDictionarySP(lldb_private::StructuredData::DictionarySP dictionary_sp)
bool GetDetachKeepsStopped() const
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.
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)
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.
BreakpointSiteList & GetBreakpointSiteList()
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.
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.
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)
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.
@ eReturnStatusSuccessContinuingNoResult
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
@ eArgTypeUnsignedInteger
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)