[Lldb-commits] [lldb] r183719 - <rdar://problem/12876503>

Enrico Granata egranata at apple.com
Mon Jun 10 18:26:35 PDT 2013


Author: enrico
Date: Mon Jun 10 20:26:35 2013
New Revision: 183719

URL: http://llvm.org/viewvc/llvm-project?rev=183719&view=rev
Log:
<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


Modified:
    lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
    lldb/trunk/source/Commands/CommandObjectCommands.cpp
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=183719&r1=183718&r2=183719&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Mon Jun 10 20:26:35 2013
@@ -440,6 +440,9 @@ public:
     bool
     GetPromptOnQuit () const;
 
+    bool
+    GetStopCmdSourceOnError () const;
+    
 protected:
     friend class Debugger;
 

Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=183719&r1=183718&r2=183719&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Mon Jun 10 20:26:35 2013
@@ -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,

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=183719&r1=183718&r2=183719&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Mon Jun 10 20:26:35 2013
@@ -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 () c
     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 ()
 {





More information about the lldb-commits mailing list