diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2020-05-01 11:29:07 -0700 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2020-05-01 11:29:28 -0700 |
commit | 1bff0928f52b3d6602bae085c9590a1d807c2910 (patch) | |
tree | a0fd6d2615a066919426bba9555af44b00ef5aed /lldb/source/Interpreter/CommandInterpreter.cpp | |
parent | 5c86b08a6f62e67b0a6cbbee3f70a2b009daa857 (diff) | |
download | llvm-1bff0928f52b3d6602bae085c9590a1d807c2910.zip llvm-1bff0928f52b3d6602bae085c9590a1d807c2910.tar.gz llvm-1bff0928f52b3d6602bae085c9590a1d807c2910.tar.bz2 |
[lldb/CommandInterpreter] Add CommandInterpreterRunResult (NFC)
This patch adds a new class CommandInterpreterRunResult which will be
backing the SBCommandInterpreterRunResult. It keeps track of the number
of errors as well as the result which is an enum, as proposed by Pavel
in D79120. The command interpreter now populates the results directly,
instead of its own member variables.
Differential revision: https://reviews.llvm.org/D79209
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 2be5ca0..d765cb7 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -116,8 +116,7 @@ CommandInterpreter::CommandInterpreter(Debugger &debugger, m_skip_lldbinit_files(false), m_skip_app_init_files(false), m_command_io_handler_sp(), m_comment_char('#'), m_batch_command_mode(false), m_truncation_warning(eNoTruncation), - m_command_source_depth(0), m_num_errors(0), m_quit_requested(false), - m_stopped_for_crash(false) { + m_command_source_depth(0) { SetEventName(eBroadcastBitThreadShouldExit, "thread-should-exit"); SetEventName(eBroadcastBitResetPrompt, "reset-prompt"); SetEventName(eBroadcastBitQuitCommandReceived, "quit"); @@ -2816,23 +2815,24 @@ void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler, break; case eReturnStatusFailed: - m_num_errors++; + m_result.IncrementNumberOfErrors(); if (io_handler.GetFlags().Test(eHandleCommandFlagStopOnError)) io_handler.SetIsDone(true); break; case eReturnStatusQuit: - m_quit_requested = true; + m_result.SetResult(lldb::eCommandInterpreterResultQuitRequested); io_handler.SetIsDone(true); break; } // Finally, if we're going to stop on crash, check that here: - if (!m_quit_requested && result.GetDidChangeProcessState() && + if (m_result.IsResult(lldb::eCommandInterpreterResultSuccess) && + result.GetDidChangeProcessState() && io_handler.GetFlags().Test(eHandleCommandFlagStopOnCrash) && DidProcessStopAbnormally()) { io_handler.SetIsDone(true); - m_stopped_for_crash = true; + m_result.SetResult(lldb::eCommandInterpreterResultInferiorCrash); } } @@ -2950,13 +2950,13 @@ CommandInterpreter::GetIOHandler(bool force_create, return m_command_io_handler_sp; } -void CommandInterpreter::RunCommandInterpreter( +CommandInterpreterRunResult CommandInterpreter::RunCommandInterpreter( CommandInterpreterRunOptions &options) { // Always re-create the command interpreter when we run it in case any file // handles have changed. bool force_create = true; m_debugger.RunIOHandlerAsync(GetIOHandler(force_create, &options)); - m_stopped_for_crash = false; + m_result = CommandInterpreterRunResult(); if (options.GetAutoHandleEvents()) m_debugger.StartEventHandlerThread(); @@ -2969,6 +2969,8 @@ void CommandInterpreter::RunCommandInterpreter( if (options.GetAutoHandleEvents()) m_debugger.StopEventHandlerThread(); } + + return m_result; } CommandObject * |