diff options
Diffstat (limited to 'lldb/source/Commands/CommandObjectFrame.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectFrame.cpp | 76 |
1 files changed, 32 insertions, 44 deletions
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index 1390fd8..1fad638 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -133,7 +133,7 @@ public: Options *GetOptions() override { return &m_options; } protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { Thread *thread = m_exe_ctx.GetThreadPtr(); StackFrameSP frame_sp = thread->GetSelectedFrame(SelectMostRelevantFrame); @@ -143,7 +143,7 @@ protected: if (m_options.reg || m_options.offset) { result.AppendError( "`frame diagnose --address` is incompatible with other arguments."); - return false; + return; } valobj_sp = frame_sp->GuessValueForAddress(*m_options.address); } else if (m_options.reg) { @@ -153,7 +153,7 @@ protected: StopInfoSP stop_info_sp = thread->GetStopInfo(); if (!stop_info_sp) { result.AppendError("No arguments provided, and no stop info."); - return false; + return; } valobj_sp = StopInfo::GetCrashingDereference(stop_info_sp); @@ -161,7 +161,7 @@ protected: if (!valobj_sp) { result.AppendError("No diagnosis available."); - return false; + return; } DumpValueObjectOptions::DeclPrintingHelper helper = @@ -180,8 +180,6 @@ protected: ValueObjectPrinter printer(valobj_sp.get(), &result.GetOutputStream(), options); printer.PrintValueObject(); - - return true; } CommandOptions m_options; @@ -205,10 +203,9 @@ public: ~CommandObjectFrameInfo() override = default; protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { m_exe_ctx.GetFrameRef().DumpUsingSettingsFormat(&result.GetOutputStream()); result.SetStatus(eReturnStatusSuccessFinishResult); - return result.Succeeded(); } }; @@ -299,7 +296,7 @@ public: Options *GetOptions() override { return &m_options; } protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { // No need to check "thread" for validity as eCommandRequiresThread ensures // it is valid Thread *thread = m_exe_ctx.GetThreadPtr(); @@ -320,7 +317,7 @@ protected: // If you are already at the bottom of the stack, then just warn // and don't reset the frame. result.AppendError("Already at the bottom of the stack."); - return false; + return; } else frame_idx = 0; } @@ -345,7 +342,7 @@ protected: // If we are already at the top of the stack, just warn and don't // reset the frame. result.AppendError("Already at the top of the stack."); - return false; + return; } else frame_idx = num_frames - 1; } @@ -359,14 +356,14 @@ protected: m_options.GenerateOptionUsage( result.GetErrorStream(), *this, GetCommandInterpreter().GetDebugger().GetTerminalWidth()); - return false; + return; } if (command.GetArgumentCount() == 1) { if (command[0].ref().getAsInteger(0, frame_idx)) { result.AppendErrorWithFormat("invalid frame index argument '%s'.", command[0].c_str()); - return false; + return; } } else if (command.GetArgumentCount() == 0) { frame_idx = thread->GetSelectedFrameIndex(SelectMostRelevantFrame); @@ -385,8 +382,6 @@ protected: result.AppendErrorWithFormat("Frame index (%u) out of range.\n", frame_idx); } - - return result.Succeeded(); } CommandOptions m_options; @@ -524,7 +519,7 @@ protected: return std::nullopt; } - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { // No need to check "frame" for validity as eCommandRequiresFrame ensures // it is valid StackFrame *frame = m_exe_ctx.GetFramePtr(); @@ -733,13 +728,11 @@ protected: m_cmd_name); // Increment statistics. - bool res = result.Succeeded(); TargetStats &target_stats = GetSelectedOrDummyTarget().GetStatistics(); - if (res) + if (result.Succeeded()) target_stats.GetFrameVariableStats().NotifySuccess(); else target_stats.GetFrameVariableStats().NotifyFailure(); - return res; } OptionGroupOptions m_option_group; @@ -821,7 +814,7 @@ private: Options *GetOptions() override { return &m_options; } protected: - bool DoExecute(Args &command, CommandReturnObject &result) override; + void DoExecute(Args &command, CommandReturnObject &result) override; public: CommandObjectFrameRecognizerAdd(CommandInterpreter &interpreter) @@ -877,33 +870,33 @@ Process 1234 stopped ~CommandObjectFrameRecognizerAdd() override = default; }; -bool CommandObjectFrameRecognizerAdd::DoExecute(Args &command, +void CommandObjectFrameRecognizerAdd::DoExecute(Args &command, CommandReturnObject &result) { #if LLDB_ENABLE_PYTHON if (m_options.m_class_name.empty()) { result.AppendErrorWithFormat( "%s needs a Python class name (-l argument).\n", m_cmd_name.c_str()); - return false; + return; } if (m_options.m_module.empty()) { result.AppendErrorWithFormat("%s needs a module name (-s argument).\n", m_cmd_name.c_str()); - return false; + return; } if (m_options.m_symbols.empty()) { result.AppendErrorWithFormat( "%s needs at least one symbol name (-n argument).\n", m_cmd_name.c_str()); - return false; + return; } if (m_options.m_regex && m_options.m_symbols.size() > 1) { result.AppendErrorWithFormat( "%s needs only one symbol regular expression (-n argument).\n", m_cmd_name.c_str()); - return false; + return; } ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter(); @@ -934,7 +927,6 @@ bool CommandObjectFrameRecognizerAdd::DoExecute(Args &command, #endif result.SetStatus(eReturnStatusSuccessFinishNoResult); - return result.Succeeded(); } class CommandObjectFrameRecognizerClear : public CommandObjectParsed { @@ -946,12 +938,11 @@ public: ~CommandObjectFrameRecognizerClear() override = default; protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { GetSelectedOrDummyTarget() .GetFrameRecognizerManager() .RemoveAllRecognizers(); result.SetStatus(eReturnStatusSuccessFinishResult); - return result.Succeeded(); } }; @@ -995,33 +986,33 @@ public: } protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { if (command.GetArgumentCount() == 0) { if (!m_interpreter.Confirm( "About to delete all frame recognizers, do you want to do that?", true)) { result.AppendMessage("Operation cancelled..."); - return false; + return; } GetSelectedOrDummyTarget() .GetFrameRecognizerManager() .RemoveAllRecognizers(); result.SetStatus(eReturnStatusSuccessFinishResult); - return result.Succeeded(); + return; } if (command.GetArgumentCount() != 1) { result.AppendErrorWithFormat("'%s' takes zero or one arguments.\n", m_cmd_name.c_str()); - return false; + return; } uint32_t recognizer_id; if (!llvm::to_integer(command.GetArgumentAtIndex(0), recognizer_id)) { result.AppendErrorWithFormat("'%s' is not a valid recognizer id.\n", command.GetArgumentAtIndex(0)); - return false; + return; } if (!GetSelectedOrDummyTarget() @@ -1029,10 +1020,9 @@ protected: .RemoveRecognizerWithID(recognizer_id)) { result.AppendErrorWithFormat("'%s' is not a valid recognizer id.\n", command.GetArgumentAtIndex(0)); - return false; + return; } result.SetStatus(eReturnStatusSuccessFinishResult); - return result.Succeeded(); } }; @@ -1046,7 +1036,7 @@ public: ~CommandObjectFrameRecognizerList() override = default; protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { bool any_printed = false; GetSelectedOrDummyTarget().GetFrameRecognizerManager().ForEach( [&result, &any_printed]( @@ -1078,7 +1068,6 @@ protected: result.GetOutputStream().PutCString("no matching results found.\n"); result.SetStatus(eReturnStatusSuccessFinishNoResult); } - return result.Succeeded(); } }; @@ -1107,35 +1096,35 @@ public: ~CommandObjectFrameRecognizerInfo() override = default; protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { const char *frame_index_str = command.GetArgumentAtIndex(0); uint32_t frame_index; if (!llvm::to_integer(frame_index_str, frame_index)) { result.AppendErrorWithFormat("'%s' is not a valid frame index.", frame_index_str); - return false; + return; } Process *process = m_exe_ctx.GetProcessPtr(); if (process == nullptr) { result.AppendError("no process"); - return false; + return; } Thread *thread = m_exe_ctx.GetThreadPtr(); if (thread == nullptr) { result.AppendError("no thread"); - return false; + return; } if (command.GetArgumentCount() != 1) { result.AppendErrorWithFormat( "'%s' takes exactly one frame index argument.\n", m_cmd_name.c_str()); - return false; + return; } StackFrameSP frame_sp = thread->GetStackFrameAtIndex(frame_index); if (!frame_sp) { result.AppendErrorWithFormat("no frame with index %u", frame_index); - return false; + return; } auto recognizer = GetSelectedOrDummyTarget() @@ -1152,7 +1141,6 @@ protected: } output_stream.EOL(); result.SetStatus(eReturnStatusSuccessFinishResult); - return result.Succeeded(); } }; |