Author: jdevlieghere Date: Wed May 1 18:54:02 2019 New Revision: 359750 URL: http://llvm.org/viewvc/llvm-project?rev=359750&view=rev Log: [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 Added: lldb/trunk/lit/Commands/command-source.test Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp Added: lldb/trunk/lit/Commands/command-source.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Commands/command-source.test?rev=359750&view=auto ============================================================================== --- lldb/trunk/lit/Commands/command-source.test (added) +++ lldb/trunk/lit/Commands/command-source.test Wed May 1 18:54:02 2019 @@ -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 Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=359750&r1=359749&r2=359750&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Wed May 1 18:54:02 2019 @@ -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()) { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits