From bb4ccc6688893d1bf38cfca76620d84f947b9de1 Mon Sep 17 00:00:00 2001 From: Med Ismail Bennani Date: Wed, 11 Jan 2023 23:04:24 -0800 Subject: [lldb] Add ScriptedPlatform python implementation This patch introduces both the Scripted Platform python base implementation and an example for it. The base implementation is embedded in lldb python module under `lldb.plugins.scripted_platform`. This patch also refactor the various SWIG methods to create scripted objects into a single method, that is now shared between the Scripted Platform, Process and Thread. It also replaces the target argument by a execution context object. Differential Revision: https://reviews.llvm.org/D139250 Signed-off-by: Med Ismail Bennani --- .../Python/ScriptedProcessPythonInterface.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp') diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp index 5fd085d..6f087e8 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp @@ -37,16 +37,18 @@ StructuredData::GenericSP ScriptedProcessPythonInterface::CreatePluginObject( if (class_name.empty()) return {}; - TargetSP target_sp = exe_ctx.GetTargetSP(); StructuredDataImpl args_impl(args_sp); std::string error_string; Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN, Locker::FreeLock); - PythonObject ret_val = LLDBSwigPythonCreateScriptedProcess( - class_name.str().c_str(), m_interpreter.GetDictionaryName(), target_sp, - args_impl, error_string); + lldb::ExecutionContextRefSP exe_ctx_ref_sp = + std::make_shared(exe_ctx); + + PythonObject ret_val = LLDBSwigPythonCreateScriptedObject( + class_name.str().c_str(), m_interpreter.GetDictionaryName(), + exe_ctx_ref_sp, args_impl, error_string); m_object_instance_sp = StructuredData::GenericSP(new StructuredPythonObject(std::move(ret_val))); -- cgit v1.1