diff options
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp index fb55d44..511a42f 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp @@ -31,8 +31,7 @@ ScriptedThreadPythonInterface::ScriptedThreadPythonInterface( StructuredData::GenericSP ScriptedThreadPythonInterface::CreatePluginObject( const llvm::StringRef class_name, ExecutionContext &exe_ctx, - StructuredData::DictionarySP args_sp) { - + StructuredData::DictionarySP args_sp, StructuredData::Generic *script_obj) { if (class_name.empty()) return {}; @@ -43,9 +42,15 @@ StructuredData::GenericSP ScriptedThreadPythonInterface::CreatePluginObject( Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN, Locker::FreeLock); - PythonObject ret_val = LLDBSwigPythonCreateScriptedThread( - class_name.str().c_str(), m_interpreter.GetDictionaryName(), process_sp, - args_impl, error_string); + PythonObject ret_val; + + if (!script_obj) + ret_val = LLDBSwigPythonCreateScriptedThread( + class_name.str().c_str(), m_interpreter.GetDictionaryName(), process_sp, + args_impl, error_string); + else + ret_val = PythonObject(PyRefType::Borrowed, + static_cast<PyObject *>(script_obj->GetValue())); if (!ret_val) return {}; |