Convert the ScriptInterpreter system to a plugin-based one.
Previously embedded interpreters were handled as ad-hoc source
files compiled into source/Interpreter. This made it hard to
disable a specific interpreter, or to add support for other
interpreters and allow the developer to choose which interpreter(s)
were enabled for a particular build.
This patch converts script interpreters over to a plugin-based system.
Script interpreters now live in source/Plugins/ScriptInterpreter, and
the canonical LLDB interpreter, ScriptInterpreterPython, is moved there
as well.
Any new code interfacing with the Python C API must live in this location
from here on out. Additionally, generic code should never need to
reference or make assumptions about the presence of a specific interpreter
going forward.
Differential Revision: http://reviews.llvm.org/D11431
Reviewed By: Greg Clayton
llvm-svn: 243681
diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp
index 01ad815..cccd987 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -7,12 +7,23 @@
//
//===----------------------------------------------------------------------===//
+#if !defined(LLDB_DISABLE_PYTHON)
+#include "Plugins/ScriptInterpreter/Python/lldb-python.h"
+#endif
+
#include "lldb/API/SystemInitializerFull.h"
+#include "lldb/API/SBCommandInterpreter.h"
+
+#if !defined(LLDB_DISABLE_PYTHON)
+#include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h"
+#endif
+
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Initialization/SystemInitializerCommon.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
@@ -38,6 +49,7 @@
#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
#include "Plugins/Process/elf-core/ProcessElfCore.h"
#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
+#include "Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h"
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h"
#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
@@ -61,10 +73,6 @@
#include "Plugins/Process/Windows/ProcessWindows.h"
#endif
-#if !defined(LLDB_DISABLE_PYTHON)
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
-#endif
-
#include "llvm/Support/TargetSelect.h"
#include <string>
@@ -221,9 +229,17 @@
void
SystemInitializerFull::Initialize()
{
+ SystemInitializerCommon::Initialize();
+
+#if !defined(LLDB_DISABLE_PYTHON)
InitializeSWIG();
- SystemInitializerCommon::Initialize();
+ // ScriptInterpreterPython::Initialize() depends on things like HostInfo being initialized
+ // so it can compute the python directory etc, so we need to do this after
+ // SystemInitializerCommon::Initialize().
+ ScriptInterpreterNone::Initialize();
+ ScriptInterpreterPython::Initialize();
+#endif
// Initialize LLVM and Clang
llvm::InitializeAllTargets();
@@ -380,8 +396,3 @@
// Now shutdown the common parts, in reverse order.
SystemInitializerCommon::Terminate();
}
-
-void SystemInitializerFull::TerminateSWIG()
-{
-
-}