[Lldb-commits] [lldb] r207164 - Make sure that the CommandInterpreter::m_command_io_handler_sp gets reset when we quit.

Greg Clayton gclayton at apple.com
Thu Apr 24 17:35:14 PDT 2014


Author: gclayton
Date: Thu Apr 24 19:35:14 2014
New Revision: 207164

URL: http://llvm.org/viewvc/llvm-project?rev=207164&view=rev
Log:
Make sure that the CommandInterpreter::m_command_io_handler_sp gets reset when we quit.

Currently if you run _any_ python, python has the "lldb.debugger" global variable and it has a strong reference to a lldb_private::Debugger since it is a lldb::SBDebugger object with a shared pointer.

This makes sure that your LLDB command interpreter history is saved each time you quit command line LLDB.


Modified:
    lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
    lldb/trunk/source/Core/Debugger.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=207164&r1=207163&r2=207164&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Thu Apr 24 19:35:14 2014
@@ -332,6 +332,9 @@ public:
 
     void
     Initialize ();
+    
+    void
+    Clear ();
 
     void
     SetScriptLanguage (lldb::ScriptLanguage lang);

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=207164&r1=207163&r2=207164&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Thu Apr 24 19:35:14 2014
@@ -696,6 +696,8 @@ Debugger::Clear()
     m_terminal_state.Clear();
     if (m_input_file_sp)
         m_input_file_sp->GetFile().Close ();
+    
+    m_command_interpreter_ap->Clear();
 }
 
 bool

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=207164&r1=207163&r2=207164&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu Apr 24 19:35:14 2014
@@ -351,6 +351,12 @@ CommandInterpreter::Initialize ()
     }
 }
 
+void
+CommandInterpreter::Clear()
+{
+    m_command_io_handler_sp.reset();
+}
+
 const char *
 CommandInterpreter::ProcessEmbeddedScriptCommands (const char *arg)
 {





More information about the lldb-commits mailing list