aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
authorMed Ismail Bennani <medismail.bennani@gmail.com>2021-03-05 18:30:48 +0000
committerMed Ismail Bennani <medismail.bennani@gmail.com>2021-03-05 19:33:32 +0100
commit36eab4634f4cd4594e6d1409a66bc8f2d8fda04f (patch)
treeee2e1b0ee7e2ac274364eaaaafd7344b898c0401 /lldb/source/Interpreter/CommandInterpreter.cpp
parentf8b01d54c31547f3ecb25fb8a1912183026bffa7 (diff)
downloadllvm-36eab4634f4cd4594e6d1409a66bc8f2d8fda04f.zip
llvm-36eab4634f4cd4594e6d1409a66bc8f2d8fda04f.tar.gz
llvm-36eab4634f4cd4594e6d1409a66bc8f2d8fda04f.tar.bz2
[lldb/Interpreter] Add `interpreter.repeat-previous-command` setting
This patch introduces a new interpreter setting to prevent LLDB from re-executing the previous command when passing an empty command. This can be very useful when performing actions that requires a long time to complete. To preserve the original behaviour, the setting defaults to `true`. rdar://74983516 Differential Revision: https://reviews.llvm.org/D97999 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index b0ff634..eeef14b 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -223,6 +223,12 @@ bool CommandInterpreter::GetSpaceReplPrompts() const {
nullptr, idx, g_interpreter_properties[idx].default_uint_value != 0);
}
+bool CommandInterpreter::GetRepeatPreviousCommand() const {
+ const uint32_t idx = ePropertyRepeatPreviousCommand;
+ return m_collection_sp->GetPropertyAtIndexAsBoolean(
+ nullptr, idx, g_interpreter_properties[idx].default_uint_value != 0);
+}
+
void CommandInterpreter::Initialize() {
LLDB_SCOPED_TIMER();
@@ -1695,6 +1701,11 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
}
if (empty_command) {
+ if (!GetRepeatPreviousCommand()) {
+ result.SetStatus(eReturnStatusSuccessFinishNoResult);
+ return true;
+ }
+
if (m_command_history.IsEmpty()) {
result.AppendError("empty command");
result.SetStatus(eReturnStatusFailed);