summaryrefslogtreecommitdiffstats
path: root/lldb/source/API
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-07-30 20:28:07 +0000
committerZachary Turner <zturner@google.com>2015-07-30 20:28:07 +0000
commit2c1f46dcc609a1bf61ab979eebdd72f81823ff74 (patch)
tree9aea77c865bbaa3ec81fd85ca66913360dc6155b /lldb/source/API
parent13ac40ea6ef9621838068a70cbef86d544ee9700 (diff)
downloadbcm5719-llvm-2c1f46dcc609a1bf61ab979eebdd72f81823ff74.tar.gz
bcm5719-llvm-2c1f46dcc609a1bf61ab979eebdd72f81823ff74.zip
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
Diffstat (limited to 'lldb/source/API')
-rw-r--r--lldb/source/API/CMakeLists.txt7
-rw-r--r--lldb/source/API/SBCommandInterpreter.cpp2
-rw-r--r--lldb/source/API/SystemInitializerFull.cpp31
3 files changed, 29 insertions, 11 deletions
diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index 121d742da91..2fc834d9d50 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -72,6 +72,13 @@ add_lldb_library(liblldb SHARED
${LLDB_VERS_GENERATED_FILE}
)
+# This should not be part of LLDBDependencies.cmake, because we don't
+# want every single library taking a dependency on the script interpreters.
+target_link_libraries(liblldb PRIVATE
+ lldbPluginScriptInterpreterNone
+ lldbPluginScriptInterpreterPython
+ )
+
set_target_properties(liblldb
PROPERTIES
VERSION ${LLDB_VERSION}
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp
index d901e728105..cd1e28e7115 100644
--- a/lldb/source/API/SBCommandInterpreter.cpp
+++ b/lldb/source/API/SBCommandInterpreter.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#include "lldb/lldb-types.h"
-#include "lldb/Core/SourceManager.h"
+
#include "lldb/Core/Listener.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandObjectMultiword.h"
diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp
index 01ad8157646..cccd9876be9 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 @@ SystemInitializerFull::~SystemInitializerFull()
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 @@ SystemInitializerFull::Terminate()
// Now shutdown the common parts, in reverse order.
SystemInitializerCommon::Terminate();
}
-
-void SystemInitializerFull::TerminateSWIG()
-{
-
-}
OpenPOWER on IntegriCloud