diff options
author | Enrico Granata <egranata@apple.com> | 2013-06-11 01:26:35 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2013-06-11 01:26:35 +0000 |
commit | 012d4fcaf08bea6bb93647c420e53f72fcf6241e (patch) | |
tree | c638fb1ab166f1d445679948b019467cf8cefe47 /lldb/source | |
parent | 61f615af81993a3d63a9d09adacb00cc84a02888 (diff) | |
download | bcm5719-llvm-012d4fcaf08bea6bb93647c420e53f72fcf6241e.tar.gz bcm5719-llvm-012d4fcaf08bea6bb93647c420e53f72fcf6241e.zip |
<rdar://problem/12876503>
Adding a new setting interpreter.stop-command-source-on-error that dictates a default behavior for whether command source should stop upon hitting an error
You can still override the setting for each individual invocation with the usual -e setting
llvm-svn: 183719
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/Commands/CommandObjectCommands.cpp | 15 | ||||
-rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 11 |
2 files changed, 19 insertions, 7 deletions
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index 5964eacce55..737a449dbc3 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -25,6 +25,7 @@ #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandObjectRegexCommand.h" #include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Interpreter/OptionValueBoolean.h" #include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/ScriptInterpreter.h" #include "lldb/Interpreter/ScriptInterpreterPython.h" @@ -225,7 +226,8 @@ protected: public: CommandOptions (CommandInterpreter &interpreter) : - Options (interpreter) + Options (interpreter), + m_stop_on_error (true) { } @@ -242,7 +244,7 @@ protected: switch (short_option) { case 'e': - m_stop_on_error = Args::StringToBoolean(option_arg, true, &success); + m_stop_on_error.SetCurrentValue(Args::StringToBoolean(option_arg, true, &success)); if (!success) error.SetErrorStringWithFormat("invalid value for stop-on-error: %s", option_arg); break; @@ -262,7 +264,7 @@ protected: void OptionParsingStarting () { - m_stop_on_error = true; + m_stop_on_error.Clear(); m_stop_on_continue = true; } @@ -278,7 +280,7 @@ protected: // Instance variables to hold the values for command options. - bool m_stop_on_error; + OptionValueBoolean m_stop_on_error; bool m_stop_on_continue; }; @@ -296,11 +298,12 @@ protected: ExecutionContext *exe_ctx = NULL; // Just use the default context. bool echo_commands = true; bool print_results = true; + bool stop_on_error = m_options.m_stop_on_error.OptionWasSet() ? (bool)m_options.m_stop_on_error : m_interpreter.GetStopCmdSourceOnError(); - m_interpreter.HandleCommandsFromFile (cmd_file, + m_interpreter.HandleCommandsFromFile (cmd_file, exe_ctx, m_options.m_stop_on_continue, - m_options.m_stop_on_error, + stop_on_error, echo_commands, print_results, eLazyBoolCalculate, diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index a57db4860b9..8a4a0ca477b 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -75,13 +75,15 @@ g_properties[] = { { "expand-regex-aliases", OptionValue::eTypeBoolean, true, false, NULL, NULL, "If true, regular expression alias commands will show the expanded command that will be executed. This can be used to debug new regular expression alias commands." }, { "prompt-on-quit", OptionValue::eTypeBoolean, true, true, NULL, NULL, "If true, LLDB will prompt you before quitting if there are any live processes being debugged. If false, LLDB will quit without asking in any case." }, + { "stop-command-source-on-error", OptionValue::eTypeBoolean, true, true, NULL, NULL, "If true, LLDB will stop running a 'command source' script upon encountering an error." }, { NULL , OptionValue::eTypeInvalid, true, 0 , NULL, NULL, NULL } }; enum { ePropertyExpandRegexAliases = 0, - ePropertyPromptOnQuit = 1 + ePropertyPromptOnQuit = 1, + ePropertyStopCmdSourceOnError = 2 }; ConstString & @@ -132,6 +134,13 @@ CommandInterpreter::GetPromptOnQuit () const return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0); } +bool +CommandInterpreter::GetStopCmdSourceOnError () const +{ + const uint32_t idx = ePropertyStopCmdSourceOnError; + return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0); +} + void CommandInterpreter::Initialize () { |