38#include "llvm/ADT/ScopeExit.h"
49 const char *name,
const char *help,
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);
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;
203 ScriptedMetadataSP metadata_sp = std::make_shared<ScriptedMetadata>(
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
309 interpreter,
"process attach",
"Attach to a process.",
310 "process attach <cmd-options>", 0,
"attach"),
324 PlatformSP platform_sp(
325 GetDebugger().GetPlatformList().GetSelectedPlatform());
339 if (target ==
nullptr) {
341 TargetSP new_target_sp;
348 target = new_target_sp.get();
349 if (target ==
nullptr ||
error.Fail()) {
357 ScriptedMetadataSP metadata_sp = std::make_shared<ScriptedMetadata>(
370 ProcessSP process_sp;
372 if (
error.Success()) {
380 "no error returned from Target::Attach, and target has no process");
393 if (!old_exec_module_sp) {
395 if (new_exec_module_sp) {
396 new_exec_module_sp->GetFileSpec().GetPath(new_path,
PATH_MAX);
400 }
else if (old_exec_module_sp->GetFileSpec() !=
401 new_exec_module_sp->GetFileSpec()) {
404 old_exec_module_sp->GetFileSpec().GetPath(old_path,
PATH_MAX);
405 new_exec_module_sp->GetFileSpec().GetPath(new_path,
PATH_MAX);
408 "Executable module changed from \"%s\" to \"%s\".\n", old_path,
412 if (!old_arch_spec.
IsValid()) {
414 "Architecture set to: %s.\n",
418 "Architecture changed from %s to %s.\n",
419 old_arch_spec.
GetTriple().getTriple().c_str(),
443#define LLDB_OPTIONS_process_continue
444#include "CommandOptions.inc"
446#pragma mark CommandObjectProcessContinue
452 interpreter,
"process continue",
453 "Continue execution of all threads in the current process.",
455 eCommandRequiresProcess | eCommandTryTargetAPILock |
456 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {}
475 switch (short_option) {
477 if (option_arg.getAsInteger(0,
m_ignore))
478 error.SetErrorStringWithFormat(
479 "invalid value for ignore option: \"%s\", should be a number.",
480 option_arg.str().c_str());
487 llvm_unreachable(
"Unimplemented option");
499 return llvm::ArrayRef(g_process_continue_options);
516 StopInfoSP stop_info_sp = sel_thread_sp->GetStopInfo();
521 BreakpointSiteSP bp_site_sp(
524 const size_t num_owners = bp_site_sp->GetNumberOfOwners();
525 for (
size_t i = 0; i < num_owners; i++) {
527 bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint();
550 result.
AppendError(
"continue-to breakpoints did not specify any actual "
551 "breakpoints or locations");
557 size_t num_run_to_bkpt_ids = run_to_bkpt_ids.
GetSize();
558 std::vector<break_id_t> bkpts_disabled;
559 std::vector<BreakpointID> locs_disabled;
560 if (num_run_to_bkpt_ids != 0) {
566 std::unordered_set<break_id_t> bkpts_seen;
567 std::unordered_set<break_id_t> bkpts_with_locs_seen;
569 bool any_enabled =
false;
571 for (
size_t idx = 0; idx < num_run_to_bkpt_ids; idx++) {
579 if (bp_sp->IsEnabled()) {
583 size_t num_locations = bp_sp->GetNumLocations();
584 for (
size_t loc_idx = 0; loc_idx < num_locations; loc_idx++) {
585 BreakpointLocationSP loc_sp
586 = bp_sp->GetLocationAtIndex(loc_idx);
587 if (loc_sp->IsEnabled()) {
594 BreakpointLocationSP loc_sp = bp_sp->FindLocationByID(loc_id);
595 if (loc_sp->IsEnabled())
613 result.
AppendError(
"at least one of the continue-to breakpoints must "
622 for (
break_id_t bp_id : bkpts_with_locs_seen) {
623 if (bkpts_seen.count(bp_id)) {
625 "one of its locations: {0}", bp_id);
631 for (BreakpointSP bp_sp : bkpt_list.
Breakpoints()) {
636 if (!bkpts_with_locs_seen.count(bp_id)) {
637 if (!bkpts_seen.count(bp_id) && bp_sp->IsEnabled()) {
638 bkpts_disabled.push_back(bp_id);
639 bp_sp->SetEnabled(
false);
646 size_t num_locations = bp_sp->GetNumLocations();
648 for (
size_t loc_idx = 0; loc_idx < num_locations; loc_idx++) {
649 BreakpointLocationSP loc_sp = bp_sp->GetLocationAtIndex(loc_idx);
653 && loc_sp->IsEnabled()) {
654 locs_disabled.push_back(tmp_id);
655 loc_sp->SetEnabled(
false);
662 std::lock_guard<std::recursive_mutex> guard(
667 for (
uint32_t idx = 0; idx < num_threads; ++idx) {
668 const bool override_suspend =
false;
681 if (run_to_bkpt_ids.
GetSize() != 0) {
683 synchronous_execution =
true;
685 if (synchronous_execution)
690 if (run_to_bkpt_ids.
GetSize() != 0) {
699 bp_sp->SetEnabled(
true);
705 BreakpointLocationSP loc_sp
706 = bp_sp->FindLocationByID(bkpt_id.GetLocationID());
708 loc_sp->SetEnabled(
true);
712 if (
error.Success()) {
717 process->
SyncIOHandler(iohandler_id, std::chrono::seconds(2));
721 if (synchronous_execution) {
737 "Process cannot be continued from its current state (%s).\n",
749#define LLDB_OPTIONS_process_detach
750#include "CommandOptions.inc"
752#pragma mark CommandObjectProcessDetach
767 switch (short_option) {
773 error.SetErrorStringWithFormat(
"invalid boolean option: \"%s\"",
774 option_arg.str().c_str());
783 llvm_unreachable(
"Unimplemented option");
793 return llvm::ArrayRef(g_process_detach_options);
802 "Detach from the current target process.",
804 eCommandRequiresProcess | eCommandTryTargetAPILock |
805 eCommandProcessMustBeLaunched) {}
822 keep_stopped =
false;
825 if (
error.Success()) {
838#define LLDB_OPTIONS_process_connect
839#include "CommandOptions.inc"
841#pragma mark CommandObjectProcessConnect
860 switch (short_option) {
866 llvm_unreachable(
"Unimplemented option");
876 return llvm::ArrayRef(g_process_connect_options);
886 "Connect to a remote debug service.",
887 "process connect <remote-url>", 0) {
900 "'%s' takes exactly one argument:\nUsage: %s\n",
m_cmd_name.c_str(),
906 if (process && process->
IsAlive()) {
909 " is currently being debugged, kill the process before connecting.\n",
914 const char *plugin_name =
nullptr;
921 ProcessSP process_sp =
923 ? platform_sp->ConnectProcess(
926 : platform_sp->ConnectProcessSynchronous(
930 if (
error.Fail() || process_sp ==
nullptr) {
941#pragma mark CommandObjectProcessPlugin
947 interpreter,
"process plugin",
948 "Send a custom command to the current target process plug-in.",
949 "process plugin <args>", 0) {}
962#define LLDB_OPTIONS_process_load
963#include "CommandOptions.inc"
965#pragma mark CommandObjectProcessLoad
983 switch (short_option) {
986 if (!option_arg.empty())
990 llvm_unreachable(
"Unimplemented option");
1001 return llvm::ArrayRef(g_process_load_options);
1011 "Load a shared library into the current process.",
1012 "process load <filename> [<filename> ...]",
1013 eCommandRequiresProcess | eCommandTryTargetAPILock |
1014 eCommandProcessMustBeLaunched |
1015 eCommandProcessMustBePaused) {
1038 for (
auto &entry : command.
entries()) {
1041 llvm::StringRef image_path = entry.ref();
1046 platform->ResolveRemotePath(image_spec, image_spec);
1048 platform->LoadImage(process,
FileSpec(), image_spec,
error);
1054 image_token = platform->LoadImage(process, image_spec,
1060 platform->LoadImage(process, image_spec,
FileSpec(),
error);
1065 "Loading \"%s\"...ok\nImage %u loaded.\n", image_path.str().c_str(),
1070 image_path.str().c_str(),
1081#pragma mark CommandObjectProcessUnload
1087 interpreter,
"process unload",
1088 "Unload a shared library from the current process using the index "
1089 "returned by a previous call to \"process load\".",
1090 "process unload <index>",
1091 eCommandRequiresProcess | eCommandTryTargetAPILock |
1092 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {
1108 const std::vector<lldb::addr_t> &tokens = process->
GetImageTokens();
1109 const size_t token_num = tokens.size();
1110 for (
size_t i = 0; i < token_num; ++i) {
1121 for (
auto &entry : command.
entries()) {
1123 if (entry.ref().getAsInteger(0, image_token)) {
1125 entry.ref().str().c_str());
1129 process, image_token));
1130 if (
error.Success()) {
1132 "Unloading shared library with index %u...ok\n", image_token);
1146#pragma mark CommandObjectProcessSignal
1152 interpreter,
"process signal",
1153 "Send a UNIX signal to the current target process.", nullptr,
1154 eCommandRequiresProcess | eCommandTryTargetAPILock) {
1164 arg.push_back(signal_arg);
1179 int signo = signals->GetFirstSignalNumber();
1182 signo = signals->GetNextSignalNumber(signo);
1194 if (::isxdigit(signal_name[0])) {
1195 if (!llvm::to_integer(signal_name, signo))
1198 signo = process->
GetUnixSignals()->GetSignalNumberFromName(signal_name);
1205 if (
error.Success()) {
1214 "'%s' takes exactly one signal number argument:\nUsage: %s\n",
1222#pragma mark CommandObjectProcessInterrupt
1228 "Interrupt the current target process.",
1229 "process interrupt",
1230 eCommandRequiresProcess | eCommandTryTargetAPILock |
1231 eCommandProcessMustBeLaunched) {}
1238 if (process ==
nullptr) {
1243 bool clear_thread_plans =
true;
1245 if (
error.Success()) {
1256#pragma mark CommandObjectProcessKill
1262 "Terminate the current target process.",
1264 eCommandRequiresProcess | eCommandTryTargetAPILock |
1265 eCommandProcessMustBeLaunched) {}
1272 if (process ==
nullptr) {
1278 if (
error.Success()) {
1288#define LLDB_OPTIONS_process_save_core
1289#include "CommandOptions.inc"
1295 interpreter,
"process save-core",
1296 "Save the current process as a core file using an "
1297 "appropriate file type.",
1298 "process save-core [-s corefile-style -p plugin-name] FILE",
1299 eCommandRequiresProcess | eCommandTryTargetAPILock |
1300 eCommandProcessMustBeLaunched) {
1316 return llvm::ArrayRef(g_process_save_core_options);
1324 switch (short_option) {
1335 llvm_unreachable(
"Unimplemented option");
1361 if (
error.Success()) {
1362 if (corefile_style == SaveCoreStyle::eSaveCoreDirtyOnly ||
1363 corefile_style == SaveCoreStyle::eSaveCoreStackOnly) {
1365 "\nModified-memory or stack-memory only corefile "
1366 "created. This corefile may \n"
1367 "not show library/framework/app binaries "
1368 "on a different system, or when \n"
1369 "those binaries have "
1370 "been updated/modified. Copies are not included\n"
1371 "in this corefile. Use --style full to include all "
1372 "process memory.\n");
1377 "Failed to save core file for process: %s\n",
error.AsCString());
1395#pragma mark CommandObjectProcessStatus
1396#define LLDB_OPTIONS_process_status
1397#include "CommandOptions.inc"
1403 interpreter,
"process status",
1404 "Show status and stop location for the current target process.",
1406 eCommandRequiresProcess | eCommandTryTargetAPILock) {}
1422 switch (short_option) {
1427 llvm_unreachable(
"Unimplemented option");
1438 return llvm::ArrayRef(g_process_status_options);
1453 const bool only_threads_with_stop_reason =
true;
1456 const uint32_t num_frames_with_source = 1;
1457 const bool stop_format =
true;
1459 process->
GetThreadStatus(strm, only_threads_with_stop_reason, start_frame,
1460 num_frames, num_frames_with_source, stop_format);
1465 if (code_mask != 0) {
1466 int bits = std::bitset<64>(~code_mask).count();
1468 "Addressable code address mask: 0x%" PRIx64
"\n", code_mask);
1470 "Addressable data address mask: 0x%" PRIx64
"\n", data_mask);
1472 "Number of bits used in addressing (code): %d\n",
bits);
1477 result.
AppendError(
"Couldn'retrieve the target's platform");
1481 auto expected_crash_info =
1482 platform_sp->FetchExtendedCrashInformation(*process);
1484 if (!expected_crash_info) {
1485 result.
AppendError(llvm::toString(expected_crash_info.takeError()));
1491 if (crash_info_sp) {
1493 strm.
PutCString(
"Extended Crash Information:\n");
1494 crash_info_sp->GetDescription(strm);
1506#define LLDB_OPTIONS_process_handle
1507#include "CommandOptions.inc"
1509#pragma mark CommandObjectProcessHandle
1524 switch (short_option) {
1532 stop = std::string(option_arg);
1535 notify = std::string(option_arg);
1538 pass = std::string(option_arg);
1544 llvm_unreachable(
"Unimplemented option");
1559 return llvm::ArrayRef(g_process_handle_options);
1574 "Manage LLDB handling of OS signals for the "
1575 "current target process. Defaults to showing "
1578 SetHelpLong(
"\nIf no signals are specified but one or more actions are, "
1579 "and there is a live process, update them all. If no action "
1580 "is specified, list the current values.\n"
1581 "If you specify actions with no target (e.g. in an init file) "
1582 "or in a target with no process "
1583 "the values will get copied into subsequent targets, but "
1584 "lldb won't be able to spell-check the options since it can't "
1585 "know which signal set will later be in force."
1586 "\nYou can see the signal modifications held by the target"
1587 "by passing the -t option."
1588 "\nYou can also clear the target modification for a signal"
1589 "by passing the -c option");
1596 arg.push_back(signal_arg);
1607 bool success =
false;
1610 if (success && tmp_value)
1612 else if (success && !tmp_value)
1616 if (!llvm::to_integer(option, real_value))
1618 if (real_value != 0 && real_value != 1)
1626 str.
Printf(
"NAME PASS STOP NOTIFY\n");
1627 str.
Printf(
"=========== ===== ===== ======\n");
1631 const UnixSignalsSP &signals_sp) {
1636 str.
Printf(
"%-11s ", sig_name);
1637 if (signals_sp->GetSignalInfo(signo, suppress, stop, notify)) {
1638 bool pass = !suppress;
1639 str.
Printf(
"%s %s %s", (pass ?
"true " :
"false"),
1640 (stop ?
"true " :
"false"), (notify ?
"true " :
"false"));
1646 int num_valid_signals,
1647 const UnixSignalsSP &signals_sp) {
1650 if (num_valid_signals > 0) {
1652 for (
size_t i = 0; i < num_args; ++i) {
1653 int32_t signo = signals_sp->GetSignalNumberFromName(
1661 int32_t signo = signals_sp->GetFirstSignalNumber();
1663 PrintSignal(str, signo, signals_sp->GetSignalAsCString(signo),
1665 signo = signals_sp->GetNextSignalNumber(signo);
1680 int stop_action = -1;
1681 int pass_action = -1;
1682 int notify_action = -1;
1686 result.
AppendError(
"Invalid argument for command option --stop; must be "
1687 "true or false.\n");
1693 result.
AppendError(
"Invalid argument for command option --notify; must "
1694 "be true or false.\n");
1700 result.
AppendError(
"Invalid argument for command option --pass; must be "
1701 "true or false.\n");
1705 bool no_actions = (stop_action == -1 && pass_action == -1
1706 && notify_action == -1);
1708 result.
AppendError(
"-t is for reporting, not setting, target values.");
1713 UnixSignalsSP signals_sp;
1715 signals_sp = process_sp->GetUnixSignals();
1717 int num_signals_set = 0;
1738 for (
const auto &arg : signal_args) {
1742 int32_t signo = signals_sp->GetSignalNumberFromName(arg.c_str());
1746 if (stop_action != -1)
1747 signals_sp->SetShouldStop(signo, stop_action);
1748 if (pass_action != -1) {
1749 bool suppress = !pass_action;
1750 signals_sp->SetShouldSuppress(signo, suppress);
1752 if (notify_action != -1)
1753 signals_sp->SetShouldNotify(signo, notify_action);
1766 if (llvm::to_integer(arg.c_str(), signo)) {
1768 "number with no process");
1771 num_signals_set = num_args;
1773 auto set_lazy_bool = [] (
int action) ->
LazyBool {
1787 set_lazy_bool(pass_action),
1788 set_lazy_bool(notify_action),
1789 set_lazy_bool(stop_action));
1795 if (((notify_action != -1) || (stop_action != -1) || (pass_action != -1))
1798 "Do you really want to update all the signals?",
false)) {
1799 int32_t signo = signals_sp->GetFirstSignalNumber();
1801 if (notify_action != -1)
1802 signals_sp->SetShouldNotify(signo, notify_action);
1803 if (stop_action != -1)
1804 signals_sp->SetShouldStop(signo, stop_action);
1805 if (pass_action != -1) {
1806 bool suppress = !pass_action;
1807 signals_sp->SetShouldSuppress(signo, suppress);
1809 signo = signals_sp->GetNextSignalNumber(signo);
1817 num_signals_set, signals_sp);
1822 if (num_signals_set > 0)
1841 "process trace start",
1842 "Start tracing this process with the corresponding trace "
1844 "process trace start [<trace-options>]") {}
1857 "Stop tracing this process. This does not affect "
1858 "traces started with the "
1859 "\"thread trace start\" command.",
1860 "process trace stop",
1861 eCommandRequiresProcess | eCommandTryTargetAPILock |
1862 eCommandProcessMustBeLaunched |
1863 eCommandProcessMustBePaused |
1864 eCommandProcessMustBeTraced) {}
1871 TraceSP trace_sp = process_sp->GetTarget().GetTrace();
1873 if (llvm::Error err = trace_sp->Stop())
1887 interpreter,
"trace",
"Commands for tracing the current process.",
1888 "process trace <subcommand> [<subcommand objects>]") {
1903 interpreter,
"process",
1904 "Commands for interacting with processes on the current platform.",
1905 "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
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::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)
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.
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.
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)