From 390adc38fc112be360bd15499e5241bf4e675b6f Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 27 Jan 2022 23:17:16 +0100 Subject: Merge llvm-project main llvmorg-14-init-17616-g024a1fab5c35 This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-14-init-17616-g024a1fab5c35. PR: 261742 MFC after: 2 weeks (cherry picked from commit 04eeddc0aa8e0a417a16eaf9d7d095207f4a8623) --- .../Python/ScriptedThreadPythonInterface.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp') diff --git a/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp b/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp index 6a881bfe625c..d471b2c5f7e3 100644 --- a/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp +++ b/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp @@ -31,9 +31,8 @@ ScriptedThreadPythonInterface::ScriptedThreadPythonInterface( StructuredData::GenericSP ScriptedThreadPythonInterface::CreatePluginObject( const llvm::StringRef class_name, ExecutionContext &exe_ctx, - StructuredData::DictionarySP args_sp) { - - if (class_name.empty()) + StructuredData::DictionarySP args_sp, StructuredData::Generic *script_obj) { + if (class_name.empty() && !script_obj) return {}; ProcessSP process_sp = exe_ctx.GetProcessSP(); @@ -43,15 +42,21 @@ StructuredData::GenericSP ScriptedThreadPythonInterface::CreatePluginObject( Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN, Locker::FreeLock); - void *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(script_obj->GetValue())); if (!ret_val) return {}; m_object_instance_sp = - StructuredData::GenericSP(new StructuredPythonObject(ret_val)); + StructuredData::GenericSP(new StructuredPythonObject(std::move(ret_val))); return m_object_instance_sp; } -- cgit v1.2.3