diff options
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Commands/CommandObjectProcess.cpp')
-rw-r--r-- | contrib/llvm/tools/lldb/source/Commands/CommandObjectProcess.cpp | 344 |
1 files changed, 126 insertions, 218 deletions
diff --git a/contrib/llvm/tools/lldb/source/Commands/CommandObjectProcess.cpp b/contrib/llvm/tools/lldb/source/Commands/CommandObjectProcess.cpp index a85ea17..106e2d8 100644 --- a/contrib/llvm/tools/lldb/source/Commands/CommandObjectProcess.cpp +++ b/contrib/llvm/tools/lldb/source/Commands/CommandObjectProcess.cpp @@ -7,12 +7,11 @@ // //===----------------------------------------------------------------------===// -#include "CommandObjectProcess.h" - // C Includes // C++ Includes // Other libraries and framework includes // Project includes +#include "CommandObjectProcess.h" #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Breakpoint/BreakpointSite.h" @@ -46,8 +45,9 @@ public: const char *new_process_action) : CommandObjectParsed (interpreter, name, help, syntax, flags), m_new_process_action (new_process_action) {} - - ~CommandObjectProcessLaunchOrAttach () override {} + + ~CommandObjectProcessLaunchOrAttach() override = default; + protected: bool StopProcessIfNecessary (Process *process, StateType &state, CommandReturnObject &result) @@ -81,7 +81,7 @@ protected: if (detach_error.Success()) { result.SetStatus (eReturnStatusSuccessFinishResult); - process = NULL; + process = nullptr; } else { @@ -95,7 +95,7 @@ protected: if (destroy_error.Success()) { result.SetStatus (eReturnStatusSuccessFinishResult); - process = NULL; + process = nullptr; } else { @@ -108,8 +108,10 @@ protected: } return result.Succeeded(); } + std::string m_new_process_action; }; + //------------------------------------------------------------------------- // CommandObjectProcessLaunch //------------------------------------------------------------------------- @@ -117,14 +119,13 @@ protected: class CommandObjectProcessLaunch : public CommandObjectProcessLaunchOrAttach { public: - CommandObjectProcessLaunch (CommandInterpreter &interpreter) : - CommandObjectProcessLaunchOrAttach (interpreter, - "process launch", - "Launch the executable in the debugger.", - NULL, - eCommandRequiresTarget, - "restart"), + CommandObjectProcessLaunchOrAttach(interpreter, + "process launch", + "Launch the executable in the debugger.", + nullptr, + eCommandRequiresTarget, + "restart"), m_options (interpreter) { CommandArgumentEntry arg; @@ -141,10 +142,7 @@ public: m_arguments.push_back (arg); } - - ~CommandObjectProcessLaunch () override - { - } + ~CommandObjectProcessLaunch() override = default; int HandleArgumentCompletion (Args &input, @@ -159,14 +157,14 @@ public: std::string completion_str (input.GetArgumentAtIndex(cursor_index)); completion_str.erase (cursor_char_position); - CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, - CommandCompletions::eDiskFileCompletion, - completion_str.c_str(), - match_start_point, - max_return_elements, - NULL, - word_complete, - matches); + CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::eDiskFileCompletion, + completion_str.c_str(), + match_start_point, + max_return_elements, + nullptr, + word_complete, + matches); return matches.GetSize(); } @@ -189,10 +187,10 @@ protected: { Debugger &debugger = m_interpreter.GetDebugger(); Target *target = debugger.GetSelectedTarget().get(); - // If our listener is NULL, users aren't allows to launch + // If our listener is nullptr, users aren't allows to launch ModuleSP exe_module_sp = target->GetExecutableModule(); - if (exe_module_sp == NULL) + if (exe_module_sp == nullptr) { result.AppendError ("no file in target, create a debug target using the 'target create' command"); result.SetStatus (eReturnStatusFailed); @@ -305,15 +303,15 @@ protected: //OptionDefinition //CommandObjectProcessLaunch::CommandOptions::g_option_table[] = //{ -//{ 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."}, -//{ SET1 , false, "stdin", 'i', OptionParser::eRequiredArgument, NULL, 0, eArgTypeDirectoryName, "Redirect stdin for the process to <path>."}, -//{ SET1 , false, "stdout", 'o', OptionParser::eRequiredArgument, NULL, 0, eArgTypeDirectoryName, "Redirect stdout for the process to <path>."}, -//{ SET1 , false, "stderr", 'e', OptionParser::eRequiredArgument, NULL, 0, eArgTypeDirectoryName, "Redirect stderr for the process to <path>."}, -//{ SET1 | SET2 | SET3, false, "plugin", 'p', OptionParser::eRequiredArgument, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."}, -//{ 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."}, -//{ SET3, false, "no-stdio", 'n', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Do not set up for terminal I/O to go to running process."}, -//{ SET1 | SET2 | SET3, false, "working-dir", 'w', OptionParser::eRequiredArgument, NULL, 0, eArgTypeDirectoryName, "Set the current working directory to <path> when running the inferior."}, -//{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL } +//{ SET1 | SET2 | SET3, false, "stop-at-entry", 's', OptionParser::eNoArgument, nullptr, 0, eArgTypeNone, "Stop at the entry point of the program when launching a process."}, +//{ SET1 , false, "stdin", 'i', OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName, "Redirect stdin for the process to <path>."}, +//{ SET1 , false, "stdout", 'o', OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName, "Redirect stdout for the process to <path>."}, +//{ SET1 , false, "stderr", 'e', OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName, "Redirect stderr for the process to <path>."}, +//{ SET1 | SET2 | SET3, false, "plugin", 'p', OptionParser::eRequiredArgument, nullptr, 0, eArgTypePlugin, "Name of the process plugin you want to use."}, +//{ SET2 , false, "tty", 't', OptionParser::eOptionalArgument, nullptr, 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."}, +//{ SET3, false, "no-stdio", 'n', OptionParser::eNoArgument, nullptr, 0, eArgTypeNone, "Do not set up for terminal I/O to go to running process."}, +//{ SET1 | SET2 | SET3, false, "working-dir", 'w', OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName, "Set the current working directory to <path> when running the inferior."}, +//{ 0, false, nullptr, 0, 0, nullptr, 0, eArgTypeNone, nullptr } //}; // //#undef SET1 @@ -327,11 +325,9 @@ protected: class CommandObjectProcessAttach : public CommandObjectProcessLaunchOrAttach { public: - class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : Options(interpreter) { @@ -339,9 +335,7 @@ public: OptionParsingStarting (); } - ~CommandOptions () override - { - } + ~CommandOptions() override = default; Error SetOptionValue (uint32_t option_idx, const char *option_arg) override @@ -428,7 +422,7 @@ public: // Look to see if there is a -P argument provided, and if so use that plugin, otherwise // use the default plugin. - const char *partial_name = NULL; + const char *partial_name = nullptr; partial_name = input.GetArgumentAtIndex(opt_arg_pos); PlatformSP platform_sp (m_interpreter.GetPlatform (true)); @@ -445,7 +439,7 @@ public: const size_t num_matches = process_infos.GetSize(); if (num_matches > 0) { - for (size_t i=0; i<num_matches; ++i) + for (size_t i = 0; i < num_matches; ++i) { matches.AppendString (process_infos.GetProcessNameAtIndex(i), process_infos.GetProcessNameLengthAtIndex(i)); @@ -477,9 +471,7 @@ public: { } - ~CommandObjectProcessAttach () override - { - } + ~CommandObjectProcessAttach() override = default; Options * GetOptions () override @@ -504,20 +496,20 @@ protected: if (!StopProcessIfNecessary (process, state, result)) return false; - if (target == NULL) + if (target == nullptr) { // If there isn't a current target create one. TargetSP new_target_sp; Error error; - error = m_interpreter.GetDebugger().GetTargetList().CreateTarget (m_interpreter.GetDebugger(), - NULL, - NULL, - false, - NULL, // No platform options - new_target_sp); + error = m_interpreter.GetDebugger().GetTargetList().CreateTarget(m_interpreter.GetDebugger(), + nullptr, + nullptr, + false, + nullptr, // No platform options + new_target_sp); target = new_target_sp.get(); - if (target == NULL || error.Fail()) + if (target == nullptr || error.Fail()) { result.AppendError(error.AsCString("Error creating target")); return false; @@ -611,17 +603,16 @@ protected: CommandOptions m_options; }; - OptionDefinition CommandObjectProcessAttach::CommandOptions::g_option_table[] = { -{ LLDB_OPT_SET_ALL, false, "continue",'c', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Immediately continue the process once attached."}, -{ LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."}, -{ LLDB_OPT_SET_1, false, "pid", 'p', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePid, "The process ID of an existing process to attach to."}, -{ LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeProcessName, "The name of the process to attach to."}, -{ LLDB_OPT_SET_2, false, "include-existing", 'i', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Include existing processes when doing attach -w."}, -{ LLDB_OPT_SET_2, false, "waitfor", 'w', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Wait for the process with <process-name> to launch."}, -{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } +{ LLDB_OPT_SET_ALL, false, "continue",'c', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Immediately continue the process once attached."}, +{ LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePlugin, "Name of the process plugin you want to use."}, +{ LLDB_OPT_SET_1, false, "pid", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePid, "The process ID of an existing process to attach to."}, +{ LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName, "The name of the process to attach to."}, +{ LLDB_OPT_SET_2, false, "include-existing", 'i', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Include existing processes when doing attach -w."}, +{ LLDB_OPT_SET_2, false, "waitfor", 'w', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Wait for the process with <process-name> to launch."}, +{ 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr } }; //------------------------------------------------------------------------- @@ -632,7 +623,6 @@ CommandObjectProcessAttach::CommandOptions::g_option_table[] = class CommandObjectProcessContinue : public CommandObjectParsed { public: - CommandObjectProcessContinue (CommandInterpreter &interpreter) : CommandObjectParsed (interpreter, "process continue", @@ -646,17 +636,12 @@ public: { } - - ~CommandObjectProcessContinue () override - { - } + ~CommandObjectProcessContinue() override = default; protected: - class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : Options(interpreter) { @@ -664,9 +649,7 @@ protected: OptionParsingStarting (); } - ~CommandOptions () override - { - } + ~CommandOptions() override = default; Error SetOptionValue (uint32_t option_idx, const char *option_arg) override @@ -725,7 +708,7 @@ protected: if (m_options.m_ignore > 0) { - ThreadSP sel_thread_sp(process->GetThreadList().GetSelectedThread()); + ThreadSP sel_thread_sp(GetDefaultThread()->shared_from_this()); if (sel_thread_sp) { StopInfoSP stop_info_sp = sel_thread_sp->GetStopInfo(); @@ -750,7 +733,7 @@ protected: } { // Scope for thread list mutex: - Mutex::Locker locker (process->GetThreadList().GetMutex()); + std::lock_guard<std::recursive_mutex> guard(process->GetThreadList().GetMutex()); const uint32_t num_threads = process->GetThreadList().GetSize(); // Set the actions that the threads should each take when resuming @@ -814,15 +797,14 @@ protected: } CommandOptions m_options; - }; OptionDefinition CommandObjectProcessContinue::CommandOptions::g_option_table[] = { -{ LLDB_OPT_SET_ALL, false, "ignore-count",'i', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeUnsignedInteger, +{ LLDB_OPT_SET_ALL, false, "ignore-count",'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Ignore <N> crossings of the breakpoint (if it exists) for the currently selected thread."}, -{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } +{ 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr } }; //------------------------------------------------------------------------- @@ -836,16 +818,13 @@ public: class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : Options (interpreter) { OptionParsingStarting (); } - ~CommandOptions () override - { - } + ~CommandOptions() override = default; Error SetOptionValue (uint32_t option_idx, const char *option_arg) override @@ -896,21 +875,15 @@ public: LazyBool m_keep_stopped; }; - CommandObjectProcessDetach (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "process detach", - "Detach from the current process being debugged.", - "process detach", - eCommandRequiresProcess | - eCommandTryTargetAPILock | - eCommandProcessMustBeLaunched), - m_options(interpreter) + CommandObjectProcessDetach(CommandInterpreter &interpreter) + : CommandObjectParsed(interpreter, "process detach", "Detach from the current target process.", + "process detach", + eCommandRequiresProcess | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched), + m_options(interpreter) { } - ~CommandObjectProcessDetach () override - { - } + ~CommandObjectProcessDetach() override = default; Options * GetOptions () override @@ -918,7 +891,6 @@ public: return &m_options; } - protected: bool DoExecute (Args& command, CommandReturnObject &result) override @@ -929,10 +901,7 @@ protected: if (m_options.m_keep_stopped == eLazyBoolCalculate) { // Check the process default: - if (process->GetDetachKeepsStopped()) - keep_stopped = true; - else - keep_stopped = false; + keep_stopped = process->GetDetachKeepsStopped(); } else if (m_options.m_keep_stopped == eLazyBoolYes) keep_stopped = true; @@ -959,8 +928,8 @@ protected: OptionDefinition CommandObjectProcessDetach::CommandOptions::g_option_table[] = { -{ LLDB_OPT_SET_1, false, "keep-stopped", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Whether or not the process should be kept stopped on detach (if possible)." }, -{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } +{ LLDB_OPT_SET_1, false, "keep-stopped", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the process should be kept stopped on detach (if possible)." }, +{ 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr } }; //------------------------------------------------------------------------- @@ -971,22 +940,18 @@ CommandObjectProcessDetach::CommandOptions::g_option_table[] = class CommandObjectProcessConnect : public CommandObjectParsed { public: - class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : Options(interpreter) { // Keep default values of all options in one place: OptionParsingStarting () OptionParsingStarting (); } - - ~CommandOptions () override - { - } - + + ~CommandOptions() override = default; + Error SetOptionValue (uint32_t option_idx, const char *option_arg) override { @@ -1036,12 +1001,9 @@ public: m_options (interpreter) { } - - ~CommandObjectProcessConnect () override - { - } - + ~CommandObjectProcessConnect() override = default; + Options * GetOptions () override { @@ -1061,7 +1023,6 @@ protected: return false; } - Process *process = m_exe_ctx.GetProcessPtr(); if (process && process->IsAlive()) { @@ -1098,8 +1059,8 @@ protected: OptionDefinition CommandObjectProcessConnect::CommandOptions::g_option_table[] = { - { LLDB_OPT_SET_ALL, false, "plugin", 'p', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."}, - { 0, false, NULL, 0 , 0, NULL, NULL, 0, eArgTypeNone, NULL } + { LLDB_OPT_SET_ALL, false, "plugin", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePlugin, "Name of the process plugin you want to use."}, + { 0, false, nullptr, 0 , 0, nullptr, nullptr, 0, eArgTypeNone, nullptr } }; //------------------------------------------------------------------------- @@ -1110,31 +1071,24 @@ CommandObjectProcessConnect::CommandOptions::g_option_table[] = class CommandObjectProcessPlugin : public CommandObjectProxy { public: - - CommandObjectProcessPlugin (CommandInterpreter &interpreter) : - CommandObjectProxy (interpreter, - "process plugin", - "Send a custom command to the current process plug-in.", - "process plugin <args>", - 0) - { - } - - ~CommandObjectProcessPlugin () override + CommandObjectProcessPlugin(CommandInterpreter &interpreter) + : CommandObjectProxy(interpreter, "process plugin", + "Send a custom command to the current target process plug-in.", "process plugin <args>", 0) { } + ~CommandObjectProcessPlugin() override = default; + CommandObject * GetProxyCommandObject() override { Process *process = m_interpreter.GetExecutionContext().GetProcessPtr(); if (process) return process->GetPluginCommandObject(); - return NULL; + return nullptr; } }; - //------------------------------------------------------------------------- // CommandObjectProcessLoad //------------------------------------------------------------------------- @@ -1153,7 +1107,7 @@ public: OptionParsingStarting (); } - ~CommandOptions () override = default; + ~CommandOptions() override = default; Error SetOptionValue (uint32_t option_idx, const char *option_arg) override @@ -1208,7 +1162,7 @@ public: { } - ~CommandObjectProcessLoad () override = default; + ~CommandObjectProcessLoad() override = default; Options * GetOptions () override @@ -1223,7 +1177,7 @@ protected: Process *process = m_exe_ctx.GetProcessPtr(); const size_t argc = command.GetArgumentCount(); - for (uint32_t i=0; i<argc; ++i) + for (uint32_t i = 0; i < argc; ++i) { Error error; PlatformSP platform = process->GetTarget().GetPlatform(); @@ -1293,9 +1247,7 @@ public: { } - ~CommandObjectProcessUnload () override - { - } + ~CommandObjectProcessUnload() override = default; protected: bool @@ -1305,7 +1257,7 @@ protected: const size_t argc = command.GetArgumentCount(); - for (uint32_t i=0; i<argc; ++i) + for (uint32_t i = 0; i < argc; ++i) { const char *image_token_cstr = command.GetArgumentAtIndex(i); uint32_t image_token = StringConvert::ToUInt32(image_token_cstr, LLDB_INVALID_IMAGE_TOKEN, 0); @@ -1343,13 +1295,9 @@ protected: class CommandObjectProcessSignal : public CommandObjectParsed { public: - - CommandObjectProcessSignal (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "process signal", - "Send a UNIX signal to the current process being debugged.", - NULL, - eCommandRequiresProcess | eCommandTryTargetAPILock) + CommandObjectProcessSignal(CommandInterpreter &interpreter) + : CommandObjectParsed(interpreter, "process signal", "Send a UNIX signal to the current target process.", + nullptr, eCommandRequiresProcess | eCommandTryTargetAPILock) { CommandArgumentEntry arg; CommandArgumentData signal_arg; @@ -1365,9 +1313,7 @@ public: m_arguments.push_back (arg); } - ~CommandObjectProcessSignal () override - { - } + ~CommandObjectProcessSignal() override = default; protected: bool @@ -1414,7 +1360,6 @@ protected: } }; - //------------------------------------------------------------------------- // CommandObjectProcessInterrupt //------------------------------------------------------------------------- @@ -1423,29 +1368,21 @@ protected: class CommandObjectProcessInterrupt : public CommandObjectParsed { public: - - - CommandObjectProcessInterrupt (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "process interrupt", - "Interrupt the current process being debugged.", - "process interrupt", - eCommandRequiresProcess | - eCommandTryTargetAPILock | - eCommandProcessMustBeLaunched) + CommandObjectProcessInterrupt(CommandInterpreter &interpreter) + : CommandObjectParsed(interpreter, "process interrupt", "Interrupt the current target process.", + "process interrupt", + eCommandRequiresProcess | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched) { } - ~CommandObjectProcessInterrupt () override - { - } + ~CommandObjectProcessInterrupt() override = default; protected: bool DoExecute (Args& command, CommandReturnObject &result) override { Process *process = m_exe_ctx.GetProcessPtr(); - if (process == NULL) + if (process == nullptr) { result.AppendError ("no process to halt"); result.SetStatus (eReturnStatusFailed); @@ -1485,28 +1422,20 @@ protected: class CommandObjectProcessKill : public CommandObjectParsed { public: - - CommandObjectProcessKill (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "process kill", - "Terminate the current process being debugged.", - "process kill", - eCommandRequiresProcess | - eCommandTryTargetAPILock | - eCommandProcessMustBeLaunched) + CommandObjectProcessKill(CommandInterpreter &interpreter) + : CommandObjectParsed(interpreter, "process kill", "Terminate the current target process.", "process kill", + eCommandRequiresProcess | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched) { } - ~CommandObjectProcessKill () override - { - } + ~CommandObjectProcessKill() override = default; protected: bool DoExecute (Args& command, CommandReturnObject &result) override { Process *process = m_exe_ctx.GetProcessPtr(); - if (process == NULL) + if (process == nullptr) { result.AppendError ("no process to kill"); result.SetStatus (eReturnStatusFailed); @@ -1545,7 +1474,6 @@ protected: class CommandObjectProcessSaveCore : public CommandObjectParsed { public: - CommandObjectProcessSaveCore (CommandInterpreter &interpreter) : CommandObjectParsed (interpreter, "process save-core", @@ -1556,11 +1484,9 @@ public: eCommandProcessMustBeLaunched) { } - - ~CommandObjectProcessSaveCore () override - { - } - + + ~CommandObjectProcessSaveCore() override = default; + protected: bool DoExecute (Args& command, @@ -1610,19 +1536,14 @@ protected: class CommandObjectProcessStatus : public CommandObjectParsed { public: - CommandObjectProcessStatus (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "process status", - "Show the current status and location of executing process.", - "process status", - eCommandRequiresProcess | eCommandTryTargetAPILock) - { - } - - ~CommandObjectProcessStatus() override + CommandObjectProcessStatus(CommandInterpreter &interpreter) + : CommandObjectParsed(interpreter, "process status", + "Show status and stop location for the current target process.", "process status", + eCommandRequiresProcess | eCommandTryTargetAPILock) { } + ~CommandObjectProcessStatus() override = default; bool DoExecute (Args& command, CommandReturnObject &result) override @@ -1653,20 +1574,16 @@ public: class CommandObjectProcessHandle : public CommandObjectParsed { public: - class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : Options (interpreter) { OptionParsingStarting (); } - ~CommandOptions () override - { - } + ~CommandOptions() override = default; Error SetOptionValue (uint32_t option_idx, const char *option_arg) override @@ -1717,13 +1634,12 @@ public: std::string pass; }; - - CommandObjectProcessHandle (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "process handle", - "Show or update what the process and debugger should do with various signals received from the OS.", - NULL), - m_options (interpreter) + CommandObjectProcessHandle(CommandInterpreter &interpreter) + : CommandObjectParsed( + interpreter, "process handle", + "Manage LLDB handling of OS signals for the current target process. Defaults to showing current policy.", + nullptr), + m_options(interpreter) { SetHelpLong ("\nIf no signals are specified, update them all. If no update " "option is specified, list the current values."); @@ -1738,9 +1654,7 @@ public: m_arguments.push_back (arg); } - ~CommandObjectProcessHandle () override - { - } + ~CommandObjectProcessHandle() override = default; Options * GetOptions () override @@ -1752,7 +1666,6 @@ public: VerifyCommandOptionValue (const std::string &option, int &real_value) { bool okay = true; - bool success = false; bool tmp_value = Args::StringToBoolean (option.c_str(), false, &success); @@ -1945,21 +1858,19 @@ protected: OptionDefinition CommandObjectProcessHandle::CommandOptions::g_option_table[] = { -{ LLDB_OPT_SET_1, false, "stop", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Whether or not the process should be stopped if the signal is received." }, -{ LLDB_OPT_SET_1, false, "notify", 'n', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Whether or not the debugger should notify the user if the signal is received." }, -{ LLDB_OPT_SET_1, false, "pass", 'p', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Whether or not the signal should be passed to the process." }, -{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } +{ LLDB_OPT_SET_1, false, "stop", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the process should be stopped if the signal is received." }, +{ LLDB_OPT_SET_1, false, "notify", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the debugger should notify the user if the signal is received." }, +{ LLDB_OPT_SET_1, false, "pass", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the signal should be passed to the process." }, +{ 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr } }; //------------------------------------------------------------------------- // CommandObjectMultiwordProcess //------------------------------------------------------------------------- -CommandObjectMultiwordProcess::CommandObjectMultiwordProcess (CommandInterpreter &interpreter) : - CommandObjectMultiword (interpreter, - "process", - "A set of commands for operating on a process.", - "process <subcommand> [<subcommand-options>]") +CommandObjectMultiwordProcess::CommandObjectMultiwordProcess(CommandInterpreter &interpreter) + : CommandObjectMultiword(interpreter, "process", "Commands for interacting with processes on the current platform.", + "process <subcommand> [<subcommand-options>]") { LoadSubCommand ("attach", CommandObjectSP (new CommandObjectProcessAttach (interpreter))); LoadSubCommand ("launch", CommandObjectSP (new CommandObjectProcessLaunch (interpreter))); @@ -1977,7 +1888,4 @@ CommandObjectMultiwordProcess::CommandObjectMultiwordProcess (CommandInterpreter LoadSubCommand ("save-core", CommandObjectSP (new CommandObjectProcessSaveCore (interpreter))); } -CommandObjectMultiwordProcess::~CommandObjectMultiwordProcess () -{ -} - +CommandObjectMultiwordProcess::~CommandObjectMultiwordProcess() = default; |