diff options
Diffstat (limited to 'lldb/source/Commands/CommandObjectProcess.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectProcess.cpp | 93 |
1 files changed, 35 insertions, 58 deletions
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index cbf2652..c7ce1b1 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -160,7 +160,7 @@ public: } protected: - bool DoExecute(Args &launch_args, CommandReturnObject &result) override { + void DoExecute(Args &launch_args, CommandReturnObject &result) override { Debugger &debugger = GetDebugger(); Target *target = debugger.GetSelectedTarget().get(); // If our listener is nullptr, users aren't allows to launch @@ -174,13 +174,13 @@ protected: if (exe_module_sp == nullptr && !target->GetProcessLaunchInfo().GetExecutableFile()) { result.AppendError("no file in target, create a debug target using the " "'target create' command"); - return false; + return; } StateType state = eStateInvalid; if (!StopProcessIfNecessary(m_exe_ctx.GetProcessPtr(), state, result)) - return false; + return; // Determine whether we will disable ASLR or leave it in the default state // (i.e. enabled if the platform supports it). First check if the process @@ -290,7 +290,6 @@ protected: } else { result.AppendError(error.AsCString()); } - return result.Succeeded(); } CommandOptionsProcessLaunch m_options; @@ -320,7 +319,7 @@ public: Options *GetOptions() override { return &m_all_options; } protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { PlatformSP platform_sp( GetDebugger().GetPlatformList().GetSelectedPlatform()); @@ -334,7 +333,7 @@ protected: Process *process = m_exe_ctx.GetProcessPtr(); if (!StopProcessIfNecessary(process, state, result)) - return false; + return; if (target == nullptr) { // If there isn't a current target create one. @@ -348,7 +347,7 @@ protected: target = new_target_sp.get(); if (target == nullptr || error.Fail()) { result.AppendError(error.AsCString("Error creating target")); - return false; + return; } } @@ -384,7 +383,7 @@ protected: } if (!result.Succeeded()) - return false; + return; // Okay, we're done. Last step is to warn if the executable module has // changed: @@ -429,8 +428,6 @@ protected: ExecutionContext exe_ctx(process_sp); m_interpreter.HandleCommand("process continue", eLazyBoolNo, exe_ctx, result); } - - return result.Succeeded(); } CommandOptionsProcessAttach m_options; @@ -504,8 +501,7 @@ protected: bool m_any_bkpts_specified = false; }; - - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { Process *process = m_exe_ctx.GetProcessPtr(); bool synchronous_execution = m_interpreter.GetSynchronous(); StateType state = process->GetState(); @@ -543,13 +539,13 @@ protected: m_options.m_run_to_bkpt_args, target, result, &run_to_bkpt_ids, BreakpointName::Permissions::disablePerm); if (!result.Succeeded()) { - return false; + return; } result.Clear(); if (m_options.m_any_bkpts_specified && run_to_bkpt_ids.GetSize() == 0) { result.AppendError("continue-to breakpoints did not specify any actual " "breakpoints or locations"); - return false; + return; } // First figure out which breakpoints & locations were specified by the @@ -612,7 +608,7 @@ protected: if (!any_enabled) { result.AppendError("at least one of the continue-to breakpoints must " "be enabled."); - return false; + return; } // Also, if you specify BOTH a breakpoint and one of it's locations, @@ -737,7 +733,6 @@ protected: "Process cannot be continued from its current state (%s).\n", StateAsCString(state)); } - return result.Succeeded(); } Options *GetOptions() override { return &m_options; } @@ -809,7 +804,7 @@ public: Options *GetOptions() override { return &m_options; } protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { Process *process = m_exe_ctx.GetProcessPtr(); // FIXME: This will be a Command Option: bool keep_stopped; @@ -826,9 +821,7 @@ protected: result.SetStatus(eReturnStatusSuccessFinishResult); } else { result.AppendErrorWithFormat("Detach failed: %s\n", error.AsCString()); - return false; } - return result.Succeeded(); } CommandOptions m_options; @@ -894,12 +887,12 @@ public: Options *GetOptions() override { return &m_options; } protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { if (command.GetArgumentCount() != 1) { result.AppendErrorWithFormat( "'%s' takes exactly one argument:\nUsage: %s\n", m_cmd_name.c_str(), m_cmd_syntax.c_str()); - return false; + return; } Process *process = m_exe_ctx.GetProcessPtr(); @@ -908,7 +901,7 @@ protected: "Process %" PRIu64 " is currently being debugged, kill the process before connecting.\n", process->GetID()); - return false; + return; } const char *plugin_name = nullptr; @@ -929,9 +922,7 @@ protected: error); if (error.Fail() || process_sp == nullptr) { result.AppendError(error.AsCString("Error connecting to the process")); - return false; } - return true; } CommandOptions m_options; @@ -1032,7 +1023,7 @@ public: Options *GetOptions() override { return &m_options; } protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { Process *process = m_exe_ctx.GetProcessPtr(); for (auto &entry : command.entries()) { @@ -1071,7 +1062,6 @@ protected: error.AsCString()); } } - return result.Succeeded(); } CommandOptions m_options; @@ -1115,7 +1105,7 @@ public: } protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { Process *process = m_exe_ctx.GetProcessPtr(); for (auto &entry : command.entries()) { @@ -1138,7 +1128,6 @@ protected: } } } - return result.Succeeded(); } }; @@ -1184,7 +1173,7 @@ public: } protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { Process *process = m_exe_ctx.GetProcessPtr(); if (command.GetArgumentCount() == 1) { @@ -1214,7 +1203,6 @@ protected: "'%s' takes exactly one signal number argument:\nUsage: %s\n", m_cmd_name.c_str(), m_cmd_syntax.c_str()); } - return result.Succeeded(); } }; @@ -1233,11 +1221,11 @@ public: ~CommandObjectProcessInterrupt() override = default; protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { Process *process = m_exe_ctx.GetProcessPtr(); if (process == nullptr) { result.AppendError("no process to halt"); - return false; + return; } bool clear_thread_plans = true; @@ -1248,7 +1236,6 @@ protected: result.AppendErrorWithFormat("Failed to halt process: %s\n", error.AsCString()); } - return result.Succeeded(); } }; @@ -1267,11 +1254,11 @@ public: ~CommandObjectProcessKill() override = default; protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { Process *process = m_exe_ctx.GetProcessPtr(); if (process == nullptr) { result.AppendError("no process to kill"); - return false; + return; } Status error(process->Destroy(true)); @@ -1281,7 +1268,6 @@ protected: result.AppendErrorWithFormat("Failed to kill process: %s\n", error.AsCString()); } - return result.Succeeded(); } }; @@ -1356,7 +1342,7 @@ public: }; protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { ProcessSP process_sp = m_exe_ctx.GetProcessSP(); if (process_sp) { if (command.GetArgumentCount() == 1) { @@ -1390,10 +1376,7 @@ protected: } } else { result.AppendError("invalid process"); - return false; } - - return result.Succeeded(); } CommandOptions m_options; @@ -1451,7 +1434,7 @@ public: }; protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { Stream &strm = result.GetOutputStream(); result.SetStatus(eReturnStatusSuccessFinishNoResult); @@ -1483,7 +1466,7 @@ protected: PlatformSP platform_sp = process->GetTarget().GetPlatform(); if (!platform_sp) { result.AppendError("Couldn'retrieve the target's platform"); - return result.Succeeded(); + return; } auto expected_crash_info = @@ -1491,7 +1474,7 @@ protected: if (!expected_crash_info) { result.AppendError(llvm::toString(expected_crash_info.takeError())); - return result.Succeeded(); + return; } StructuredData::DictionarySP crash_info_sp = *expected_crash_info; @@ -1502,8 +1485,6 @@ protected: crash_info_sp->GetDescription(strm); } } - - return result.Succeeded(); } private: @@ -1676,7 +1657,7 @@ public: } protected: - bool DoExecute(Args &signal_args, CommandReturnObject &result) override { + void DoExecute(Args &signal_args, CommandReturnObject &result) override { Target &target = GetSelectedOrDummyTarget(); // Any signals that are being set should be added to the Target's @@ -1693,28 +1674,28 @@ protected: !VerifyCommandOptionValue(m_options.stop, stop_action)) { result.AppendError("Invalid argument for command option --stop; must be " "true or false.\n"); - return false; + return; } if (!m_options.notify.empty() && !VerifyCommandOptionValue(m_options.notify, notify_action)) { result.AppendError("Invalid argument for command option --notify; must " "be true or false.\n"); - return false; + return; } if (!m_options.pass.empty() && !VerifyCommandOptionValue(m_options.pass, pass_action)) { result.AppendError("Invalid argument for command option --pass; must be " "true or false.\n"); - return false; + return; } bool no_actions = (stop_action == -1 && pass_action == -1 && notify_action == -1); if (m_options.only_target_values && !no_actions) { result.AppendError("-t is for reporting, not setting, target values."); - return false; + return; } size_t num_args = signal_args.GetArgumentCount(); @@ -1729,7 +1710,7 @@ protected: if (m_options.only_target_values) { target.PrintDummySignals(result.GetOutputStream(), signal_args); result.SetStatus(eReturnStatusSuccessFinishResult); - return true; + return; } // This handles clearing values: @@ -1738,7 +1719,7 @@ protected: if (m_options.dummy) GetDummyTarget().ClearDummySignals(signal_args); result.SetStatus(eReturnStatusSuccessFinishNoResult); - return true; + return; } // This rest handles setting values: @@ -1774,7 +1755,7 @@ protected: if (llvm::to_integer(arg.c_str(), signo)) { result.AppendErrorWithFormat("Can't set signal handling by signal " "number with no process"); - return false; + return; } num_signals_set = num_args; } @@ -1831,8 +1812,6 @@ protected: result.SetStatus(eReturnStatusSuccessFinishResult); else result.SetStatus(eReturnStatusFailed); - - return result.Succeeded(); } CommandOptions m_options; @@ -1873,7 +1852,7 @@ public: ~CommandObjectProcessTraceStop() override = default; - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { ProcessSP process_sp = m_exe_ctx.GetProcessSP(); TraceSP trace_sp = process_sp->GetTarget().GetTrace(); @@ -1882,8 +1861,6 @@ public: result.AppendError(toString(std::move(err))); else result.SetStatus(eReturnStatusSuccessFinishResult); - - return result.Succeeded(); } }; |