Rebase against ToT

http://reviews.llvm.org/D7957

Files:
  cmake/LLDBDependencies.cmake
  cmake/modules/LLDBConfig.cmake
  include/lldb/API/SBBreakpointLocation.h
  include/lldb/API/SBCommandInterpreter.h
  include/lldb/API/SBFrame.h
  include/lldb/API/bindings/Python/ScriptInterpreterPython.h
  include/lldb/DataFormatters/TypeSummary.h
  include/lldb/Interpreter/CommandInterpreter.h
  include/lldb/ScriptInterpreter/ScriptInterpreter.h
  include/lldb/ScriptInterpreter/ScriptInterpreterNone.h
  include/lldb/lldb-forward.h
  source/API/Bindings/CMakeLists.txt
  source/API/Bindings/Python/CMakeLists.txt
  source/API/Bindings/Python/PythonDataObjects.cpp
  source/API/Bindings/Python/ScriptInterpreterPython.cpp
  source/API/CMakeLists.txt
  source/API/SBBreakpoint.cpp
  source/API/SBBreakpointLocation.cpp
  source/API/SBCommandInterpreter.cpp
  source/API/SBDebugger.cpp
  source/API/SBTypeCategory.cpp
  source/CMakeLists.txt
  source/Commands/CommandObjectCommands.cpp
  source/Core/Module.cpp
  source/Core/ValueObject.cpp
  source/DataFormatters/FormatManager.cpp
  source/DataFormatters/TypeSynthetic.cpp
  source/Interpreter/CMakeLists.txt
  source/Interpreter/CommandInterpreter.cpp
  source/Interpreter/CommandObject.cpp
  source/Interpreter/CommandObjectScript.cpp
  source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
  source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
  source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/ScriptInterpreter/CMakeLists.txt
  source/ScriptInterpreter/ScriptInterpreter.cpp
  source/ScriptInterpreter/ScriptInterpreterNone.cpp
  source/Target/ThreadPlanPython.cpp
  source/lldb.cpp
  tools/driver/CMakeLists.txt
  tools/lldb-server/CMakeLists.txt

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: cmake/LLDBDependencies.cmake
===================================================================
--- cmake/LLDBDependencies.cmake
+++ cmake/LLDBDependencies.cmake
@@ -56,6 +56,7 @@
   lldbPluginSystemRuntimeMacOSX
   lldbPluginProcessElfCore
   lldbPluginJITLoaderGDB
+  lldbScriptInterpreter
   )
 
 # Windows-only libraries
@@ -107,6 +108,10 @@
     )
 endif()
 
+if (NOT LLDB_DISABLE_PYTHON)
+  list(APPEND LLDB_USED_LIBS lldbPythonInterpreter)
+endif()
+
 set( CLANG_USED_LIBS
   clangAnalysis
   clangAST
Index: cmake/modules/LLDBConfig.cmake
===================================================================
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -25,7 +25,7 @@
   "Enables using new Python scripts for SWIG API generation .")  
 
 set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
-set(LLDB_INCLUDE_ROOT "${LLDB_INCLUDE_ROOT}/include")
+set(LLDB_INCLUDE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include")
 
 set(LLDB_DISABLE_PYTHON 0 CACHE BOOL "Disables the Python scripting integration.")
 
Index: include/lldb/API/SBBreakpointLocation.h
===================================================================
--- include/lldb/API/SBBreakpointLocation.h
+++ include/lldb/API/SBBreakpointLocation.h
@@ -101,9 +101,6 @@
 
 private:
     friend class SBBreakpoint;
-#ifndef LLDB_DISABLE_PYTHON
-    friend class lldb_private::ScriptInterpreterPython;
-#endif
     void
     SetLocation (const lldb::BreakpointLocationSP &break_loc_sp);
 
Index: include/lldb/API/SBCommandInterpreter.h
===================================================================
--- include/lldb/API/SBCommandInterpreter.h
+++ include/lldb/API/SBCommandInterpreter.h
@@ -229,9 +229,6 @@
 private:
     friend class SBDebugger;
 
-    static void
-    InitializeSWIG ();
-
     lldb_private::CommandInterpreter *m_opaque_ptr;
 };
 
Index: include/lldb/API/SBFrame.h
===================================================================
--- include/lldb/API/SBFrame.h
+++ include/lldb/API/SBFrame.h
@@ -213,9 +213,6 @@
     friend class SBInstruction;
     friend class SBThread;
     friend class SBValue;
-#ifndef LLDB_DISABLE_PYTHON
-    friend class lldb_private::ScriptInterpreterPython;
-#endif
 
     lldb::StackFrameSP
     GetFrameSP() const;
Index: include/lldb/API/bindings/Python/ScriptInterpreterPython.h
===================================================================
--- include/lldb/API/bindings/Python/ScriptInterpreterPython.h
+++ include/lldb/API/bindings/Python/ScriptInterpreterPython.h
@@ -20,8 +20,8 @@
 #include "lldb/lldb-python.h"
 #include "lldb/lldb-private.h"
 #include "lldb/Core/IOHandler.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
-#include "lldb/Interpreter/PythonDataObjects.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
+#include "lldb/API/Bindings/Python/PythonDataObjects.h"
 #include "lldb/Host/Terminal.h"
 
 class IOHandlerPythonInterpreter;
@@ -288,32 +288,6 @@
     static void
     InitializePrivate ();
 
-    static void
-    InitializeInterpreter (SWIGInitCallback python_swig_init_callback,
-                           SWIGBreakpointCallbackFunction swig_breakpoint_callback,
-                           SWIGWatchpointCallbackFunction swig_watchpoint_callback,
-                           SWIGPythonTypeScriptCallbackFunction swig_typescript_callback,
-                           SWIGPythonCreateSyntheticProvider swig_synthetic_script,
-                           SWIGPythonCalculateNumChildren swig_calc_children,
-                           SWIGPythonGetChildAtIndex swig_get_child_index,
-                           SWIGPythonGetIndexOfChildWithName swig_get_index_child,
-                           SWIGPythonCastPyObjectToSBValue swig_cast_to_sbvalue ,
-                           SWIGPythonGetValueObjectSPFromSBValue swig_get_valobj_sp_from_sbvalue,
-                           SWIGPythonUpdateSynthProviderInstance swig_update_provider,
-                           SWIGPythonMightHaveChildrenSynthProviderInstance swig_mighthavechildren_provider,
-                           SWIGPythonGetValueSynthProviderInstance swig_getvalue_provider,
-                           SWIGPythonCallCommand swig_call_command,
-                           SWIGPythonCallModuleInit swig_call_module_init,
-                           SWIGPythonCreateOSPlugin swig_create_os_plugin,
-                           SWIGPythonScriptKeyword_Process swig_run_script_keyword_process,
-                           SWIGPythonScriptKeyword_Thread swig_run_script_keyword_thread,
-                           SWIGPythonScriptKeyword_Target swig_run_script_keyword_target,
-                           SWIGPythonScriptKeyword_Frame swig_run_script_keyword_frame,
-                           SWIGPythonScriptKeyword_Value swig_run_script_keyword_value,
-                           SWIGPython_GetDynamicSetting swig_plugin_get,
-                           SWIGPythonCreateScriptedThreadPlan swig_thread_plan_script,
-                           SWIGPythonCallThreadPlan swig_call_thread_plan);
-
     const char *
     GetDictionaryName ()
     {
Index: include/lldb/DataFormatters/TypeSummary.h
===================================================================
--- include/lldb/DataFormatters/TypeSummary.h
+++ include/lldb/DataFormatters/TypeSummary.h
@@ -26,7 +26,7 @@
 #include "lldb/Core/Error.h"
 #include "lldb/Core/FormatEntity.h"
 #include "lldb/Core/ValueObject.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
 #include "lldb/Symbol/Type.h"
 
 namespace lldb_private {
Index: include/lldb/Interpreter/CommandInterpreter.h
===================================================================
--- include/lldb/Interpreter/CommandInterpreter.h
+++ include/lldb/Interpreter/CommandInterpreter.h
@@ -14,6 +14,7 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
+#include "lldb/lldb-forward.h"
 #include "lldb/lldb-private.h"
 #include "lldb/Core/Broadcaster.h"
 #include "lldb/Core/Debugger.h"
@@ -21,7 +22,6 @@
 #include "lldb/Core/Log.h"
 #include "lldb/Interpreter/CommandHistory.h"
 #include "lldb/Interpreter/CommandObject.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
 #include "lldb/Core/Event.h"
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Core/StringList.h"
@@ -696,7 +696,7 @@
     OptionArgMap m_alias_options;               // Stores any options (with or without arguments) that go with any alias.
     CommandHistory m_command_history;
     std::string m_repeat_command;               // Stores the command that will be executed for an empty command string.
-    std::unique_ptr<ScriptInterpreter> m_script_interpreter_ap;
+    lldb::ScriptInterpreterUP m_script_interpreter_ap;
     lldb::IOHandlerSP m_command_io_handler_sp;
     char m_comment_char;
     bool m_batch_command_mode;
Index: include/lldb/ScriptInterpreter/ScriptInterpreter.h
===================================================================
--- include/lldb/ScriptInterpreter/ScriptInterpreter.h
+++ include/lldb/ScriptInterpreter/ScriptInterpreter.h
@@ -20,6 +20,8 @@
 
 namespace lldb_private {
 
+class CommandInterpreter;
+
 class ScriptInterpreterObject
 {
 public:
@@ -40,7 +42,7 @@
     {
         return m_object;
     }
-    
+
     explicit operator bool ()
     {
         return m_object != NULL;
@@ -81,88 +83,6 @@
 class ScriptInterpreter
 {
 public:
-
-    typedef void (*SWIGInitCallback) (void);
-
-    typedef bool (*SWIGBreakpointCallbackFunction) (const char *python_function_name,
-                                                    const char *session_dictionary_name,
-                                                    const lldb::StackFrameSP& frame_sp,
-                                                    const lldb::BreakpointLocationSP &bp_loc_sp);
-    
-    typedef bool (*SWIGWatchpointCallbackFunction) (const char *python_function_name,
-                                                    const char *session_dictionary_name,
-                                                    const lldb::StackFrameSP& frame_sp,
-                                                    const lldb::WatchpointSP &wp_sp);
-    
-    typedef bool (*SWIGPythonTypeScriptCallbackFunction) (const char *python_function_name,
-                                                          void *session_dictionary,
-                                                          const lldb::ValueObjectSP& valobj_sp,
-                                                          void** pyfunct_wrapper,
-                                                          const lldb::TypeSummaryOptionsSP& options,
-                                                          std::string& retval);
-    
-    typedef void* (*SWIGPythonCreateSyntheticProvider) (const char *python_class_name,
-                                                        const char *session_dictionary_name,
-                                                        const lldb::ValueObjectSP& valobj_sp);
-
-    typedef void* (*SWIGPythonCreateScriptedThreadPlan) (const char *python_class_name,
-                                                        const char *session_dictionary_name,
-                                                        const lldb::ThreadPlanSP& thread_plan_sp);
-
-    typedef bool (*SWIGPythonCallThreadPlan) (void *implementor, const char *method_name, Event *event_sp, bool &got_error);
-
-    typedef void* (*SWIGPythonCreateOSPlugin) (const char *python_class_name,
-                                               const char *session_dictionary_name,
-                                               const lldb::ProcessSP& process_sp);
-    
-    typedef uint32_t        (*SWIGPythonCalculateNumChildren)                   (void *implementor);
-    typedef void*           (*SWIGPythonGetChildAtIndex)                        (void *implementor, uint32_t idx);
-    typedef int             (*SWIGPythonGetIndexOfChildWithName)                (void *implementor, const char* child_name);
-    typedef void*           (*SWIGPythonCastPyObjectToSBValue)                  (void* data);
-    typedef lldb::ValueObjectSP  (*SWIGPythonGetValueObjectSPFromSBValue)       (void* data);
-    typedef bool            (*SWIGPythonUpdateSynthProviderInstance)            (void* data);
-    typedef bool            (*SWIGPythonMightHaveChildrenSynthProviderInstance) (void* data);
-    typedef void*           (*SWIGPythonGetValueSynthProviderInstance)          (void *implementor);
-    
-    typedef bool            (*SWIGPythonCallCommand)            (const char *python_function_name,
-                                                                 const char *session_dictionary_name,
-                                                                 lldb::DebuggerSP& debugger,
-                                                                 const char* args,
-                                                                 lldb_private::CommandReturnObject& cmd_retobj,
-                                                                 lldb::ExecutionContextRefSP exe_ctx_ref_sp);
-    
-    typedef bool            (*SWIGPythonCallModuleInit)         (const char *python_module_name,
-                                                                 const char *session_dictionary_name,
-                                                                 lldb::DebuggerSP& debugger);
-    
-    typedef bool            (*SWIGPythonScriptKeyword_Process)  (const char* python_function_name,
-                                                                 const char* session_dictionary_name,
-                                                                 lldb::ProcessSP& process,
-                                                                 std::string& output);
-    typedef bool            (*SWIGPythonScriptKeyword_Thread)   (const char* python_function_name,
-                                                                 const char* session_dictionary_name,
-                                                                 lldb::ThreadSP& thread,
-                                                                 std::string& output);
-    
-    typedef bool            (*SWIGPythonScriptKeyword_Target)   (const char* python_function_name,
-                                                                 const char* session_dictionary_name,
-                                                                 lldb::TargetSP& target,
-                                                                 std::string& output);
-
-    typedef bool            (*SWIGPythonScriptKeyword_Frame)    (const char* python_function_name,
-                                                                 const char* session_dictionary_name,
-                                                                 lldb::StackFrameSP& frame,
-                                                                 std::string& output);
-
-    typedef bool            (*SWIGPythonScriptKeyword_Value)    (const char* python_function_name,
-                                                                 const char* session_dictionary_name,
-                                                                 lldb::ValueObjectSP& value,
-                                                                 std::string& output);
-    
-    typedef void*           (*SWIGPython_GetDynamicSetting)     (void* module,
-                                                                 const char* setting,
-                                                                 const lldb::TargetSP& target_sp);
-
     typedef enum
     {
         eScriptReturnTypeCharPtr,
@@ -623,41 +543,18 @@
     int
     GetMasterFileDescriptor ();
 
-	CommandInterpreter &
-	GetCommandInterpreter ();
+    CommandInterpreter &GetCommandInterpreter();
 
     static std::string
     LanguageToString (lldb::ScriptLanguage language);
-    
-    static void
-    InitializeInterpreter (SWIGInitCallback python_swig_init_callback,
-                           SWIGBreakpointCallbackFunction swig_breakpoint_callback,
-                           SWIGWatchpointCallbackFunction swig_watchpoint_callback,
-                           SWIGPythonTypeScriptCallbackFunction swig_typescript_callback,
-                           SWIGPythonCreateSyntheticProvider swig_synthetic_script,
-                           SWIGPythonCalculateNumChildren swig_calc_children,
-                           SWIGPythonGetChildAtIndex swig_get_child_index,
-                           SWIGPythonGetIndexOfChildWithName swig_get_index_child,
-                           SWIGPythonCastPyObjectToSBValue swig_cast_to_sbvalue ,
-                           SWIGPythonGetValueObjectSPFromSBValue swig_get_valobj_sp_from_sbvalue,
-                           SWIGPythonUpdateSynthProviderInstance swig_update_provider,
-                           SWIGPythonMightHaveChildrenSynthProviderInstance swig_mighthavechildren_provider,
-                           SWIGPythonGetValueSynthProviderInstance swig_getvalue_provider,
-                           SWIGPythonCallCommand swig_call_command,
-                           SWIGPythonCallModuleInit swig_call_module_init,
-                           SWIGPythonCreateOSPlugin swig_create_os_plugin,
-                           SWIGPythonScriptKeyword_Process swig_run_script_keyword_process,
-                           SWIGPythonScriptKeyword_Thread swig_run_script_keyword_thread,
-                           SWIGPythonScriptKeyword_Target swig_run_script_keyword_target,
-                           SWIGPythonScriptKeyword_Frame swig_run_script_keyword_frame,
-                           SWIGPythonScriptKeyword_Value swig_run_script_keyword_value,
-                           SWIGPython_GetDynamicSetting swig_plugin_get,
-                           SWIGPythonCreateScriptedThreadPlan swig_thread_plan_script,
-                           SWIGPythonCallThreadPlan swig_call_thread_plan);
 
     virtual void
     ResetOutputFileHandle (FILE *new_fh) { } //By default, do nothing.
 
+    static ScriptInterpreter *GetScriptInterpreter(lldb::ScriptLanguage script_lang, CommandInterpreter &interpreter, bool can_create);
+
+    static void InitializePrivate();
+
 protected:
     CommandInterpreter &m_interpreter;
     lldb::ScriptLanguage m_script_lang;
Index: include/lldb/ScriptInterpreter/ScriptInterpreterNone.h
===================================================================
--- include/lldb/ScriptInterpreter/ScriptInterpreterNone.h
+++ include/lldb/ScriptInterpreter/ScriptInterpreterNone.h
@@ -10,7 +10,7 @@
 #ifndef liblldb_ScriptInterpreterNone_h_
 #define liblldb_ScriptInterpreterNone_h_
 
-#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
 
 namespace lldb_private {
 
Index: include/lldb/lldb-forward.h
===================================================================
--- include/lldb/lldb-forward.h
+++ include/lldb/lldb-forward.h
@@ -187,7 +187,6 @@
 class   ScriptInterpreterLocker;
 class   ScriptInterpreterObject;
 #ifndef LLDB_DISABLE_PYTHON
-class   ScriptInterpreterPython;
 struct  ScriptSummaryFormat;
 #endif
 class   SearchFilter;
@@ -380,6 +379,7 @@
     typedef std::shared_ptr<lldb_private::Queue> QueueSP;
     typedef std::weak_ptr<lldb_private::Queue> QueueWP;
     typedef std::shared_ptr<lldb_private::QueueItem> QueueItemSP;
+    typedef std::shared_ptr<lldb_private::ScriptInterpreter> ScriptInterpreterUP;
     typedef std::shared_ptr<lldb_private::ScriptInterpreterObject> ScriptInterpreterObjectSP;
 #ifndef LLDB_DISABLE_PYTHON
     typedef std::shared_ptr<lldb_private::ScriptSummaryFormat> ScriptSummaryFormatSP;
Index: source/API/Bindings/CMakeLists.txt
===================================================================
--- /dev/null
+++ source/API/Bindings/CMakeLists.txt
@@ -0,0 +1,3 @@
+if (NOT LLDB_DISABLE_PYTHON)
+  add_subdirectory(Python)
+endif()
\ No newline at end of file
Index: source/API/Bindings/Python/CMakeLists.txt
===================================================================
--- /dev/null
+++ source/API/Bindings/Python/CMakeLists.txt
@@ -0,0 +1,6 @@
+
+add_lldb_library(lldbPythonInterpreter
+  PythonDataObjects.cpp
+  ScriptInterpreterPython.cpp
+  )
+  
\ No newline at end of file
Index: source/API/Bindings/Python/PythonDataObjects.cpp
===================================================================
--- source/API/Bindings/Python/PythonDataObjects.cpp
+++ source/API/Bindings/Python/PythonDataObjects.cpp
@@ -19,10 +19,10 @@
 
 #include <stdio.h>
 
+#include "lldb/API/Bindings/Python/PythonDataObjects.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Host/File.h"
-#include "lldb/Interpreter/PythonDataObjects.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
 
 using namespace lldb_private;
 using namespace lldb;
Index: source/API/Bindings/Python/ScriptInterpreterPython.cpp
===================================================================
--- source/API/Bindings/Python/ScriptInterpreterPython.cpp
+++ source/API/Bindings/Python/ScriptInterpreterPython.cpp
@@ -16,13 +16,14 @@
 #else
 
 #include "lldb/lldb-python.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
+#include "lldb/API/Bindings/Python/ScriptInterpreterPython.h"
 
 #include <stdlib.h>
 #include <stdio.h>
 
 #include <string>
 
+#include "lldb/API/Bindings/Python/PythonDataObjects.h"
 #include "lldb/API/SBValue.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Breakpoint/StoppointCallbackContext.h"
@@ -37,7 +38,6 @@
 #include "lldb/Host/Pipe.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Interpreter/PythonDataObjects.h"
 #include "lldb/Target/Thread.h"
 #include "lldb/Target/ThreadPlan.h"
 
@@ -48,31 +48,74 @@
 using namespace lldb;
 using namespace lldb_private;
 
+// these are the Pythonic implementations of the required callbacks
+// these are scripting-language specific, which is why they belong here
+// we still need to use function pointers to them instead of relying
+// on linkage-time resolution because the SWIG stuff and this file
+// get built at different times
+// Defined in the SWIG source file
+extern "C" void init_lldb(void);
 
-static ScriptInterpreter::SWIGInitCallback g_swig_init_callback = nullptr;
-static ScriptInterpreter::SWIGBreakpointCallbackFunction g_swig_breakpoint_callback = nullptr;
-static ScriptInterpreter::SWIGWatchpointCallbackFunction g_swig_watchpoint_callback = nullptr;
-static ScriptInterpreter::SWIGPythonTypeScriptCallbackFunction g_swig_typescript_callback = nullptr;
-static ScriptInterpreter::SWIGPythonCreateSyntheticProvider g_swig_synthetic_script = nullptr;
-static ScriptInterpreter::SWIGPythonCalculateNumChildren g_swig_calc_children = nullptr;
-static ScriptInterpreter::SWIGPythonGetChildAtIndex g_swig_get_child_index = nullptr;
-static ScriptInterpreter::SWIGPythonGetIndexOfChildWithName g_swig_get_index_child = nullptr;
-static ScriptInterpreter::SWIGPythonCastPyObjectToSBValue g_swig_cast_to_sbvalue  = nullptr;
-static ScriptInterpreter::SWIGPythonGetValueObjectSPFromSBValue g_swig_get_valobj_sp_from_sbvalue = nullptr;
-static ScriptInterpreter::SWIGPythonUpdateSynthProviderInstance g_swig_update_provider = nullptr;
-static ScriptInterpreter::SWIGPythonMightHaveChildrenSynthProviderInstance g_swig_mighthavechildren_provider = nullptr;
-static ScriptInterpreter::SWIGPythonGetValueSynthProviderInstance g_swig_getvalue_provider = nullptr;
-static ScriptInterpreter::SWIGPythonCallCommand g_swig_call_command = nullptr;
-static ScriptInterpreter::SWIGPythonCallModuleInit g_swig_call_module_init = nullptr;
-static ScriptInterpreter::SWIGPythonCreateOSPlugin g_swig_create_os_plugin = nullptr;
-static ScriptInterpreter::SWIGPythonScriptKeyword_Process g_swig_run_script_keyword_process = nullptr;
-static ScriptInterpreter::SWIGPythonScriptKeyword_Thread g_swig_run_script_keyword_thread = nullptr;
-static ScriptInterpreter::SWIGPythonScriptKeyword_Target g_swig_run_script_keyword_target = nullptr;
-static ScriptInterpreter::SWIGPythonScriptKeyword_Frame g_swig_run_script_keyword_frame = nullptr;
-static ScriptInterpreter::SWIGPythonScriptKeyword_Value g_swig_run_script_keyword_value = nullptr;
-static ScriptInterpreter::SWIGPython_GetDynamicSetting g_swig_plugin_get = nullptr;
-static ScriptInterpreter::SWIGPythonCreateScriptedThreadPlan g_swig_thread_plan_script = nullptr;
-static ScriptInterpreter::SWIGPythonCallThreadPlan g_swig_call_thread_plan = nullptr;
+extern "C" bool LLDBSwigPythonBreakpointCallbackFunction(const char *python_function_name, const char *session_dictionary_name,
+                                                         const lldb::StackFrameSP &sb_frame, const lldb::BreakpointLocationSP &sb_bp_loc);
+
+extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(const char *python_function_name, const char *session_dictionary_name,
+                                                         const lldb::StackFrameSP &sb_frame, const lldb::WatchpointSP &sb_wp);
+
+extern "C" bool LLDBSwigPythonCallTypeScript(const char *python_function_name, void *session_dictionary,
+                                             const lldb::ValueObjectSP &valobj_sp, void **pyfunct_wrapper,
+                                             const lldb::TypeSummaryOptionsSP &options_sp, std::string &retval);
+
+extern "C" void *LLDBSwigPythonCreateSyntheticProvider(const char *python_class_name, const char *session_dictionary_name,
+                                                       const lldb::ValueObjectSP &valobj_sp);
+
+extern "C" void *LLDBSwigPythonCreateScriptedThreadPlan(const char *python_class_name, const char *session_dictionary_name,
+                                                        const lldb::ThreadPlanSP &thread_plan_sp);
+
+extern "C" bool LLDBSWIGPythonCallThreadPlan(void *implementor, const char *method_name, Event *event_sp, bool &got_error);
+
+extern "C" uint32_t LLDBSwigPython_CalculateNumChildren(void *implementor);
+
+extern "C" void *LLDBSwigPython_GetChildAtIndex(void *implementor, uint32_t idx);
+
+extern "C" int LLDBSwigPython_GetIndexOfChildWithName(void *implementor, const char *child_name);
+
+extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data);
+
+extern lldb::ValueObjectSP LLDBSWIGPython_GetValueObjectSPFromSBValue(void *data);
+
+extern "C" bool LLDBSwigPython_UpdateSynthProviderInstance(void *implementor);
+
+extern "C" bool LLDBSwigPython_MightHaveChildrenSynthProviderInstance(void *implementor);
+
+extern "C" void *LLDBSwigPython_GetValueSynthProviderInstance(void *implementor);
+
+extern "C" bool LLDBSwigPythonCallCommand(const char *python_function_name, const char *session_dictionary_name, lldb::DebuggerSP &debugger,
+                                          const char *args, lldb_private::CommandReturnObject &cmd_retobj,
+                                          lldb::ExecutionContextRefSP exe_ctx_ref_sp);
+
+extern "C" bool LLDBSwigPythonCallModuleInit(const char *python_module_name, const char *session_dictionary_name,
+                                             lldb::DebuggerSP &debugger);
+
+extern "C" void *LLDBSWIGPythonCreateOSPlugin(const char *python_class_name, const char *session_dictionary_name,
+                                              const lldb::ProcessSP &process_sp);
+
+extern "C" bool LLDBSWIGPythonRunScriptKeywordProcess(const char *python_function_name, const char *session_dictionary_name,
+                                                      lldb::ProcessSP &process, std::string &output);
+
+extern "C" bool LLDBSWIGPythonRunScriptKeywordThread(const char *python_function_name, const char *session_dictionary_name,
+                                                     lldb::ThreadSP &thread, std::string &output);
+
+extern "C" bool LLDBSWIGPythonRunScriptKeywordTarget(const char *python_function_name, const char *session_dictionary_name,
+                                                     lldb::TargetSP &target, std::string &output);
+
+extern "C" bool LLDBSWIGPythonRunScriptKeywordFrame(const char *python_function_name, const char *session_dictionary_name,
+                                                    lldb::StackFrameSP &frame, std::string &output);
+
+extern "C" bool LLDBSWIGPythonRunScriptKeywordValue(const char *python_function_name, const char *session_dictionary_name,
+                                                    lldb::ValueObjectSP &value, std::string &output);
+
+extern "C" void *LLDBSWIGPython_GetDynamicSetting(void *module, const char *setting, const lldb::TargetSP &target_sp);
 
 static std::string
 ReadPythonBacktrace (PyObject* py_backtrace);
@@ -1365,9 +1408,7 @@
         Locker py_lock  (this,
                          Locker::AcquireLock | Locker::NoSTDIN,
                          Locker::FreeLock);
-        ret_val = g_swig_create_os_plugin    (class_name,
-                                              m_dictionary_name.c_str(),
-                                              process_sp);
+        ret_val = LLDBSWIGPythonCreateOSPlugin(class_name, m_dictionary_name.c_str(), process_sp);
     }
     
     return MakeScriptObject(ret_val);
@@ -1671,10 +1712,8 @@
 
     {
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        
-        ret_val = g_swig_thread_plan_script (class_name,
-                                             python_interpreter->m_dictionary_name.c_str(),
-                                             thread_plan_sp);
+
+        ret_val = LLDBSwigPythonCreateScriptedThreadPlan(class_name, python_interpreter->m_dictionary_name.c_str(), thread_plan_sp);
     }
     
     return MakeScriptObject(ret_val);
@@ -1689,7 +1728,7 @@
     if (implementor_sp)
     {
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        explains_stop = g_swig_call_thread_plan (implementor_sp->GetObject(), "explains_stop", event, script_error);
+        explains_stop = LLDBSWIGPythonCallThreadPlan(implementor_sp->GetObject(), "explains_stop", event, script_error);
         if (script_error)
             return true;
     }
@@ -1705,7 +1744,7 @@
     if (implementor_sp)
     {
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        should_stop = g_swig_call_thread_plan (implementor_sp->GetObject(), "should_stop", event, script_error);
+        should_stop = LLDBSWIGPythonCallThreadPlan(implementor_sp->GetObject(), "should_stop", event, script_error);
         if (script_error)
             return true;
     }
@@ -1720,7 +1759,7 @@
     if (implementor_sp)
     {
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        should_step = g_swig_call_thread_plan (implementor_sp->GetObject(), "should_step", NULL, script_error);
+        should_step = LLDBSWIGPythonCallThreadPlan(implementor_sp->GetObject(), "should_step", NULL, script_error);
         if (script_error)
             should_step = true;
     }
@@ -1758,15 +1797,12 @@
     if (!plugin_module_sp || !target || !setting_name || !setting_name[0])
         return lldb::ScriptInterpreterObjectSP();
     
-    if (!g_swig_plugin_get)
-        return lldb::ScriptInterpreterObjectSP();
-    
     PyObject *reply_pyobj = nullptr;
     
     {
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
         TargetSP target_sp(target->shared_from_this());
-        reply_pyobj = (PyObject*)g_swig_plugin_get(plugin_module_sp->GetObject(),setting_name,target_sp);
+        reply_pyobj = (PyObject *)LLDBSWIGPython_GetDynamicSetting(plugin_module_sp->GetObject(), setting_name, target_sp);
     }
     
     return MakeScriptObject(reply_pyobj);
@@ -1799,9 +1835,7 @@
 
     {
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        ret_val = g_swig_synthetic_script (class_name,
-                                           python_interpreter->m_dictionary_name.c_str(),
-                                           valobj);
+        ret_val = LLDBSwigPythonCreateSyntheticProvider(class_name, python_interpreter->m_dictionary_name.c_str(), valobj);
     }
     
     return MakeScriptObject(ret_val);
@@ -1897,14 +1931,10 @@
             Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
             {
                 TypeSummaryOptionsSP options_sp(new TypeSummaryOptions(options));
-                
-                Timer scoped_timer ("g_swig_typescript_callback","g_swig_typescript_callback");
-                ret_val = g_swig_typescript_callback (python_function_name,
-                                                      GetSessionDictionary().get(),
-                                                      valobj,
-                                                      &new_callee,
-                                                      options_sp,
-                                                      retval);
+
+                Timer scoped_timer("LLDBSwigPythonCallTypeScript", "LLDBSwigPythonCallTypeScript");
+                ret_val = LLDBSwigPythonCallTypeScript(python_function_name, GetSessionDictionary().get(), valobj, &new_callee, options_sp,
+                                                       retval);
             }
         }
     }
@@ -1977,10 +2007,8 @@
                 bool ret_val = true;
                 {
                     Locker py_lock(python_interpreter, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-                    ret_val = g_swig_breakpoint_callback (python_function_name,
-                                                          python_interpreter->m_dictionary_name.c_str(),
-                                                          stop_frame_sp, 
-                                                          bp_loc_sp);
+                    ret_val = LLDBSwigPythonBreakpointCallbackFunction(python_function_name, python_interpreter->m_dictionary_name.c_str(),
+                                                                       stop_frame_sp, bp_loc_sp);
                 }
                 return ret_val;
             }
@@ -2029,10 +2057,8 @@
                 bool ret_val = true;
                 {
                     Locker py_lock(python_interpreter, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-                    ret_val = g_swig_watchpoint_callback (python_function_name,
-                                                          python_interpreter->m_dictionary_name.c_str(),
-                                                          stop_frame_sp, 
-                                                          wp_sp);
+                    ret_val = LLDBSwigPythonWatchpointCallbackFunction(python_function_name, python_interpreter->m_dictionary_name.c_str(),
+                                                                       stop_frame_sp, wp_sp);
                 }
                 return ret_val;
             }
@@ -2054,14 +2080,11 @@
     if (!implementor)
         return 0;
     
-    if (!g_swig_calc_children)
-        return 0;
-
     uint32_t ret_val = 0;
     
     {
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        ret_val = g_swig_calc_children (implementor);
+        ret_val = LLDBSwigPython_CalculateNumChildren(implementor);
     }
     
     return ret_val;
@@ -2078,21 +2101,18 @@
     if (!implementor)
         return lldb::ValueObjectSP();
     
-    if (!g_swig_get_child_index || !g_swig_cast_to_sbvalue)
-        return lldb::ValueObjectSP();
-    
     lldb::ValueObjectSP ret_val;
     
     {
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        void* child_ptr = g_swig_get_child_index (implementor,idx);
+        void *child_ptr = LLDBSwigPython_GetChildAtIndex(implementor, idx);
         if (child_ptr != nullptr && child_ptr != Py_None)
         {
-            lldb::SBValue* sb_value_ptr = (lldb::SBValue*)g_swig_cast_to_sbvalue(child_ptr);
+            lldb::SBValue *sb_value_ptr = (lldb::SBValue *)LLDBSWIGPython_CastPyObjectToSBValue(child_ptr);
             if (sb_value_ptr == nullptr)
                 Py_XDECREF(child_ptr);
             else
-                ret_val = g_swig_get_valobj_sp_from_sbvalue (sb_value_ptr);
+                ret_val = LLDBSWIGPython_GetValueObjectSPFromSBValue(sb_value_ptr);
         }
         else
         {
@@ -2114,14 +2134,11 @@
     if (!implementor)
         return UINT32_MAX;
     
-    if (!g_swig_get_index_child)
-        return UINT32_MAX;
-    
     int ret_val = UINT32_MAX;
     
     {
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        ret_val = g_swig_get_index_child (implementor, child_name);
+        ret_val = LLDBSwigPython_GetIndexOfChildWithName(implementor, child_name);
     }
     
     return ret_val;
@@ -2140,12 +2157,9 @@
     if (!implementor)
         return ret_val;
     
-    if (!g_swig_update_provider)
-        return ret_val;
-    
     {
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        ret_val = g_swig_update_provider (implementor);
+        ret_val = LLDBSwigPython_UpdateSynthProviderInstance(implementor);
     }
     
     return ret_val;
@@ -2164,12 +2178,9 @@
     if (!implementor)
         return ret_val;
     
-    if (!g_swig_mighthavechildren_provider)
-        return ret_val;
-    
     {
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        ret_val = g_swig_mighthavechildren_provider (implementor);
+        ret_val = LLDBSwigPython_MightHaveChildrenSynthProviderInstance(implementor);
     }
     
     return ret_val;
@@ -2188,19 +2199,16 @@
     if (!implementor)
         return ret_val;
     
-    if (!g_swig_getvalue_provider || !g_swig_cast_to_sbvalue || !g_swig_get_valobj_sp_from_sbvalue)
-        return ret_val;
-    
     {
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        void* child_ptr = g_swig_getvalue_provider (implementor);
+        void *child_ptr = LLDBSwigPython_GetValueSynthProviderInstance(implementor);
         if (child_ptr != nullptr && child_ptr != Py_None)
         {
-            lldb::SBValue* sb_value_ptr = (lldb::SBValue*)g_swig_cast_to_sbvalue(child_ptr);
+            lldb::SBValue *sb_value_ptr = (lldb::SBValue *)LLDBSWIGPython_CastPyObjectToSBValue(child_ptr);
             if (sb_value_ptr == nullptr)
                 Py_XDECREF(child_ptr);
             else
-                ret_val = g_swig_get_valobj_sp_from_sbvalue (sb_value_ptr);
+                ret_val = LLDBSWIGPython_GetValueObjectSPFromSBValue(sb_value_ptr);
         }
         else
         {
@@ -2285,15 +2293,10 @@
         error.SetErrorString("no function to execute");
         return false;
     }
-    if (!g_swig_run_script_keyword_process)
-    {
-        error.SetErrorString("internal helper function missing");
-        return false;
-    }
     {
         ProcessSP process_sp(process->shared_from_this());
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        ret_val = g_swig_run_script_keyword_process (impl_function, m_dictionary_name.c_str(), process_sp, output);
+        ret_val = LLDBSWIGPythonRunScriptKeywordProcess(impl_function, m_dictionary_name.c_str(), process_sp, output);
         if (!ret_val)
             error.SetErrorString("python script evaluation failed");
     }
@@ -2317,15 +2320,10 @@
         error.SetErrorString("no function to execute");
         return false;
     }
-    if (!g_swig_run_script_keyword_thread)
-    {
-        error.SetErrorString("internal helper function missing");
-        return false;
-    }
     {
         ThreadSP thread_sp(thread->shared_from_this());
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        ret_val = g_swig_run_script_keyword_thread (impl_function, m_dictionary_name.c_str(), thread_sp, output);
+        ret_val = LLDBSWIGPythonRunScriptKeywordThread(impl_function, m_dictionary_name.c_str(), thread_sp, output);
         if (!ret_val)
             error.SetErrorString("python script evaluation failed");
     }
@@ -2349,15 +2347,10 @@
         error.SetErrorString("no function to execute");
         return false;
     }
-    if (!g_swig_run_script_keyword_target)
-    {
-        error.SetErrorString("internal helper function missing");
-        return false;
-    }
     {
         TargetSP target_sp(target->shared_from_this());
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        ret_val = g_swig_run_script_keyword_target (impl_function, m_dictionary_name.c_str(), target_sp, output);
+        ret_val = LLDBSWIGPythonRunScriptKeywordTarget(impl_function, m_dictionary_name.c_str(), target_sp, output);
         if (!ret_val)
             error.SetErrorString("python script evaluation failed");
     }
@@ -2365,10 +2358,7 @@
 }
 
 bool
-ScriptInterpreterPython::RunScriptFormatKeyword (const char* impl_function,
-                                                 StackFrame* frame,
-                                                 std::string& output,
-                                                 Error& error)
+ScriptInterpreterPython::RunScriptFormatKeyword(const char *impl_function, StackFrame *frame, std::string &output, Error &error)
 {
     bool ret_val;
     if (!frame)
@@ -2381,26 +2371,18 @@
         error.SetErrorString("no function to execute");
         return false;
     }
-    if (!g_swig_run_script_keyword_frame)
-    {
-        error.SetErrorString("internal helper function missing");
-        return false;
-    }
     {
         StackFrameSP frame_sp(frame->shared_from_this());
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        ret_val = g_swig_run_script_keyword_frame (impl_function, m_dictionary_name.c_str(), frame_sp, output);
+        ret_val = LLDBSWIGPythonRunScriptKeywordFrame(impl_function, m_dictionary_name.c_str(), frame_sp, output);
         if (!ret_val)
             error.SetErrorString("python script evaluation failed");
     }
     return ret_val;
 }
-    
+
 bool
-ScriptInterpreterPython::RunScriptFormatKeyword (const char* impl_function,
-                                                 ValueObject *value,
-                                                 std::string& output,
-                                                 Error& error)
+ScriptInterpreterPython::RunScriptFormatKeyword(const char *impl_function, ValueObject *value, std::string &output, Error &error)
 {
     bool ret_val;
     if (!value)
@@ -2413,15 +2395,10 @@
         error.SetErrorString("no function to execute");
         return false;
     }
-    if (!g_swig_run_script_keyword_value)
-    {
-        error.SetErrorString("internal helper function missing");
-        return false;
-    }
     {
         ValueObjectSP value_sp(value->GetSP());
         Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-        ret_val = g_swig_run_script_keyword_value (impl_function, m_dictionary_name.c_str(), value_sp, output);
+        ret_val = LLDBSWIGPythonRunScriptKeywordValue(impl_function, m_dictionary_name.c_str(), value_sp, output);
         if (!ret_val)
             error.SetErrorString("python script evaluation failed");
     }
@@ -2454,12 +2431,6 @@
         return false;
     }
     
-    if (!g_swig_call_module_init)
-    {
-        error.SetErrorString("internal helper function missing");
-        return false;
-    }
-    
     lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().shared_from_this();
 
     {
@@ -2562,9 +2533,7 @@
         
         // if we are here, everything worked
         // call __lldb_init_module(debugger,dict)
-        if (!g_swig_call_module_init (basename.c_str(),
-                                      m_dictionary_name.c_str(),
-                                      debugger_sp))
+        if (!LLDBSwigPythonCallModuleInit(basename.c_str(), m_dictionary_name.c_str(), debugger_sp))
         {
             error.SetErrorString("calling __lldb_init_module failed");
             return false;
@@ -2637,12 +2606,6 @@
         return false;
     }
     
-    if (!g_swig_call_command)
-    {
-        error.SetErrorString("no helper function to run scripted commands");
-        return false;
-    }
-    
     lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().shared_from_this();
     lldb::ExecutionContextRefSP exe_ctx_ref_sp(new ExecutionContextRef(exe_ctx));
     
@@ -2663,13 +2626,8 @@
         
         SynchronicityHandler synch_handler(debugger_sp,
                                            synchronicity);
-        
-        ret_val = g_swig_call_command       (impl_function,
-                                             m_dictionary_name.c_str(),
-                                             debugger_sp,
-                                             args,
-                                             cmd_retobj,
-                                             exe_ctx_ref_sp);
+
+        ret_val = LLDBSwigPythonCallCommand(impl_function, m_dictionary_name.c_str(), debugger_sp, args, cmd_retobj, exe_ctx_ref_sp);
     }
     
     if (!ret_val)
@@ -2722,58 +2680,6 @@
 }
 
 void
-ScriptInterpreterPython::InitializeInterpreter (SWIGInitCallback swig_init_callback,
-                                                SWIGBreakpointCallbackFunction swig_breakpoint_callback,
-                                                SWIGWatchpointCallbackFunction swig_watchpoint_callback,
-                                                SWIGPythonTypeScriptCallbackFunction swig_typescript_callback,
-                                                SWIGPythonCreateSyntheticProvider swig_synthetic_script,
-                                                SWIGPythonCalculateNumChildren swig_calc_children,
-                                                SWIGPythonGetChildAtIndex swig_get_child_index,
-                                                SWIGPythonGetIndexOfChildWithName swig_get_index_child,
-                                                SWIGPythonCastPyObjectToSBValue swig_cast_to_sbvalue ,
-                                                SWIGPythonGetValueObjectSPFromSBValue swig_get_valobj_sp_from_sbvalue,
-                                                SWIGPythonUpdateSynthProviderInstance swig_update_provider,
-                                                SWIGPythonMightHaveChildrenSynthProviderInstance swig_mighthavechildren_provider,
-                                                SWIGPythonGetValueSynthProviderInstance swig_getvalue_provider,
-                                                SWIGPythonCallCommand swig_call_command,
-                                                SWIGPythonCallModuleInit swig_call_module_init,
-                                                SWIGPythonCreateOSPlugin swig_create_os_plugin,
-                                                SWIGPythonScriptKeyword_Process swig_run_script_keyword_process,
-                                                SWIGPythonScriptKeyword_Thread swig_run_script_keyword_thread,
-                                                SWIGPythonScriptKeyword_Target swig_run_script_keyword_target,
-                                                SWIGPythonScriptKeyword_Frame swig_run_script_keyword_frame,
-                                                SWIGPythonScriptKeyword_Value swig_run_script_keyword_value,
-                                                SWIGPython_GetDynamicSetting swig_plugin_get,
-                                                SWIGPythonCreateScriptedThreadPlan swig_thread_plan_script,
-                                                SWIGPythonCallThreadPlan swig_call_thread_plan)
-{
-    g_swig_init_callback = swig_init_callback;
-    g_swig_breakpoint_callback = swig_breakpoint_callback;
-    g_swig_watchpoint_callback = swig_watchpoint_callback;
-    g_swig_typescript_callback = swig_typescript_callback;
-    g_swig_synthetic_script = swig_synthetic_script;
-    g_swig_calc_children = swig_calc_children;
-    g_swig_get_child_index = swig_get_child_index;
-    g_swig_get_index_child = swig_get_index_child;
-    g_swig_cast_to_sbvalue = swig_cast_to_sbvalue;
-    g_swig_get_valobj_sp_from_sbvalue = swig_get_valobj_sp_from_sbvalue;
-    g_swig_update_provider = swig_update_provider;
-    g_swig_mighthavechildren_provider = swig_mighthavechildren_provider;
-    g_swig_getvalue_provider = swig_getvalue_provider;
-    g_swig_call_command = swig_call_command;
-    g_swig_call_module_init = swig_call_module_init;
-    g_swig_create_os_plugin = swig_create_os_plugin;
-    g_swig_run_script_keyword_process = swig_run_script_keyword_process;
-    g_swig_run_script_keyword_thread = swig_run_script_keyword_thread;
-    g_swig_run_script_keyword_target = swig_run_script_keyword_target;
-    g_swig_run_script_keyword_frame = swig_run_script_keyword_frame;
-    g_swig_run_script_keyword_value = swig_run_script_keyword_value;
-    g_swig_plugin_get = swig_plugin_get;
-    g_swig_thread_plan_script = swig_thread_plan_script;
-    g_swig_call_thread_plan = swig_call_thread_plan;
-}
-
-void
 ScriptInterpreterPython::InitializePrivate ()
 {
     static int g_initialized = false;
@@ -2805,8 +2711,7 @@
     Py_InitializeEx (0);
 
     // Initialize SWIG after setting up python
-    if (g_swig_init_callback)
-        g_swig_init_callback ();
+    init_lldb();
 
     // Update the path python uses to search for modules to include the current directory.
 
Index: source/API/CMakeLists.txt
===================================================================
--- source/API/CMakeLists.txt
+++ source/API/CMakeLists.txt
@@ -78,3 +78,5 @@
   SBWatchpoint.cpp
   SBUnixSignals.cpp
   )
+
+add_subdirectory(Bindings)
\ No newline at end of file
Index: source/API/SBBreakpoint.cpp
===================================================================
--- source/API/SBBreakpoint.cpp
+++ source/API/SBBreakpoint.cpp
@@ -25,7 +25,7 @@
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/Target.h"
Index: source/API/SBBreakpointLocation.cpp
===================================================================
--- source/API/SBBreakpointLocation.cpp
+++ source/API/SBBreakpointLocation.cpp
@@ -22,7 +22,7 @@
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
 #include "lldb/Target/ThreadSpec.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/ThreadSpec.h"
Index: source/API/SBCommandInterpreter.cpp
===================================================================
--- source/API/SBCommandInterpreter.cpp
+++ source/API/SBCommandInterpreter.cpp
@@ -567,170 +567,6 @@
     return false;
 }
 
-#ifndef LLDB_DISABLE_PYTHON
-
-// Defined in the SWIG source file
-extern "C" void 
-init_lldb(void);
-
-// these are the Pythonic implementations of the required callbacks
-// these are scripting-language specific, which is why they belong here
-// we still need to use function pointers to them instead of relying
-// on linkage-time resolution because the SWIG stuff and this file
-// get built at different times
-extern "C" bool
-LLDBSwigPythonBreakpointCallbackFunction (const char *python_function_name,
-                                          const char *session_dictionary_name,
-                                          const lldb::StackFrameSP& sb_frame,
-                                          const lldb::BreakpointLocationSP& sb_bp_loc);
-
-extern "C" bool
-LLDBSwigPythonWatchpointCallbackFunction (const char *python_function_name,
-                                          const char *session_dictionary_name,
-                                          const lldb::StackFrameSP& sb_frame,
-                                          const lldb::WatchpointSP& sb_wp);
-
-extern "C" bool
-LLDBSwigPythonCallTypeScript (const char *python_function_name,
-                              void *session_dictionary,
-                              const lldb::ValueObjectSP& valobj_sp,
-                              void** pyfunct_wrapper,
-                              const lldb::TypeSummaryOptionsSP& options_sp,
-                              std::string& retval);
-
-extern "C" void*
-LLDBSwigPythonCreateSyntheticProvider (const char *python_class_name,
-                                       const char *session_dictionary_name,
-                                       const lldb::ValueObjectSP& valobj_sp);
-
-
-extern "C" void*
-LLDBSwigPythonCreateScriptedThreadPlan (const char *python_class_name,
-                                        const char *session_dictionary_name,
-                                        const lldb::ThreadPlanSP& thread_plan_sp);
-
-extern "C" bool
-LLDBSWIGPythonCallThreadPlan (void *implementor,
-                              const char *method_name,
-                              Event *event_sp,
-                              bool &got_error);
-
-extern "C" uint32_t
-LLDBSwigPython_CalculateNumChildren (void *implementor);
-
-extern "C" void *
-LLDBSwigPython_GetChildAtIndex (void *implementor, uint32_t idx);
-
-extern "C" int
-LLDBSwigPython_GetIndexOfChildWithName (void *implementor, const char* child_name);
-
-extern "C" void *
-LLDBSWIGPython_CastPyObjectToSBValue (void* data);
-
-extern lldb::ValueObjectSP
-LLDBSWIGPython_GetValueObjectSPFromSBValue (void* data);
-
-extern "C" bool
-LLDBSwigPython_UpdateSynthProviderInstance (void* implementor);
-
-extern "C" bool
-LLDBSwigPython_MightHaveChildrenSynthProviderInstance (void* implementor);
-
-extern "C" void *
-LLDBSwigPython_GetValueSynthProviderInstance (void* implementor);
-
-extern "C" bool
-LLDBSwigPythonCallCommand (const char *python_function_name,
-                           const char *session_dictionary_name,
-                           lldb::DebuggerSP& debugger,
-                           const char* args,
-                           lldb_private::CommandReturnObject &cmd_retobj,
-                           lldb::ExecutionContextRefSP exe_ctx_ref_sp);
-
-extern "C" bool
-LLDBSwigPythonCallModuleInit (const char *python_module_name,
-                              const char *session_dictionary_name,
-                              lldb::DebuggerSP& debugger);
-
-extern "C" void*
-LLDBSWIGPythonCreateOSPlugin (const char *python_class_name,
-                              const char *session_dictionary_name,
-                              const lldb::ProcessSP& process_sp);
-
-extern "C" bool
-LLDBSWIGPythonRunScriptKeywordProcess (const char* python_function_name,
-                                       const char* session_dictionary_name,
-                                       lldb::ProcessSP& process,
-                                       std::string& output);
-
-extern "C" bool
-LLDBSWIGPythonRunScriptKeywordThread (const char* python_function_name,
-                                      const char* session_dictionary_name,
-                                      lldb::ThreadSP& thread,
-                                      std::string& output);
-
-extern "C" bool
-LLDBSWIGPythonRunScriptKeywordTarget (const char* python_function_name,
-                                      const char* session_dictionary_name,
-                                      lldb::TargetSP& target,
-                                      std::string& output);
-
-extern "C" bool
-LLDBSWIGPythonRunScriptKeywordFrame (const char* python_function_name,
-                                     const char* session_dictionary_name,
-                                     lldb::StackFrameSP& frame,
-                                     std::string& output);
-
-extern "C" bool
-LLDBSWIGPythonRunScriptKeywordValue (const char* python_function_name,
-                                     const char* session_dictionary_name,
-                                     lldb::ValueObjectSP& value,
-                                     std::string& output);
-
-extern "C" void*
-LLDBSWIGPython_GetDynamicSetting (void* module,
-                                  const char* setting,
-                                  const lldb::TargetSP& target_sp);
-
-
-#endif
-
-void
-SBCommandInterpreter::InitializeSWIG ()
-{
-    static bool g_initialized = false;
-    if (!g_initialized)
-    {
-        g_initialized = true;
-#ifndef LLDB_DISABLE_PYTHON
-        ScriptInterpreter::InitializeInterpreter (init_lldb,
-                                                  LLDBSwigPythonBreakpointCallbackFunction,
-                                                  LLDBSwigPythonWatchpointCallbackFunction,
-                                                  LLDBSwigPythonCallTypeScript,
-                                                  LLDBSwigPythonCreateSyntheticProvider,
-                                                  LLDBSwigPython_CalculateNumChildren,
-                                                  LLDBSwigPython_GetChildAtIndex,
-                                                  LLDBSwigPython_GetIndexOfChildWithName,
-                                                  LLDBSWIGPython_CastPyObjectToSBValue,
-                                                  LLDBSWIGPython_GetValueObjectSPFromSBValue,
-                                                  LLDBSwigPython_UpdateSynthProviderInstance,
-                                                  LLDBSwigPython_MightHaveChildrenSynthProviderInstance,
-                                                  LLDBSwigPython_GetValueSynthProviderInstance,
-                                                  LLDBSwigPythonCallCommand,
-                                                  LLDBSwigPythonCallModuleInit,
-                                                  LLDBSWIGPythonCreateOSPlugin,
-                                                  LLDBSWIGPythonRunScriptKeywordProcess,
-                                                  LLDBSWIGPythonRunScriptKeywordThread,
-                                                  LLDBSWIGPythonRunScriptKeywordTarget,
-                                                  LLDBSWIGPythonRunScriptKeywordFrame,
-                                                  LLDBSWIGPythonRunScriptKeywordValue,
-                                                  LLDBSWIGPython_GetDynamicSetting,
-                                                  LLDBSwigPythonCreateScriptedThreadPlan,
-                                                  LLDBSWIGPythonCallThreadPlan);
-#endif
-    }
-}
-
 lldb::SBCommand
 SBCommandInterpreter::AddMultiwordCommand (const char* name, const char* help)
 {
Index: source/API/SBDebugger.cpp
===================================================================
--- source/API/SBDebugger.cpp
+++ source/API/SBDebugger.cpp
@@ -115,8 +115,6 @@
     if (log)
         log->Printf ("SBDebugger::Initialize ()");
 
-    SBCommandInterpreter::InitializeSWIG ();
-
     Debugger::Initialize(LoadPlugin);
 }
 
Index: source/API/SBTypeCategory.cpp
===================================================================
--- source/API/SBTypeCategory.cpp
+++ source/API/SBTypeCategory.cpp
@@ -21,7 +21,7 @@
 #include "lldb/Core/Debugger.h"
 #include "lldb/DataFormatters/DataVisualization.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
 
 using namespace lldb;
 using namespace lldb_private;
Index: source/CMakeLists.txt
===================================================================
--- source/CMakeLists.txt
+++ source/CMakeLists.txt
@@ -34,6 +34,7 @@
 add_subdirectory(Host)
 add_subdirectory(Interpreter)
 add_subdirectory(Plugins)
+add_subdirectory(ScriptInterpreter)
 add_subdirectory(Symbol)
 add_subdirectory(Target)
 add_subdirectory(Utility)
Index: source/Commands/CommandObjectCommands.cpp
===================================================================
--- source/Commands/CommandObjectCommands.cpp
+++ source/Commands/CommandObjectCommands.cpp
@@ -28,8 +28,7 @@
 #include "lldb/Interpreter/OptionValueBoolean.h"
 #include "lldb/Interpreter/OptionValueUInt64.h"
 #include "lldb/Interpreter/Options.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
 
 using namespace lldb;
 using namespace lldb_private;
Index: source/Core/Module.cpp
===================================================================
--- source/Core/Module.cpp
+++ source/Core/Module.cpp
@@ -24,7 +24,7 @@
 #include "lldb/Host/Host.h"
 #include "lldb/Host/Symbols.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
 #include "lldb/lldb-private-log.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/CompileUnit.h"
Index: source/Core/ValueObject.cpp
===================================================================
--- source/Core/ValueObject.cpp
+++ source/Core/ValueObject.cpp
@@ -43,7 +43,6 @@
 #include "lldb/Host/Endian.h"
 
 #include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
 
 #include "lldb/Symbol/ClangASTType.h"
 #include "lldb/Symbol/ClangASTContext.h"
Index: source/DataFormatters/FormatManager.cpp
===================================================================
--- source/DataFormatters/FormatManager.cpp
+++ source/DataFormatters/FormatManager.cpp
@@ -18,7 +18,6 @@
 
 #include "lldb/Core/Debugger.h"
 #include "lldb/DataFormatters/CXXFormatterFunctions.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Platform.h"
 #include "llvm/ADT/STLExtras.h"
Index: source/DataFormatters/TypeSynthetic.cpp
===================================================================
--- source/DataFormatters/TypeSynthetic.cpp
+++ source/DataFormatters/TypeSynthetic.cpp
@@ -23,7 +23,9 @@
 #include "lldb/Core/StreamString.h"
 #include "lldb/DataFormatters/TypeSynthetic.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
+#ifndef LLDB_DISABLE_PYTHON
+#include "lldb/API/Bindings/Python/ScriptInterpreterPython.h"
+#endif
 #include "lldb/Symbol/ClangASTType.h"
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
Index: source/Interpreter/CMakeLists.txt
===================================================================
--- source/Interpreter/CMakeLists.txt
+++ source/Interpreter/CMakeLists.txt
@@ -43,8 +43,4 @@
   OptionGroupWatchpoint.cpp
   Options.cpp
   Property.cpp
-  PythonDataObjects.cpp
-  ScriptInterpreter.cpp
-  ScriptInterpreterNone.cpp
-  ScriptInterpreterPython.cpp
   )
Index: source/Interpreter/CommandInterpreter.cpp
===================================================================
--- source/Interpreter/CommandInterpreter.cpp
+++ source/Interpreter/CommandInterpreter.cpp
@@ -62,8 +62,6 @@
 #include "lldb/Interpreter/Options.h"
 #include "lldb/Interpreter/OptionValueProperties.h"
 #include "lldb/Interpreter/Property.h"
-#include "lldb/Interpreter/ScriptInterpreterNone.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
 
 
 #include "lldb/Target/Process.h"
@@ -2852,42 +2850,8 @@
 ScriptInterpreter *
 CommandInterpreter::GetScriptInterpreter (bool can_create)
 {
-    if (m_script_interpreter_ap.get() != nullptr)
-        return m_script_interpreter_ap.get();
-    
-    if (!can_create)
-        return nullptr;
- 
-    // <rdar://problem/11751427>
-    // we need to protect the initialization of the script interpreter
-    // otherwise we could end up with two threads both trying to create
-    // their instance of it, and for some languages (e.g. Python)
-    // this is a bulletproof recipe for disaster!
-    // this needs to be a function-level static because multiple Debugger instances living in the same process
-    // still need to be isolated and not try to initialize Python concurrently
-    static Mutex g_interpreter_mutex(Mutex::eMutexTypeRecursive);
-    Mutex::Locker interpreter_lock(g_interpreter_mutex);
-    
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
-    if (log)
-        log->Printf("Initializing the ScriptInterpreter now\n");
-    
     lldb::ScriptLanguage script_lang = GetDebugger().GetScriptLanguage();
-    switch (script_lang)
-    {
-        case eScriptLanguagePython:
-#ifndef LLDB_DISABLE_PYTHON
-            m_script_interpreter_ap.reset (new ScriptInterpreterPython (*this));
-            break;
-#else
-            // Fall through to the None case when python is disabled
-#endif
-        case eScriptLanguageNone:
-            m_script_interpreter_ap.reset (new ScriptInterpreterNone (*this));
-            break;
-    };
-    
-    return m_script_interpreter_ap.get();
+    return ScriptInterpreter::GetScriptInterpreter(script_lang, *this, can_create);
 }
 
 
Index: source/Interpreter/CommandObject.cpp
===================================================================
--- source/Interpreter/CommandObject.cpp
+++ source/Interpreter/CommandObject.cpp
@@ -31,8 +31,6 @@
 
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
 
 using namespace lldb;
 using namespace lldb_private;
Index: source/Interpreter/CommandObjectScript.cpp
===================================================================
--- source/Interpreter/CommandObjectScript.cpp
+++ source/Interpreter/CommandObjectScript.cpp
@@ -23,7 +23,7 @@
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
 
 using namespace lldb;
 using namespace lldb_private;
Index: source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
===================================================================
--- source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -15,6 +15,7 @@
 // C Includes
 // C++ Includes
 // Other libraries and framework includes
+#include "lldb/API/Bindings/Python/PythonDataObjects.h"
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/Debugger.h"
@@ -24,7 +25,6 @@
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/ValueObjectVariable.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/PythonDataObjects.h"
 #include "lldb/Symbol/ClangNamespaceDecl.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/VariableList.h"
Index: source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
===================================================================
--- source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
+++ source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
@@ -14,7 +14,7 @@
 // C Includes
 // C++ Includes
 // Other libraries and framework includes
-#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
 #include "lldb/Target/OperatingSystem.h"
 
 class DynamicRegisterInfo;
Index: source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
===================================================================
--- source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
+++ source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
@@ -15,15 +15,14 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
+#ifndef LLDB_DISABLE_PYTHON
+#include "lldb/API/Bindings/Python/PythonDataObjects.h"
+#endif
 #include "lldb/Host/StringConvert.h"
 #include "lldb/Core/RegularExpression.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/DataFormatters/FormatManager.h"
 
-#ifndef LLDB_DISABLE_PYTHON
-#include "lldb/Interpreter/PythonDataObjects.h"
-#endif
-
 using namespace lldb;
 using namespace lldb_private;
 
Index: source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -17,9 +17,6 @@
 #include "lldb/Core/RegisterValue.h"
 #include "lldb/Core/Scalar.h"
 #include "lldb/Core/StreamString.h"
-#ifndef LLDB_DISABLE_PYTHON
-#include "lldb/Interpreter/PythonDataObjects.h"
-#endif
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/Utils.h"
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -27,6 +27,9 @@
 
 // Other libraries and framework includes
 
+#ifndef LLDB_DISABLE_PYTHON
+#include "lldb/API/Bindings/Python/PythonDataObjects.h"
+#endif
 #include "lldb/Breakpoint/Watchpoint.h"
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Core/ArchSpec.h"
@@ -52,9 +55,6 @@
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Interpreter/OptionValueProperties.h"
 #include "lldb/Interpreter/Property.h"
-#ifndef LLDB_DISABLE_PYTHON
-#include "lldb/Interpreter/PythonDataObjects.h"
-#endif
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Target/DynamicLoader.h"
 #include "lldb/Target/Target.h"
Index: source/ScriptInterpreter/CMakeLists.txt
===================================================================
--- /dev/null
+++ source/ScriptInterpreter/CMakeLists.txt
@@ -0,0 +1,5 @@
+
+add_lldb_library(lldbScriptInterpreter
+  ScriptInterpreter.cpp
+  ScriptInterpreterNone.cpp
+  )
Index: source/ScriptInterpreter/ScriptInterpreter.cpp
===================================================================
--- source/ScriptInterpreter/ScriptInterpreter.cpp
+++ source/ScriptInterpreter/ScriptInterpreter.cpp
@@ -9,22 +9,35 @@
 
 #include "lldb/lldb-python.h"
 
-#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
 
 #include <string>
 #include <stdlib.h>
 #include <stdio.h>
 
 #include "lldb/Core/Error.h"
+#include "lldb/Core/Log.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StringList.h"
+#include "lldb/Host/Mutex.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreterNone.h"
+#ifndef LLDB_DISABLE_PYTHON
+#include "lldb/API/Bindings/Python/ScriptInterpreterPython.h"
+#endif
 #include "lldb/Utility/PseudoTerminal.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
+namespace
+{
+ScriptInterpreterNone *g_none_interpreter = nullptr;
+#ifndef LLDB_DISABLE_PYTHON
+ScriptInterpreterPython *g_python_interpreter = nullptr;
+#endif
+}
+
 ScriptInterpreter::ScriptInterpreter (CommandInterpreter &interpreter, lldb::ScriptLanguage script_lang) :
     m_interpreter (interpreter),
     m_script_lang (script_lang)
@@ -111,56 +124,47 @@
     return std::unique_ptr<ScriptInterpreterLocker>(new ScriptInterpreterLocker());
 }
 
+ScriptInterpreter *
+ScriptInterpreter::GetScriptInterpreter(lldb::ScriptLanguage script_lang, CommandInterpreter &command_interpreter, bool can_create)
+{
+    // <rdar://problem/11751427>
+    // we need to protect the initialization of the script interpreter
+    // otherwise we could end up with two threads both trying to create
+    // their instance of it, and for some languages (e.g. Python)
+    // this is a bulletproof recipe for disaster!
+    // this needs to be a function-level static because multiple Debugger
+    // instances living in the same process still need to be isolated and
+    // not try to initialize the script interpreter concurrently.
+    static Mutex g_interpreter_mutex(Mutex::eMutexTypeRecursive);
+    Mutex::Locker interpreter_lock(g_interpreter_mutex);
+
+    Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
+    if (log)
+        log->Printf("Initializing the ScriptInterpreter now\n");
+
+    switch (script_lang)
+    {
+        case eScriptLanguagePython:
+#ifndef LLDB_DISABLE_PYTHON
+            if (!g_python_interpreter && can_create)
+                g_python_interpreter = new ScriptInterpreterPython(command_interpreter);
+            return g_python_interpreter;
+#else
+// Fall through to the None case when python is disabled
+#endif
+        case eScriptLanguageNone:
+            if (!g_none_interpreter && can_create)
+                g_none_interpreter = new ScriptInterpreterNone(command_interpreter);
+            return g_none_interpreter;
+    };
+
+    return nullptr;
+}
+
 void
-ScriptInterpreter::InitializeInterpreter (SWIGInitCallback python_swig_init_callback,
-                                          SWIGBreakpointCallbackFunction swig_breakpoint_callback,
-                                          SWIGWatchpointCallbackFunction swig_watchpoint_callback,
-                                          SWIGPythonTypeScriptCallbackFunction swig_typescript_callback,
-                                          SWIGPythonCreateSyntheticProvider swig_synthetic_script,
-                                          SWIGPythonCalculateNumChildren swig_calc_children,
-                                          SWIGPythonGetChildAtIndex swig_get_child_index,
-                                          SWIGPythonGetIndexOfChildWithName swig_get_index_child,
-                                          SWIGPythonCastPyObjectToSBValue swig_cast_to_sbvalue ,
-                                          SWIGPythonGetValueObjectSPFromSBValue swig_get_valobj_sp_from_sbvalue,
-                                          SWIGPythonUpdateSynthProviderInstance swig_update_provider,
-                                          SWIGPythonMightHaveChildrenSynthProviderInstance swig_mighthavechildren_provider,
-                                          SWIGPythonGetValueSynthProviderInstance swig_getvalue_provider,
-                                          SWIGPythonCallCommand swig_call_command,
-                                          SWIGPythonCallModuleInit swig_call_module_init,
-                                          SWIGPythonCreateOSPlugin swig_create_os_plugin,
-                                          SWIGPythonScriptKeyword_Process swig_run_script_keyword_process,
-                                          SWIGPythonScriptKeyword_Thread swig_run_script_keyword_thread,
-                                          SWIGPythonScriptKeyword_Target swig_run_script_keyword_target,
-                                          SWIGPythonScriptKeyword_Frame swig_run_script_keyword_frame,
-                                          SWIGPythonScriptKeyword_Value swig_run_script_keyword_value,
-                                          SWIGPython_GetDynamicSetting swig_plugin_get,
-                                          SWIGPythonCreateScriptedThreadPlan swig_thread_plan_script,
-                                          SWIGPythonCallThreadPlan swig_call_thread_plan)
+ScriptInterpreter::InitializePrivate()
 {
 #ifndef LLDB_DISABLE_PYTHON
-    ScriptInterpreterPython::InitializeInterpreter (python_swig_init_callback,
-                                                    swig_breakpoint_callback,
-                                                    swig_watchpoint_callback,
-                                                    swig_typescript_callback,
-                                                    swig_synthetic_script,
-                                                    swig_calc_children,
-                                                    swig_get_child_index,
-                                                    swig_get_index_child,
-                                                    swig_cast_to_sbvalue ,
-                                                    swig_get_valobj_sp_from_sbvalue,
-                                                    swig_update_provider,
-                                                    swig_mighthavechildren_provider,
-                                                    swig_getvalue_provider,
-                                                    swig_call_command,
-                                                    swig_call_module_init,
-                                                    swig_create_os_plugin,
-                                                    swig_run_script_keyword_process,
-                                                    swig_run_script_keyword_thread,
-                                                    swig_run_script_keyword_target,
-                                                    swig_run_script_keyword_frame,
-                                                    swig_run_script_keyword_value,
-                                                    swig_plugin_get,
-                                                    swig_thread_plan_script,
-                                                    swig_call_thread_plan);
-#endif // #ifndef LLDB_DISABLE_PYTHON
+    ScriptInterpreterPython::InitializePrivate();
+#endif
 }
Index: source/ScriptInterpreter/ScriptInterpreterNone.cpp
===================================================================
--- source/ScriptInterpreter/ScriptInterpreterNone.cpp
+++ source/ScriptInterpreter/ScriptInterpreterNone.cpp
@@ -7,9 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "lldb/lldb-python.h"
-
-#include "lldb/Interpreter/ScriptInterpreterNone.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreterNone.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Core/StringList.h"
Index: source/Target/ThreadPlanPython.cpp
===================================================================
--- source/Target/ThreadPlanPython.cpp
+++ source/Target/ThreadPlanPython.cpp
@@ -19,8 +19,7 @@
 #include "lldb/Core/Log.h"
 #include "lldb/Core/State.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/Thread.h"
 #include "lldb/Target/ThreadPlan.h"
Index: source/lldb.cpp
===================================================================
--- source/lldb.cpp
+++ source/lldb.cpp
@@ -20,7 +20,7 @@
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/Mutex.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 
@@ -187,8 +187,8 @@
         ObjectFileMachO::Initialize();
 #endif
 
+        ScriptInterpreter::InitializePrivate();
 #ifndef LLDB_DISABLE_PYTHON
-        ScriptInterpreterPython::InitializePrivate();
         OperatingSystemPython::Initialize();
 #endif
     }
Index: tools/driver/CMakeLists.txt
===================================================================
--- tools/driver/CMakeLists.txt
+++ tools/driver/CMakeLists.txt
@@ -2,6 +2,8 @@
 add_lldb_executable(lldb
   Driver.cpp
   Platform.cpp
+  ADDITIONAL_HEADER_DIRS
+  ${LLDB_INCLUDE_ROOT}/lldb
   )
 
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
Index: tools/lldb-server/CMakeLists.txt
===================================================================
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -2,19 +2,19 @@
 
 if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
 include_directories(
-  ../../source/Plugins/Process/Linux
-  ../../source/Plugins/Process/POSIX
+  ${LLDB_SOURCE_ROOT}/Plugins/Process/Linux
+  ${LLDB_SOURCE_ROOT}/Plugins/Process/POSIX
   )
 endif ()
 
 if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" )
 include_directories(
-  ../../source/Plugins/Process/FreeBSD
-  ../../source/Plugins/Process/POSIX
+  ${LLDB_SOURCE_ROOT}/Plugins/Process/FreeBSD
+  ${LLDB_SOURCE_ROOT}/Plugins/Process/POSIX
   )
 endif ()
 
-include_directories(../../source)
+include_directories(${LLDB_SOURCE_ROOT})
 
 include(../../cmake/LLDBDependencies.cmake)
 
@@ -31,8 +31,10 @@
     lldb-server.cpp
     lldb-gdbserver.cpp
     lldb-platform.cpp
-    ../../source/lldb-log.cpp
-    ../../source/lldb.cpp
+    ${LLDB_SOURCE_ROOT}/lldb-log.cpp
+    ${LLDB_SOURCE_ROOT}/lldb.cpp
+    $<TARGET_OBJS:lldbAPI>
+    ${LLDB_WRAP_PYTHON}
     )
 
   # The Darwin linker doesn't understand --start-group/--end-group.
_______________________________________________
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to