From 1c19b74cef3ce49ae081986f0fc6d6a23faa9bca Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 2 May 2019 01:54:02 +0000 Subject: [PATCH] [CommandObjectCommands] Honor stop-command-source-on-error This patch ensures that we honor the stop-command-source-on-error setting from `command source`. The problem is that we didn't differentiate between the boolean value being true or false, or not being set. For the latter scenario, we should calculate the value in the command interpreter based on the global options. Differential revision: https://reviews.llvm.org/D61406 llvm-svn: 359750 --- lldb/lit/Commands/command-source.test | 12 ++++++++++++ lldb/source/Commands/CommandObjectCommands.cpp | 9 +++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 lldb/lit/Commands/command-source.test diff --git a/lldb/lit/Commands/command-source.test b/lldb/lit/Commands/command-source.test new file mode 100644 index 000000000000..f8637dc0d5fc --- /dev/null +++ b/lldb/lit/Commands/command-source.test @@ -0,0 +1,12 @@ +# Check that stop command source on error. + +# RUN: %lldb -x -b -o "command source -e 1 %s" 2>&1 | FileCheck %s --check-prefix STOP +# RUN: %lldb -x -b -o "command source -e 0 %s" 2>&1 | FileCheck %s --check-prefix CONTINUE +# RUN: %lldb -x -b -o 'settings set interpreter.stop-command-source-on-error true' -o "command source %s" 2>&1 | FileCheck %s --check-prefix STOP +# RUN: %lldb -x -b -o 'settings set interpreter.stop-command-source-on-error false' -o "command source %s" 2>&1 | FileCheck %s --check-prefix CONTINUE + +bogus +p 10+1 + +# CONTINUE: 11 +# STOP-NOT: 11 diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index cd0c2f1007dd..70251717c232 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -309,8 +309,13 @@ protected: m_options.m_stop_on_continue.OptionWasSet()) { // Use user set settings CommandInterpreterRunOptions options; - options.SetStopOnContinue(m_options.m_stop_on_continue.GetCurrentValue()); - options.SetStopOnError(m_options.m_stop_on_error.GetCurrentValue()); + + if (m_options.m_stop_on_continue.OptionWasSet()) + options.SetStopOnContinue( + m_options.m_stop_on_continue.GetCurrentValue()); + + if (m_options.m_stop_on_error.OptionWasSet()) + options.SetStopOnError(m_options.m_stop_on_error.GetCurrentValue()); // Individual silent setting is override for global command echo settings. if (m_options.m_silent_run.GetCurrentValue()) {