[llvm-branch-commits] [lldb] r199433 - Added a way to check if the lldb command interpreter is the active IO handler. The Xcode UI does its own history and needs to know when the user presses enter and when to be able to send the last command.

Greg Clayton gclayton at apple.com
Thu Jan 16 14:26:23 PST 2014


Author: gclayton
Date: Thu Jan 16 16:26:22 2014
New Revision: 199433

URL: http://llvm.org/viewvc/llvm-project?rev=199433&view=rev
Log:
Added a way to check if the lldb command interpreter is the active IO handler. The Xcode UI does its own history and needs to know when the user presses enter and when to be able to send the last command.



Modified:
    lldb/branches/iohandler/include/lldb/API/SBCommandInterpreter.h
    lldb/branches/iohandler/include/lldb/Core/Debugger.h
    lldb/branches/iohandler/include/lldb/Interpreter/CommandInterpreter.h
    lldb/branches/iohandler/scripts/Python/interface/SBCommandInterpreter.i
    lldb/branches/iohandler/source/API/SBCommandInterpreter.cpp
    lldb/branches/iohandler/source/Core/Debugger.cpp
    lldb/branches/iohandler/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/branches/iohandler/include/lldb/API/SBCommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/API/SBCommandInterpreter.h?rev=199433&r1=199432&r2=199433&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/API/SBCommandInterpreter.h (original)
+++ lldb/branches/iohandler/include/lldb/API/SBCommandInterpreter.h Thu Jan 16 16:26:22 2014
@@ -122,6 +122,16 @@ public:
     
     SBCommandInterpreter (lldb_private::CommandInterpreter *interpreter_ptr = NULL);   // Access using SBDebugger::GetCommandInterpreter();
     
+    //----------------------------------------------------------------------
+    /// Return true if the command interpreter is the active IO handler.
+    ///
+    /// This indicates that any input coming into the debugger handles will
+    /// go to the command interpreter and will result in LLDB command line
+    /// commands being executed.
+    //----------------------------------------------------------------------
+    bool
+    IsActive ();
+
 protected:
 
     lldb_private::CommandInterpreter &

Modified: lldb/branches/iohandler/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Core/Debugger.h?rev=199433&r1=199432&r2=199433&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Core/Debugger.h (original)
+++ lldb/branches/iohandler/include/lldb/Core/Debugger.h Thu Jan 16 16:26:22 2014
@@ -210,6 +210,9 @@ public:
     RunIOHandler (const lldb::IOHandlerSP& reader_sp);
     
     bool
+    IsTopIOHandler (const lldb::IOHandlerSP& reader_sp);
+
+    bool
     HideTopIOHandler();
 
     void

Modified: lldb/branches/iohandler/include/lldb/Interpreter/CommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Interpreter/CommandInterpreter.h?rev=199433&r1=199432&r2=199433&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/branches/iohandler/include/lldb/Interpreter/CommandInterpreter.h Thu Jan 16 16:26:22 2014
@@ -434,6 +434,9 @@ public:
         return m_command_history;
     }
     
+    bool
+    IsActive ();
+
     void
     RunCommandInterpreter (bool auto_handle_events,
                            bool spawn_thread,

Modified: lldb/branches/iohandler/scripts/Python/interface/SBCommandInterpreter.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/scripts/Python/interface/SBCommandInterpreter.i?rev=199433&r1=199432&r2=199433&view=diff
==============================================================================
--- lldb/branches/iohandler/scripts/Python/interface/SBCommandInterpreter.i (original)
+++ lldb/branches/iohandler/scripts/Python/interface/SBCommandInterpreter.i Thu Jan 16 16:26:22 2014
@@ -120,6 +120,10 @@ public:
                       int match_start_point,
                       int max_return_elements,
                       lldb::SBStringList &matches);
+    
+    bool
+    IsActive ();
+
 };
 
 } // namespace lldb

Modified: lldb/branches/iohandler/source/API/SBCommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/API/SBCommandInterpreter.cpp?rev=199433&r1=199432&r2=199433&view=diff
==============================================================================
--- lldb/branches/iohandler/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/branches/iohandler/source/API/SBCommandInterpreter.cpp Thu Jan 16 16:26:22 2014
@@ -107,6 +107,14 @@ SBCommandInterpreter::AliasExists (const
     return false;
 }
 
+bool
+SBCommandInterpreter::IsActive ()
+{
+    if (m_opaque_ptr)
+        return m_opaque_ptr->IsActive ();
+    return false;
+}
+
 lldb::ReturnStatus
 SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnObject &result, bool add_to_history)
 {

Modified: lldb/branches/iohandler/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Core/Debugger.cpp?rev=199433&r1=199432&r2=199433&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Core/Debugger.cpp (original)
+++ lldb/branches/iohandler/source/Core/Debugger.cpp Thu Jan 16 16:26:22 2014
@@ -878,6 +878,14 @@ Debugger::ExecuteIOHanders()
     ClearIOHandlers();
 }
 
+bool
+Debugger::IsTopIOHandler (const lldb::IOHandlerSP& reader_sp)
+{
+    IOHandlerSP top_reader_sp (m_input_reader_stack.Top());
+    return top_reader_sp.get() == reader_sp.get();
+}
+
+
 void
 Debugger::RunIOHandler (const IOHandlerSP& reader_sp)
 {

Modified: lldb/branches/iohandler/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Interpreter/CommandInterpreter.cpp?rev=199433&r1=199432&r2=199433&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/branches/iohandler/source/Interpreter/CommandInterpreter.cpp Thu Jan 16 16:26:22 2014
@@ -2968,6 +2968,13 @@ CommandInterpreter::GetPythonCommandsFro
     }
 
 }
+
+bool
+CommandInterpreter::IsActive ()
+{
+    return m_debugger.IsTopIOHandler (m_command_io_handler_sp);
+}
+
 void
 CommandInterpreter::RunCommandInterpreter(bool auto_handle_events,
                                           bool spawn_thread,





More information about the llvm-branch-commits mailing list