1 //===-- CommandObjectProcess.cpp --------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/lldb-python.h"
12 #include "CommandObjectProcess.h"
16 // Other libraries and framework includes
18 #include "lldb/Breakpoint/Breakpoint.h"
19 #include "lldb/Breakpoint/BreakpointLocation.h"
20 #include "lldb/Breakpoint/BreakpointSite.h"
21 #include "lldb/Core/State.h"
22 #include "lldb/Core/Module.h"
23 #include "lldb/Host/Host.h"
24 #include "lldb/Interpreter/Args.h"
25 #include "lldb/Interpreter/Options.h"
26 #include "lldb/Interpreter/CommandInterpreter.h"
27 #include "lldb/Interpreter/CommandReturnObject.h"
28 #include "lldb/Target/Platform.h"
29 #include "lldb/Target/Process.h"
30 #include "lldb/Target/StopInfo.h"
31 #include "lldb/Target/Target.h"
32 #include "lldb/Target/Thread.h"
35 using namespace lldb_private;
37 class CommandObjectProcessLaunchOrAttach : public CommandObjectParsed
40 CommandObjectProcessLaunchOrAttach (CommandInterpreter &interpreter,
45 const char *new_process_action) :
46 CommandObjectParsed (interpreter, name, help, syntax, flags),
47 m_new_process_action (new_process_action) {}
49 virtual ~CommandObjectProcessLaunchOrAttach () {}
52 StopProcessIfNecessary (Process *process, StateType &state, CommandReturnObject &result)
54 state = eStateInvalid;
57 state = process->GetState();
59 if (process->IsAlive() && state != eStateConnected)
62 if (process->GetState() == eStateAttaching)
63 ::snprintf (message, sizeof(message), "There is a pending attach, abort it and %s?", m_new_process_action.c_str());
64 else if (process->GetShouldDetach())
65 ::snprintf (message, sizeof(message), "There is a running process, detach from it and %s?", m_new_process_action.c_str());
67 ::snprintf (message, sizeof(message), "There is a running process, kill it and %s?", m_new_process_action.c_str());
69 if (!m_interpreter.Confirm (message, true))
71 result.SetStatus (eReturnStatusFailed);
76 if (process->GetShouldDetach())
78 bool keep_stopped = false;
79 Error detach_error (process->Detach(keep_stopped));
80 if (detach_error.Success())
82 result.SetStatus (eReturnStatusSuccessFinishResult);
87 result.AppendErrorWithFormat ("Failed to detach from process: %s\n", detach_error.AsCString());
88 result.SetStatus (eReturnStatusFailed);
93 Error destroy_error (process->Destroy());
94 if (destroy_error.Success())
96 result.SetStatus (eReturnStatusSuccessFinishResult);
101 result.AppendErrorWithFormat ("Failed to kill process: %s\n", destroy_error.AsCString());
102 result.SetStatus (eReturnStatusFailed);
108 return result.Succeeded();
110 std::string m_new_process_action;
112 //-------------------------------------------------------------------------
113 // CommandObjectProcessLaunch
114 //-------------------------------------------------------------------------
115 #pragma mark CommandObjectProcessLaunch
116 class CommandObjectProcessLaunch : public CommandObjectProcessLaunchOrAttach
120 CommandObjectProcessLaunch (CommandInterpreter &interpreter) :
121 CommandObjectProcessLaunchOrAttach (interpreter,
123 "Launch the executable in the debugger.",
127 m_options (interpreter)
129 CommandArgumentEntry arg;
130 CommandArgumentData run_args_arg;
132 // Define the first (and only) variant of this arg.
133 run_args_arg.arg_type = eArgTypeRunArgs;
134 run_args_arg.arg_repetition = eArgRepeatOptional;
136 // There is only one variant this argument could be; put it into the argument entry.
137 arg.push_back (run_args_arg);
139 // Push the data for the first argument into the m_arguments vector.
140 m_arguments.push_back (arg);
144 ~CommandObjectProcessLaunch ()
149 HandleArgumentCompletion (Args &input,
151 int &cursor_char_position,
152 OptionElementVector &opt_element_vector,
153 int match_start_point,
154 int max_return_elements,
158 std::string completion_str (input.GetArgumentAtIndex(cursor_index));
159 completion_str.erase (cursor_char_position);
161 CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
162 CommandCompletions::eDiskFileCompletion,
163 completion_str.c_str(),
169 return matches.GetSize();
178 virtual const char *GetRepeatCommand (Args ¤t_command_args, uint32_t index)
180 // No repeat for "process launch"...
186 DoExecute (Args& launch_args, CommandReturnObject &result)
188 Debugger &debugger = m_interpreter.GetDebugger();
189 Target *target = debugger.GetSelectedTarget().get();
190 // If our listener is NULL, users aren't allows to launch
191 ModuleSP exe_module_sp = target->GetExecutableModule();
193 if (exe_module_sp == NULL)
195 result.AppendError ("no file in target, create a debug target using the 'target create' command");
196 result.SetStatus (eReturnStatusFailed);
200 StateType state = eStateInvalid;
202 if (!StopProcessIfNecessary(m_exe_ctx.GetProcessPtr(), state, result))
205 const char *target_settings_argv0 = target->GetArg0();
207 if (target->GetDisableASLR())
208 m_options.launch_info.GetFlags().Set (eLaunchFlagDisableASLR);
210 if (target->GetDisableSTDIO())
211 m_options.launch_info.GetFlags().Set (eLaunchFlagDisableSTDIO);
214 target->GetEnvironmentAsArgs (environment);
215 if (environment.GetArgumentCount() > 0)
216 m_options.launch_info.GetEnvironmentEntries ().AppendArguments (environment);
218 if (target_settings_argv0)
220 m_options.launch_info.GetArguments().AppendArgument (target_settings_argv0);
221 m_options.launch_info.SetExecutableFile(exe_module_sp->GetPlatformFileSpec(), false);
225 m_options.launch_info.SetExecutableFile(exe_module_sp->GetPlatformFileSpec(), true);
228 if (launch_args.GetArgumentCount() == 0)
230 Args target_setting_args;
231 if (target->GetRunArguments(target_setting_args))
232 m_options.launch_info.GetArguments().AppendArguments (target_setting_args);
236 m_options.launch_info.GetArguments().AppendArguments (launch_args);
237 // Save the arguments for subsequent runs in the current target.
238 target->SetRunArguments (launch_args);
241 Error error = target->Launch(debugger.GetListener(), m_options.launch_info);
245 const char *archname = exe_module_sp->GetArchitecture().GetArchitectureName();
246 ProcessSP process_sp (target->GetProcessSP());
249 result.AppendMessageWithFormat ("Process %" PRIu64 " launched: '%s' (%s)\n", process_sp->GetID(), exe_module_sp->GetFileSpec().GetPath().c_str(), archname);
250 result.SetStatus (eReturnStatusSuccessFinishResult);
251 result.SetDidChangeProcessState (true);
255 result.AppendError("no error returned from Target::Launch, and target has no process");
256 result.SetStatus (eReturnStatusFailed);
261 result.AppendError(error.AsCString());
262 result.SetStatus (eReturnStatusFailed);
264 return result.Succeeded();
268 ProcessLaunchCommandOptions m_options;
272 //#define SET1 LLDB_OPT_SET_1
273 //#define SET2 LLDB_OPT_SET_2
274 //#define SET3 LLDB_OPT_SET_3
277 //CommandObjectProcessLaunch::CommandOptions::g_option_table[] =
279 //{ SET1 | SET2 | SET3, false, "stop-at-entry", 's', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Stop at the entry point of the program when launching a process."},
280 //{ SET1 , false, "stdin", 'i', OptionParser::eRequiredArgument, NULL, 0, eArgTypeDirectoryName, "Redirect stdin for the process to <path>."},
281 //{ SET1 , false, "stdout", 'o', OptionParser::eRequiredArgument, NULL, 0, eArgTypeDirectoryName, "Redirect stdout for the process to <path>."},
282 //{ SET1 , false, "stderr", 'e', OptionParser::eRequiredArgument, NULL, 0, eArgTypeDirectoryName, "Redirect stderr for the process to <path>."},
283 //{ SET1 | SET2 | SET3, false, "plugin", 'p', OptionParser::eRequiredArgument, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
284 //{ SET2 , false, "tty", 't', OptionParser::eOptionalArgument, NULL, 0, eArgTypeDirectoryName, "Start the process in a terminal. If <path> is specified, look for a terminal whose name contains <path>, else start the process in a new terminal."},
285 //{ SET3, false, "no-stdio", 'n', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Do not set up for terminal I/O to go to running process."},
286 //{ SET1 | SET2 | SET3, false, "working-dir", 'w', OptionParser::eRequiredArgument, NULL, 0, eArgTypeDirectoryName, "Set the current working directory to <path> when running the inferior."},
287 //{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
294 //-------------------------------------------------------------------------
295 // CommandObjectProcessAttach
296 //-------------------------------------------------------------------------
297 #pragma mark CommandObjectProcessAttach
298 class CommandObjectProcessAttach : public CommandObjectProcessLaunchOrAttach
302 class CommandOptions : public Options
306 CommandOptions (CommandInterpreter &interpreter) :
309 // Keep default values of all options in one place: OptionParsingStarting ()
310 OptionParsingStarting ();
318 SetOptionValue (uint32_t option_idx, const char *option_arg)
321 const int short_option = m_getopt_table[option_idx].val;
322 bool success = false;
323 switch (short_option)
326 attach_info.SetContinueOnceAttached(true);
331 lldb::pid_t pid = Args::StringToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success);
332 if (!success || pid == LLDB_INVALID_PROCESS_ID)
334 error.SetErrorStringWithFormat("invalid process ID '%s'", option_arg);
338 attach_info.SetProcessID (pid);
344 attach_info.SetProcessPluginName (option_arg);
348 attach_info.GetExecutableFile().SetFile(option_arg, false);
352 attach_info.SetWaitForLaunch(true);
356 attach_info.SetIgnoreExisting(false);
360 error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
367 OptionParsingStarting ()
372 const OptionDefinition*
375 return g_option_table;
379 HandleOptionArgumentCompletion (Args &input,
382 OptionElementVector &opt_element_vector,
383 int opt_element_index,
384 int match_start_point,
385 int max_return_elements,
389 int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos;
390 int opt_defs_index = opt_element_vector[opt_element_index].opt_defs_index;
392 // We are only completing the name option for now...
394 const OptionDefinition *opt_defs = GetDefinitions();
395 if (opt_defs[opt_defs_index].short_option == 'n')
397 // Are we in the name?
399 // Look to see if there is a -P argument provided, and if so use that plugin, otherwise
400 // use the default plugin.
402 const char *partial_name = NULL;
403 partial_name = input.GetArgumentAtIndex(opt_arg_pos);
405 PlatformSP platform_sp (m_interpreter.GetPlatform (true));
408 ProcessInstanceInfoList process_infos;
409 ProcessInstanceInfoMatch match_info;
412 match_info.GetProcessInfo().GetExecutableFile().SetFile(partial_name, false);
413 match_info.SetNameMatchType(eNameMatchStartsWith);
415 platform_sp->FindProcesses (match_info, process_infos);
416 const size_t num_matches = process_infos.GetSize();
419 for (size_t i=0; i<num_matches; ++i)
421 matches.AppendString (process_infos.GetProcessNameAtIndex(i),
422 process_infos.GetProcessNameLengthAtIndex(i));
431 // Options table: Required for subclasses of Options.
433 static OptionDefinition g_option_table[];
435 // Instance variables to hold the values for command options.
437 ProcessAttachInfo attach_info;
440 CommandObjectProcessAttach (CommandInterpreter &interpreter) :
441 CommandObjectProcessLaunchOrAttach (interpreter,
443 "Attach to a process.",
444 "process attach <cmd-options>",
447 m_options (interpreter)
451 ~CommandObjectProcessAttach ()
463 DoExecute (Args& command,
464 CommandReturnObject &result)
466 Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
467 // N.B. The attach should be synchronous. It doesn't help much to get the prompt back between initiating the attach
468 // and the target actually stopping. So even if the interpreter is set to be asynchronous, we wait for the stop
471 StateType state = eStateInvalid;
472 Process *process = m_exe_ctx.GetProcessPtr();
474 if (!StopProcessIfNecessary (process, state, result))
479 // If there isn't a current target create one.
480 TargetSP new_target_sp;
483 error = m_interpreter.GetDebugger().GetTargetList().CreateTarget (m_interpreter.GetDebugger(),
487 NULL, // No platform options
489 target = new_target_sp.get();
490 if (target == NULL || error.Fail())
492 result.AppendError(error.AsCString("Error creating target"));
495 m_interpreter.GetDebugger().GetTargetList().SetSelectedTarget(target);
498 // Record the old executable module, we want to issue a warning if the process of attaching changed the
499 // current executable (like somebody said "file foo" then attached to a PID whose executable was bar.)
501 ModuleSP old_exec_module_sp = target->GetExecutableModule();
502 ArchSpec old_arch_spec = target->GetArchitecture();
504 if (command.GetArgumentCount())
506 result.AppendErrorWithFormat("Invalid arguments for '%s'.\nUsage: %s\n", m_cmd_name.c_str(), m_cmd_syntax.c_str());
507 result.SetStatus (eReturnStatusFailed);
511 if (state != eStateConnected)
513 const char *plugin_name = m_options.attach_info.GetProcessPluginName();
514 process = target->CreateProcess (m_interpreter.GetDebugger().GetListener(), plugin_name, NULL).get();
520 // If no process info was specified, then use the target executable
521 // name as the process to attach to by default
522 if (!m_options.attach_info.ProcessInfoSpecified ())
524 if (old_exec_module_sp)
525 m_options.attach_info.GetExecutableFile().GetFilename() = old_exec_module_sp->GetPlatformFileSpec().GetFilename();
527 if (!m_options.attach_info.ProcessInfoSpecified ())
529 error.SetErrorString ("no process specified, create a target with a file, or specify the --pid or --name command option");
535 ListenerSP listener_sp (new Listener("lldb.CommandObjectProcessAttach.DoExecute.attach.hijack"));
536 m_options.attach_info.SetHijackListener(listener_sp);
537 process->HijackProcessEvents(listener_sp.get());
538 error = process->Attach (m_options.attach_info);
542 result.SetStatus (eReturnStatusSuccessContinuingNoResult);
543 StateType state = process->WaitForProcessToStop (NULL, NULL, false, listener_sp.get());
545 process->RestoreProcessEvents();
547 result.SetDidChangeProcessState (true);
549 if (state == eStateStopped)
551 result.AppendMessageWithFormat ("Process %" PRIu64 " %s\n", process->GetID(), StateAsCString (state));
552 result.SetStatus (eReturnStatusSuccessFinishNoResult);
556 result.AppendError ("attach failed: process did not stop (no such process or permission problem?)");
558 result.SetStatus (eReturnStatusFailed);
563 result.AppendErrorWithFormat ("attach failed: %s\n", error.AsCString());
564 result.SetStatus (eReturnStatusFailed);
570 if (result.Succeeded())
572 // Okay, we're done. Last step is to warn if the executable module has changed:
573 char new_path[PATH_MAX];
574 ModuleSP new_exec_module_sp (target->GetExecutableModule());
575 if (!old_exec_module_sp)
577 // We might not have a module if we attached to a raw pid...
578 if (new_exec_module_sp)
580 new_exec_module_sp->GetFileSpec().GetPath(new_path, PATH_MAX);
581 result.AppendMessageWithFormat("Executable module set to \"%s\".\n", new_path);
584 else if (old_exec_module_sp->GetFileSpec() != new_exec_module_sp->GetFileSpec())
586 char old_path[PATH_MAX];
588 old_exec_module_sp->GetFileSpec().GetPath (old_path, PATH_MAX);
589 new_exec_module_sp->GetFileSpec().GetPath (new_path, PATH_MAX);
591 result.AppendWarningWithFormat("Executable module changed from \"%s\" to \"%s\".\n",
595 if (!old_arch_spec.IsValid())
597 result.AppendMessageWithFormat ("Architecture set to: %s.\n", target->GetArchitecture().GetTriple().getTriple().c_str());
599 else if (!old_arch_spec.IsExactMatch(target->GetArchitecture()))
601 result.AppendWarningWithFormat("Architecture changed from %s to %s.\n",
602 old_arch_spec.GetTriple().getTriple().c_str(),
603 target->GetArchitecture().GetTriple().getTriple().c_str());
606 // This supports the use-case scenario of immediately continuing the process once attached.
607 if (m_options.attach_info.GetContinueOnceAttached())
608 m_interpreter.HandleCommand("process continue", eLazyBoolNo, result);
610 return result.Succeeded();
613 CommandOptions m_options;
618 CommandObjectProcessAttach::CommandOptions::g_option_table[] =
620 { LLDB_OPT_SET_ALL, false, "continue",'c', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Immediately continue the process once attached."},
621 { LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
622 { LLDB_OPT_SET_1, false, "pid", 'p', OptionParser::eRequiredArgument, NULL, 0, eArgTypePid, "The process ID of an existing process to attach to."},
623 { LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, NULL, 0, eArgTypeProcessName, "The name of the process to attach to."},
624 { LLDB_OPT_SET_2, false, "include-existing", 'i', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Include existing processes when doing attach -w."},
625 { LLDB_OPT_SET_2, false, "waitfor", 'w', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Wait for the process with <process-name> to launch."},
626 { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
629 //-------------------------------------------------------------------------
630 // CommandObjectProcessContinue
631 //-------------------------------------------------------------------------
632 #pragma mark CommandObjectProcessContinue
634 class CommandObjectProcessContinue : public CommandObjectParsed
638 CommandObjectProcessContinue (CommandInterpreter &interpreter) :
639 CommandObjectParsed (interpreter,
641 "Continue execution of all threads in the current process.",
643 eFlagRequiresProcess |
644 eFlagTryTargetAPILock |
645 eFlagProcessMustBeLaunched |
646 eFlagProcessMustBePaused ),
647 m_options(interpreter)
652 ~CommandObjectProcessContinue ()
658 class CommandOptions : public Options
662 CommandOptions (CommandInterpreter &interpreter) :
665 // Keep default values of all options in one place: OptionParsingStarting ()
666 OptionParsingStarting ();
674 SetOptionValue (uint32_t option_idx, const char *option_arg)
677 const int short_option = m_getopt_table[option_idx].val;
678 bool success = false;
679 switch (short_option)
682 m_ignore = Args::StringToUInt32 (option_arg, 0, 0, &success);
684 error.SetErrorStringWithFormat ("invalid value for ignore option: \"%s\", should be a number.", option_arg);
688 error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
695 OptionParsingStarting ()
700 const OptionDefinition*
703 return g_option_table;
706 // Options table: Required for subclasses of Options.
708 static OptionDefinition g_option_table[];
714 DoExecute (Args& command, CommandReturnObject &result)
716 Process *process = m_exe_ctx.GetProcessPtr();
717 bool synchronous_execution = m_interpreter.GetSynchronous ();
718 StateType state = process->GetState();
719 if (state == eStateStopped)
721 if (command.GetArgumentCount() != 0)
723 result.AppendErrorWithFormat ("The '%s' command does not take any arguments.\n", m_cmd_name.c_str());
724 result.SetStatus (eReturnStatusFailed);
728 if (m_options.m_ignore > 0)
730 ThreadSP sel_thread_sp(process->GetThreadList().GetSelectedThread());
733 StopInfoSP stop_info_sp = sel_thread_sp->GetStopInfo();
734 if (stop_info_sp && stop_info_sp->GetStopReason() == eStopReasonBreakpoint)
736 lldb::break_id_t bp_site_id = (lldb::break_id_t)stop_info_sp->GetValue();
737 BreakpointSiteSP bp_site_sp(process->GetBreakpointSiteList().FindByID(bp_site_id));
740 const size_t num_owners = bp_site_sp->GetNumberOfOwners();
741 for (size_t i = 0; i < num_owners; i++)
743 Breakpoint &bp_ref = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint();
744 if (!bp_ref.IsInternal())
746 bp_ref.SetIgnoreCount(m_options.m_ignore);
754 { // Scope for thread list mutex:
755 Mutex::Locker locker (process->GetThreadList().GetMutex());
756 const uint32_t num_threads = process->GetThreadList().GetSize();
758 // Set the actions that the threads should each take when resuming
759 for (uint32_t idx=0; idx<num_threads; ++idx)
761 process->GetThreadList().GetThreadAtIndex(idx)->SetResumeState (eStateRunning);
765 Error error(process->Resume());
768 result.AppendMessageWithFormat ("Process %" PRIu64 " resuming\n", process->GetID());
769 if (synchronous_execution)
771 state = process->WaitForProcessToStop (NULL);
773 result.SetDidChangeProcessState (true);
774 result.AppendMessageWithFormat ("Process %" PRIu64 " %s\n", process->GetID(), StateAsCString (state));
775 result.SetStatus (eReturnStatusSuccessFinishNoResult);
779 result.SetStatus (eReturnStatusSuccessContinuingNoResult);
784 result.AppendErrorWithFormat("Failed to resume process: %s.\n", error.AsCString());
785 result.SetStatus (eReturnStatusFailed);
790 result.AppendErrorWithFormat ("Process cannot be continued from its current state (%s).\n",
791 StateAsCString(state));
792 result.SetStatus (eReturnStatusFailed);
794 return result.Succeeded();
803 CommandOptions m_options;
808 CommandObjectProcessContinue::CommandOptions::g_option_table[] =
810 { LLDB_OPT_SET_ALL, false, "ignore-count",'i', OptionParser::eRequiredArgument, NULL, 0, eArgTypeUnsignedInteger,
811 "Ignore <N> crossings of the breakpoint (if it exists) for the currently selected thread."},
812 { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
815 //-------------------------------------------------------------------------
816 // CommandObjectProcessDetach
817 //-------------------------------------------------------------------------
818 #pragma mark CommandObjectProcessDetach
820 class CommandObjectProcessDetach : public CommandObjectParsed
823 class CommandOptions : public Options
827 CommandOptions (CommandInterpreter &interpreter) :
828 Options (interpreter)
830 OptionParsingStarting ();
838 SetOptionValue (uint32_t option_idx, const char *option_arg)
841 const int short_option = m_getopt_table[option_idx].val;
843 switch (short_option)
848 tmp_result = Args::StringToBoolean(option_arg, false, &success);
850 error.SetErrorStringWithFormat("invalid boolean option: \"%s\"", option_arg);
854 m_keep_stopped = eLazyBoolYes;
856 m_keep_stopped = eLazyBoolNo;
860 error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
867 OptionParsingStarting ()
869 m_keep_stopped = eLazyBoolCalculate;
872 const OptionDefinition*
875 return g_option_table;
878 // Options table: Required for subclasses of Options.
880 static OptionDefinition g_option_table[];
882 // Instance variables to hold the values for command options.
883 LazyBool m_keep_stopped;
886 CommandObjectProcessDetach (CommandInterpreter &interpreter) :
887 CommandObjectParsed (interpreter,
889 "Detach from the current process being debugged.",
891 eFlagRequiresProcess |
892 eFlagTryTargetAPILock |
893 eFlagProcessMustBeLaunched),
894 m_options(interpreter)
898 ~CommandObjectProcessDetach ()
911 DoExecute (Args& command, CommandReturnObject &result)
913 Process *process = m_exe_ctx.GetProcessPtr();
914 result.AppendMessageWithFormat ("Detaching from process %" PRIu64 "\n", process->GetID());
915 // FIXME: This will be a Command Option:
917 if (m_options.m_keep_stopped == eLazyBoolCalculate)
919 // Check the process default:
920 if (process->GetDetachKeepsStopped())
923 keep_stopped = false;
925 else if (m_options.m_keep_stopped == eLazyBoolYes)
928 keep_stopped = false;
930 Error error (process->Detach(keep_stopped));
933 result.SetStatus (eReturnStatusSuccessFinishResult);
937 result.AppendErrorWithFormat ("Detach failed: %s\n", error.AsCString());
938 result.SetStatus (eReturnStatusFailed);
941 return result.Succeeded();
944 CommandOptions m_options;
948 CommandObjectProcessDetach::CommandOptions::g_option_table[] =
950 { LLDB_OPT_SET_1, false, "keep-stopped", 's', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Whether or not the process should be kept stopped on detach (if possible)." },
951 { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
954 //-------------------------------------------------------------------------
955 // CommandObjectProcessConnect
956 //-------------------------------------------------------------------------
957 #pragma mark CommandObjectProcessConnect
959 class CommandObjectProcessConnect : public CommandObjectParsed
963 class CommandOptions : public Options
967 CommandOptions (CommandInterpreter &interpreter) :
970 // Keep default values of all options in one place: OptionParsingStarting ()
971 OptionParsingStarting ();
979 SetOptionValue (uint32_t option_idx, const char *option_arg)
982 const int short_option = m_getopt_table[option_idx].val;
984 switch (short_option)
987 plugin_name.assign (option_arg);
991 error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
998 OptionParsingStarting ()
1000 plugin_name.clear();
1003 const OptionDefinition*
1006 return g_option_table;
1009 // Options table: Required for subclasses of Options.
1011 static OptionDefinition g_option_table[];
1013 // Instance variables to hold the values for command options.
1015 std::string plugin_name;
1018 CommandObjectProcessConnect (CommandInterpreter &interpreter) :
1019 CommandObjectParsed (interpreter,
1021 "Connect to a remote debug service.",
1022 "process connect <remote-url>",
1024 m_options (interpreter)
1028 ~CommandObjectProcessConnect ()
1041 DoExecute (Args& command,
1042 CommandReturnObject &result)
1045 TargetSP target_sp (m_interpreter.GetDebugger().GetSelectedTarget());
1047 Process *process = m_exe_ctx.GetProcessPtr();
1050 if (process->IsAlive())
1052 result.AppendErrorWithFormat ("Process %" PRIu64 " is currently being debugged, kill the process before connecting.\n",
1054 result.SetStatus (eReturnStatusFailed);
1061 // If there isn't a current target create one.
1063 error = m_interpreter.GetDebugger().GetTargetList().CreateTarget (m_interpreter.GetDebugger(),
1067 NULL, // No platform options
1069 if (!target_sp || error.Fail())
1071 result.AppendError(error.AsCString("Error creating target"));
1072 result.SetStatus (eReturnStatusFailed);
1075 m_interpreter.GetDebugger().GetTargetList().SetSelectedTarget(target_sp.get());
1078 if (command.GetArgumentCount() == 1)
1080 const char *plugin_name = NULL;
1081 if (!m_options.plugin_name.empty())
1082 plugin_name = m_options.plugin_name.c_str();
1084 const char *remote_url = command.GetArgumentAtIndex(0);
1085 process = target_sp->CreateProcess (m_interpreter.GetDebugger().GetListener(), plugin_name, NULL).get();
1089 error = process->ConnectRemote (process->GetTarget().GetDebugger().GetOutputFile().get(), remote_url);
1093 result.AppendError(error.AsCString("Remote connect failed"));
1094 result.SetStatus (eReturnStatusFailed);
1095 target_sp->DeleteCurrentProcess();
1101 result.AppendErrorWithFormat ("Unable to find process plug-in for remote URL '%s'.\nPlease specify a process plug-in name with the --plugin option, or specify an object file using the \"file\" command.\n",
1103 result.SetStatus (eReturnStatusFailed);
1108 result.AppendErrorWithFormat ("'%s' takes exactly one argument:\nUsage: %s\n",
1110 m_cmd_syntax.c_str());
1111 result.SetStatus (eReturnStatusFailed);
1113 return result.Succeeded();
1116 CommandOptions m_options;
1120 CommandObjectProcessConnect::CommandOptions::g_option_table[] =
1122 { LLDB_OPT_SET_ALL, false, "plugin", 'p', OptionParser::eRequiredArgument, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
1123 { 0, false, NULL, 0 , 0, NULL, 0, eArgTypeNone, NULL }
1126 //-------------------------------------------------------------------------
1127 // CommandObjectProcessPlugin
1128 //-------------------------------------------------------------------------
1129 #pragma mark CommandObjectProcessPlugin
1131 class CommandObjectProcessPlugin : public CommandObjectProxy
1135 CommandObjectProcessPlugin (CommandInterpreter &interpreter) :
1136 CommandObjectProxy (interpreter,
1138 "Send a custom command to the current process plug-in.",
1139 "process plugin <args>",
1144 ~CommandObjectProcessPlugin ()
1148 virtual CommandObject *
1149 GetProxyCommandObject()
1151 Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
1153 return process->GetPluginCommandObject();
1159 //-------------------------------------------------------------------------
1160 // CommandObjectProcessLoad
1161 //-------------------------------------------------------------------------
1162 #pragma mark CommandObjectProcessLoad
1164 class CommandObjectProcessLoad : public CommandObjectParsed
1168 CommandObjectProcessLoad (CommandInterpreter &interpreter) :
1169 CommandObjectParsed (interpreter,
1171 "Load a shared library into the current process.",
1172 "process load <filename> [<filename> ...]",
1173 eFlagRequiresProcess |
1174 eFlagTryTargetAPILock |
1175 eFlagProcessMustBeLaunched |
1176 eFlagProcessMustBePaused )
1180 ~CommandObjectProcessLoad ()
1186 DoExecute (Args& command,
1187 CommandReturnObject &result)
1189 Process *process = m_exe_ctx.GetProcessPtr();
1191 const size_t argc = command.GetArgumentCount();
1193 for (uint32_t i=0; i<argc; ++i)
1196 const char *image_path = command.GetArgumentAtIndex(i);
1197 FileSpec image_spec (image_path, false);
1198 process->GetTarget().GetPlatform()->ResolveRemotePath(image_spec, image_spec);
1199 uint32_t image_token = process->LoadImage(image_spec, error);
1200 if (image_token != LLDB_INVALID_IMAGE_TOKEN)
1202 result.AppendMessageWithFormat ("Loading \"%s\"...ok\nImage %u loaded.\n", image_path, image_token);
1203 result.SetStatus (eReturnStatusSuccessFinishResult);
1207 result.AppendErrorWithFormat ("failed to load '%s': %s", image_path, error.AsCString());
1208 result.SetStatus (eReturnStatusFailed);
1211 return result.Succeeded();
1216 //-------------------------------------------------------------------------
1217 // CommandObjectProcessUnload
1218 //-------------------------------------------------------------------------
1219 #pragma mark CommandObjectProcessUnload
1221 class CommandObjectProcessUnload : public CommandObjectParsed
1225 CommandObjectProcessUnload (CommandInterpreter &interpreter) :
1226 CommandObjectParsed (interpreter,
1228 "Unload a shared library from the current process using the index returned by a previous call to \"process load\".",
1229 "process unload <index>",
1230 eFlagRequiresProcess |
1231 eFlagTryTargetAPILock |
1232 eFlagProcessMustBeLaunched |
1233 eFlagProcessMustBePaused )
1237 ~CommandObjectProcessUnload ()
1243 DoExecute (Args& command,
1244 CommandReturnObject &result)
1246 Process *process = m_exe_ctx.GetProcessPtr();
1248 const size_t argc = command.GetArgumentCount();
1250 for (uint32_t i=0; i<argc; ++i)
1252 const char *image_token_cstr = command.GetArgumentAtIndex(i);
1253 uint32_t image_token = Args::StringToUInt32(image_token_cstr, LLDB_INVALID_IMAGE_TOKEN, 0);
1254 if (image_token == LLDB_INVALID_IMAGE_TOKEN)
1256 result.AppendErrorWithFormat ("invalid image index argument '%s'", image_token_cstr);
1257 result.SetStatus (eReturnStatusFailed);
1262 Error error (process->UnloadImage(image_token));
1263 if (error.Success())
1265 result.AppendMessageWithFormat ("Unloading shared library with index %u...ok\n", image_token);
1266 result.SetStatus (eReturnStatusSuccessFinishResult);
1270 result.AppendErrorWithFormat ("failed to unload image: %s", error.AsCString());
1271 result.SetStatus (eReturnStatusFailed);
1276 return result.Succeeded();
1280 //-------------------------------------------------------------------------
1281 // CommandObjectProcessSignal
1282 //-------------------------------------------------------------------------
1283 #pragma mark CommandObjectProcessSignal
1285 class CommandObjectProcessSignal : public CommandObjectParsed
1289 CommandObjectProcessSignal (CommandInterpreter &interpreter) :
1290 CommandObjectParsed (interpreter,
1292 "Send a UNIX signal to the current process being debugged.",
1294 eFlagRequiresProcess | eFlagTryTargetAPILock)
1296 CommandArgumentEntry arg;
1297 CommandArgumentData signal_arg;
1299 // Define the first (and only) variant of this arg.
1300 signal_arg.arg_type = eArgTypeUnixSignal;
1301 signal_arg.arg_repetition = eArgRepeatPlain;
1303 // There is only one variant this argument could be; put it into the argument entry.
1304 arg.push_back (signal_arg);
1306 // Push the data for the first argument into the m_arguments vector.
1307 m_arguments.push_back (arg);
1310 ~CommandObjectProcessSignal ()
1316 DoExecute (Args& command,
1317 CommandReturnObject &result)
1319 Process *process = m_exe_ctx.GetProcessPtr();
1321 if (command.GetArgumentCount() == 1)
1323 int signo = LLDB_INVALID_SIGNAL_NUMBER;
1325 const char *signal_name = command.GetArgumentAtIndex(0);
1326 if (::isxdigit (signal_name[0]))
1327 signo = Args::StringToSInt32(signal_name, LLDB_INVALID_SIGNAL_NUMBER, 0);
1329 signo = process->GetUnixSignals().GetSignalNumberFromName (signal_name);
1331 if (signo == LLDB_INVALID_SIGNAL_NUMBER)
1333 result.AppendErrorWithFormat ("Invalid signal argument '%s'.\n", command.GetArgumentAtIndex(0));
1334 result.SetStatus (eReturnStatusFailed);
1338 Error error (process->Signal (signo));
1339 if (error.Success())
1341 result.SetStatus (eReturnStatusSuccessFinishResult);
1345 result.AppendErrorWithFormat ("Failed to send signal %i: %s\n", signo, error.AsCString());
1346 result.SetStatus (eReturnStatusFailed);
1352 result.AppendErrorWithFormat("'%s' takes exactly one signal number argument:\nUsage: %s\n", m_cmd_name.c_str(),
1353 m_cmd_syntax.c_str());
1354 result.SetStatus (eReturnStatusFailed);
1356 return result.Succeeded();
1361 //-------------------------------------------------------------------------
1362 // CommandObjectProcessInterrupt
1363 //-------------------------------------------------------------------------
1364 #pragma mark CommandObjectProcessInterrupt
1366 class CommandObjectProcessInterrupt : public CommandObjectParsed
1371 CommandObjectProcessInterrupt (CommandInterpreter &interpreter) :
1372 CommandObjectParsed (interpreter,
1373 "process interrupt",
1374 "Interrupt the current process being debugged.",
1375 "process interrupt",
1376 eFlagRequiresProcess |
1377 eFlagTryTargetAPILock |
1378 eFlagProcessMustBeLaunched)
1382 ~CommandObjectProcessInterrupt ()
1388 DoExecute (Args& command,
1389 CommandReturnObject &result)
1391 Process *process = m_exe_ctx.GetProcessPtr();
1392 if (process == NULL)
1394 result.AppendError ("no process to halt");
1395 result.SetStatus (eReturnStatusFailed);
1399 if (command.GetArgumentCount() == 0)
1401 bool clear_thread_plans = true;
1402 Error error(process->Halt (clear_thread_plans));
1403 if (error.Success())
1405 result.SetStatus (eReturnStatusSuccessFinishResult);
1409 result.AppendErrorWithFormat ("Failed to halt process: %s\n", error.AsCString());
1410 result.SetStatus (eReturnStatusFailed);
1415 result.AppendErrorWithFormat("'%s' takes no arguments:\nUsage: %s\n",
1417 m_cmd_syntax.c_str());
1418 result.SetStatus (eReturnStatusFailed);
1420 return result.Succeeded();
1424 //-------------------------------------------------------------------------
1425 // CommandObjectProcessKill
1426 //-------------------------------------------------------------------------
1427 #pragma mark CommandObjectProcessKill
1429 class CommandObjectProcessKill : public CommandObjectParsed
1433 CommandObjectProcessKill (CommandInterpreter &interpreter) :
1434 CommandObjectParsed (interpreter,
1436 "Terminate the current process being debugged.",
1438 eFlagRequiresProcess |
1439 eFlagTryTargetAPILock |
1440 eFlagProcessMustBeLaunched)
1444 ~CommandObjectProcessKill ()
1450 DoExecute (Args& command,
1451 CommandReturnObject &result)
1453 Process *process = m_exe_ctx.GetProcessPtr();
1454 if (process == NULL)
1456 result.AppendError ("no process to kill");
1457 result.SetStatus (eReturnStatusFailed);
1461 if (command.GetArgumentCount() == 0)
1463 Error error (process->Destroy());
1464 if (error.Success())
1466 result.SetStatus (eReturnStatusSuccessFinishResult);
1470 result.AppendErrorWithFormat ("Failed to kill process: %s\n", error.AsCString());
1471 result.SetStatus (eReturnStatusFailed);
1476 result.AppendErrorWithFormat("'%s' takes no arguments:\nUsage: %s\n",
1478 m_cmd_syntax.c_str());
1479 result.SetStatus (eReturnStatusFailed);
1481 return result.Succeeded();
1485 //-------------------------------------------------------------------------
1486 // CommandObjectProcessStatus
1487 //-------------------------------------------------------------------------
1488 #pragma mark CommandObjectProcessStatus
1490 class CommandObjectProcessStatus : public CommandObjectParsed
1493 CommandObjectProcessStatus (CommandInterpreter &interpreter) :
1494 CommandObjectParsed (interpreter,
1496 "Show the current status and location of executing process.",
1498 eFlagRequiresProcess | eFlagTryTargetAPILock)
1502 ~CommandObjectProcessStatus()
1508 DoExecute (Args& command, CommandReturnObject &result)
1510 Stream &strm = result.GetOutputStream();
1511 result.SetStatus (eReturnStatusSuccessFinishNoResult);
1512 // No need to check "process" for validity as eFlagRequiresProcess ensures it is valid
1513 Process *process = m_exe_ctx.GetProcessPtr();
1514 const bool only_threads_with_stop_reason = true;
1515 const uint32_t start_frame = 0;
1516 const uint32_t num_frames = 1;
1517 const uint32_t num_frames_with_source = 1;
1518 process->GetStatus(strm);
1519 process->GetThreadStatus (strm,
1520 only_threads_with_stop_reason,
1523 num_frames_with_source);
1524 return result.Succeeded();
1528 //-------------------------------------------------------------------------
1529 // CommandObjectProcessHandle
1530 //-------------------------------------------------------------------------
1531 #pragma mark CommandObjectProcessHandle
1533 class CommandObjectProcessHandle : public CommandObjectParsed
1537 class CommandOptions : public Options
1541 CommandOptions (CommandInterpreter &interpreter) :
1542 Options (interpreter)
1544 OptionParsingStarting ();
1552 SetOptionValue (uint32_t option_idx, const char *option_arg)
1555 const int short_option = m_getopt_table[option_idx].val;
1557 switch (short_option)
1563 notify = option_arg;
1569 error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
1576 OptionParsingStarting ()
1583 const OptionDefinition*
1586 return g_option_table;
1589 // Options table: Required for subclasses of Options.
1591 static OptionDefinition g_option_table[];
1593 // Instance variables to hold the values for command options.
1601 CommandObjectProcessHandle (CommandInterpreter &interpreter) :
1602 CommandObjectParsed (interpreter,
1604 "Show or update what the process and debugger should do with various signals received from the OS.",
1606 m_options (interpreter)
1608 SetHelpLong ("If no signals are specified, update them all. If no update option is specified, list the current values.\n");
1609 CommandArgumentEntry arg;
1610 CommandArgumentData signal_arg;
1612 signal_arg.arg_type = eArgTypeUnixSignal;
1613 signal_arg.arg_repetition = eArgRepeatStar;
1615 arg.push_back (signal_arg);
1617 m_arguments.push_back (arg);
1620 ~CommandObjectProcessHandle ()
1631 VerifyCommandOptionValue (const std::string &option, int &real_value)
1635 bool success = false;
1636 bool tmp_value = Args::StringToBoolean (option.c_str(), false, &success);
1638 if (success && tmp_value)
1640 else if (success && !tmp_value)
1644 // If the value isn't 'true' or 'false', it had better be 0 or 1.
1645 real_value = Args::StringToUInt32 (option.c_str(), 3);
1646 if (real_value != 0 && real_value != 1)
1654 PrintSignalHeader (Stream &str)
1656 str.Printf ("NAME PASS STOP NOTIFY\n");
1657 str.Printf ("========== ===== ===== ======\n");
1661 PrintSignal (Stream &str, int32_t signo, const char *sig_name, UnixSignals &signals)
1667 str.Printf ("%-10s ", sig_name);
1668 if (signals.GetSignalInfo (signo, suppress, stop, notify))
1670 bool pass = !suppress;
1671 str.Printf ("%s %s %s",
1672 (pass ? "true " : "false"),
1673 (stop ? "true " : "false"),
1674 (notify ? "true " : "false"));
1680 PrintSignalInformation (Stream &str, Args &signal_args, int num_valid_signals, UnixSignals &signals)
1682 PrintSignalHeader (str);
1684 if (num_valid_signals > 0)
1686 size_t num_args = signal_args.GetArgumentCount();
1687 for (size_t i = 0; i < num_args; ++i)
1689 int32_t signo = signals.GetSignalNumberFromName (signal_args.GetArgumentAtIndex (i));
1690 if (signo != LLDB_INVALID_SIGNAL_NUMBER)
1691 PrintSignal (str, signo, signal_args.GetArgumentAtIndex (i), signals);
1694 else // Print info for ALL signals
1696 int32_t signo = signals.GetFirstSignalNumber();
1697 while (signo != LLDB_INVALID_SIGNAL_NUMBER)
1699 PrintSignal (str, signo, signals.GetSignalAsCString (signo), signals);
1700 signo = signals.GetNextSignalNumber (signo);
1707 DoExecute (Args &signal_args, CommandReturnObject &result)
1709 TargetSP target_sp = m_interpreter.GetDebugger().GetSelectedTarget();
1713 result.AppendError ("No current target;"
1714 " cannot handle signals until you have a valid target and process.\n");
1715 result.SetStatus (eReturnStatusFailed);
1719 ProcessSP process_sp = target_sp->GetProcessSP();
1723 result.AppendError ("No current process; cannot handle signals until you have a valid process.\n");
1724 result.SetStatus (eReturnStatusFailed);
1728 int stop_action = -1; // -1 means leave the current setting alone
1729 int pass_action = -1; // -1 means leave the current setting alone
1730 int notify_action = -1; // -1 means leave the current setting alone
1732 if (! m_options.stop.empty()
1733 && ! VerifyCommandOptionValue (m_options.stop, stop_action))
1735 result.AppendError ("Invalid argument for command option --stop; must be true or false.\n");
1736 result.SetStatus (eReturnStatusFailed);
1740 if (! m_options.notify.empty()
1741 && ! VerifyCommandOptionValue (m_options.notify, notify_action))
1743 result.AppendError ("Invalid argument for command option --notify; must be true or false.\n");
1744 result.SetStatus (eReturnStatusFailed);
1748 if (! m_options.pass.empty()
1749 && ! VerifyCommandOptionValue (m_options.pass, pass_action))
1751 result.AppendError ("Invalid argument for command option --pass; must be true or false.\n");
1752 result.SetStatus (eReturnStatusFailed);
1756 size_t num_args = signal_args.GetArgumentCount();
1757 UnixSignals &signals = process_sp->GetUnixSignals();
1758 int num_signals_set = 0;
1762 for (size_t i = 0; i < num_args; ++i)
1764 int32_t signo = signals.GetSignalNumberFromName (signal_args.GetArgumentAtIndex (i));
1765 if (signo != LLDB_INVALID_SIGNAL_NUMBER)
1767 // Casting the actions as bools here should be okay, because VerifyCommandOptionValue guarantees
1768 // the value is either 0 or 1.
1769 if (stop_action != -1)
1770 signals.SetShouldStop (signo, (bool) stop_action);
1771 if (pass_action != -1)
1773 bool suppress = ! ((bool) pass_action);
1774 signals.SetShouldSuppress (signo, suppress);
1776 if (notify_action != -1)
1777 signals.SetShouldNotify (signo, (bool) notify_action);
1782 result.AppendErrorWithFormat ("Invalid signal name '%s'\n", signal_args.GetArgumentAtIndex (i));
1788 // No signal specified, if any command options were specified, update ALL signals.
1789 if ((notify_action != -1) || (stop_action != -1) || (pass_action != -1))
1791 if (m_interpreter.Confirm ("Do you really want to update all the signals?", false))
1793 int32_t signo = signals.GetFirstSignalNumber();
1794 while (signo != LLDB_INVALID_SIGNAL_NUMBER)
1796 if (notify_action != -1)
1797 signals.SetShouldNotify (signo, (bool) notify_action);
1798 if (stop_action != -1)
1799 signals.SetShouldStop (signo, (bool) stop_action);
1800 if (pass_action != -1)
1802 bool suppress = ! ((bool) pass_action);
1803 signals.SetShouldSuppress (signo, suppress);
1805 signo = signals.GetNextSignalNumber (signo);
1811 PrintSignalInformation (result.GetOutputStream(), signal_args, num_signals_set, signals);
1813 if (num_signals_set > 0)
1814 result.SetStatus (eReturnStatusSuccessFinishNoResult);
1816 result.SetStatus (eReturnStatusFailed);
1818 return result.Succeeded();
1821 CommandOptions m_options;
1825 CommandObjectProcessHandle::CommandOptions::g_option_table[] =
1827 { LLDB_OPT_SET_1, false, "stop", 's', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Whether or not the process should be stopped if the signal is received." },
1828 { LLDB_OPT_SET_1, false, "notify", 'n', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Whether or not the debugger should notify the user if the signal is received." },
1829 { LLDB_OPT_SET_1, false, "pass", 'p', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Whether or not the signal should be passed to the process." },
1830 { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
1833 //-------------------------------------------------------------------------
1834 // CommandObjectMultiwordProcess
1835 //-------------------------------------------------------------------------
1837 CommandObjectMultiwordProcess::CommandObjectMultiwordProcess (CommandInterpreter &interpreter) :
1838 CommandObjectMultiword (interpreter,
1840 "A set of commands for operating on a process.",
1841 "process <subcommand> [<subcommand-options>]")
1843 LoadSubCommand ("attach", CommandObjectSP (new CommandObjectProcessAttach (interpreter)));
1844 LoadSubCommand ("launch", CommandObjectSP (new CommandObjectProcessLaunch (interpreter)));
1845 LoadSubCommand ("continue", CommandObjectSP (new CommandObjectProcessContinue (interpreter)));
1846 LoadSubCommand ("connect", CommandObjectSP (new CommandObjectProcessConnect (interpreter)));
1847 LoadSubCommand ("detach", CommandObjectSP (new CommandObjectProcessDetach (interpreter)));
1848 LoadSubCommand ("load", CommandObjectSP (new CommandObjectProcessLoad (interpreter)));
1849 LoadSubCommand ("unload", CommandObjectSP (new CommandObjectProcessUnload (interpreter)));
1850 LoadSubCommand ("signal", CommandObjectSP (new CommandObjectProcessSignal (interpreter)));
1851 LoadSubCommand ("handle", CommandObjectSP (new CommandObjectProcessHandle (interpreter)));
1852 LoadSubCommand ("status", CommandObjectSP (new CommandObjectProcessStatus (interpreter)));
1853 LoadSubCommand ("interrupt", CommandObjectSP (new CommandObjectProcessInterrupt (interpreter)));
1854 LoadSubCommand ("kill", CommandObjectSP (new CommandObjectProcessKill (interpreter)));
1855 LoadSubCommand ("plugin", CommandObjectSP (new CommandObjectProcessPlugin (interpreter)));
1858 CommandObjectMultiwordProcess::~CommandObjectMultiwordProcess ()