[Lldb-commits] [lldb] r180971 - If HandleCommands is called with add_to_history set to false, turn on the m_command_source_depth so that when we forget the value for regex & alias commands it still stays off.

Jim Ingham jingham at apple.com
Thu May 2 16:15:37 PDT 2013


Author: jingham
Date: Thu May  2 18:15:37 2013
New Revision: 180971

URL: http://llvm.org/viewvc/llvm-project?rev=180971&view=rev
Log:
If HandleCommands is called with add_to_history set to false, turn on the m_command_source_depth so that when we forget the value for regex & alias commands it still stays off.

<rdar://problem/13795202>

Modified:
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=180971&r1=180970&r2=180971&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu May  2 18:15:37 2013
@@ -1504,7 +1504,6 @@ CommandInterpreter::HandleCommand (const
     if (!no_context_switching)
         UpdateExecutionContext (override_context);
     
-    // <rdar://problem/11328896>
     bool add_to_history;
     if (lazy_add_to_history == eLazyBoolCalculate)
         add_to_history = (m_command_source_depth == 0);
@@ -2513,10 +2512,17 @@ CommandInterpreter::HandleCommands (cons
         CommandReturnObject tmp_result;
         // If override_context is not NULL, pass no_context_switching = true for
         // HandleCommand() since we updated our context already.
+        
+        // We might call into a regex or alias command, in which case the add_to_history will get lost.  This
+        // m_command_source_depth dingus is the way we turn off adding to the history in that case, so set it up here.
+        if (!add_to_history)
+            m_command_source_depth++;
         bool success = HandleCommand(cmd, add_to_history, tmp_result,
                                      NULL, /* override_context */
                                      true, /* repeat_on_empty_command */
                                      override_context != NULL /* no_context_switching */);
+        if (!add_to_history)
+            m_command_source_depth--;
         
         if (print_results)
         {





More information about the lldb-commits mailing list