aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/API/SystemInitializerFull.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-03-25 20:14:31 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-03-25 20:14:31 +0000
commitb01b10877d233202461956c3aeaa46f22f53001c (patch)
tree736dc6149d7d55051932b86902e1353d02c031d9 /lldb/source/API/SystemInitializerFull.cpp
parent312ab05887d0e2caa29aaf843cefe39379a98d36 (diff)
downloadllvm-b01b10877d233202461956c3aeaa46f22f53001c.zip
llvm-b01b10877d233202461956c3aeaa46f22f53001c.tar.gz
llvm-b01b10877d233202461956c3aeaa46f22f53001c.tar.bz2
[ScriptInterpreterPython] Move SWIG initialization into the Python plugin (NFC)
Abstract initialization of the Python SWIG support in the Python plugin. llvm-svn: 356942
Diffstat (limited to 'lldb/source/API/SystemInitializerFull.cpp')
-rw-r--r--lldb/source/API/SystemInitializerFull.cpp170
1 files changed, 1 insertions, 169 deletions
diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp
index 427186f..5515548 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -121,145 +121,6 @@
using namespace lldb_private;
-#ifndef LLDB_DISABLE_PYTHON
-
-// Defined in the SWIG source file
-#if PY_MAJOR_VERSION >= 3
-extern "C" PyObject *PyInit__lldb(void);
-
-#define LLDBSwigPyInit PyInit__lldb
-
-#else
-extern "C" void init_lldb(void);
-
-#define LLDBSwigPyInit init_lldb
-#endif
-
-// 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 *
-LLDBSwigPythonCreateCommandObject(const char *python_class_name,
- const char *session_dictionary_name,
- const lldb::DebuggerSP debugger_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" void *LLDBSwigPythonCreateScriptedBreakpointResolver(
- const char *python_class_name,
- const char *session_dictionary_name,
- lldb_private::StructuredDataImpl *args,
- lldb::BreakpointSP &bkpt_sp);
-
-extern "C" unsigned int LLDBSwigPythonCallBreakpointResolver(
- void *implementor,
- const char *method_name,
- lldb_private::SymbolContext *sym_ctx
-);
-
-extern "C" size_t LLDBSwigPython_CalculateNumChildren(void *implementor,
- uint32_t max);
-
-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
-LLDBSwigPythonCallCommandObject(void *implementor, 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" void *LLDBSWIGPython_CreateFrameRecognizer(
- const char *python_class_name,
- const char *session_dictionary_name);
-
-extern "C" void *LLDBSwigPython_GetRecognizedArguments(void *implementor,
- const lldb::StackFrameSP& frame_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
SystemInitializerFull::SystemInitializerFull() {}
@@ -281,11 +142,7 @@ llvm::Error SystemInitializerFull::Initialize() {
#endif
#if !defined(LLDB_DISABLE_PYTHON)
- InitializeSWIG();
-
- // 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().
+ ScriptInterpreterPython::InitializeSWIG();
ScriptInterpreterPython::Initialize();
#endif
@@ -406,31 +263,6 @@ llvm::Error SystemInitializerFull::Initialize() {
return llvm::Error::success();
}
-void SystemInitializerFull::InitializeSWIG() {
-#if !defined(LLDB_DISABLE_PYTHON)
- ScriptInterpreterPython::InitializeInterpreter(
- LLDBSwigPyInit, LLDBSwigPythonBreakpointCallbackFunction,
- LLDBSwigPythonWatchpointCallbackFunction, LLDBSwigPythonCallTypeScript,
- LLDBSwigPythonCreateSyntheticProvider, LLDBSwigPythonCreateCommandObject,
- LLDBSwigPython_CalculateNumChildren, LLDBSwigPython_GetChildAtIndex,
- LLDBSwigPython_GetIndexOfChildWithName,
- LLDBSWIGPython_CastPyObjectToSBValue,
- LLDBSWIGPython_GetValueObjectSPFromSBValue,
- LLDBSwigPython_UpdateSynthProviderInstance,
- LLDBSwigPython_MightHaveChildrenSynthProviderInstance,
- LLDBSwigPython_GetValueSynthProviderInstance, LLDBSwigPythonCallCommand,
- LLDBSwigPythonCallCommandObject, LLDBSwigPythonCallModuleInit,
- LLDBSWIGPythonCreateOSPlugin, LLDBSWIGPython_CreateFrameRecognizer,
- LLDBSwigPython_GetRecognizedArguments,
- LLDBSWIGPythonRunScriptKeywordProcess,
- LLDBSWIGPythonRunScriptKeywordThread,
- LLDBSWIGPythonRunScriptKeywordTarget, LLDBSWIGPythonRunScriptKeywordFrame,
- LLDBSWIGPythonRunScriptKeywordValue, LLDBSWIGPython_GetDynamicSetting,
- LLDBSwigPythonCreateScriptedThreadPlan, LLDBSWIGPythonCallThreadPlan,
- LLDBSwigPythonCreateScriptedBreakpointResolver, LLDBSwigPythonCallBreakpointResolver);
-#endif
-}
-
void SystemInitializerFull::Terminate() {
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);