diff options
author | Med Ismail Bennani <medismail.bennani@gmail.com> | 2021-10-19 23:30:22 +0000 |
---|---|---|
committer | Med Ismail Bennani <medismail.bennani@gmail.com> | 2021-11-10 17:43:28 +0100 |
commit | 738621d047f2c14482509b39f8307967a91e7586 (patch) | |
tree | a4a82deacf837d9edbc499b7d04f9140835135b4 /lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp | |
parent | ad0f7d3d4a0c7ceaa5878494b2ad673287ef6a76 (diff) | |
download | llvm-738621d047f2c14482509b39f8307967a91e7586.zip llvm-738621d047f2c14482509b39f8307967a91e7586.tar.gz llvm-738621d047f2c14482509b39f8307967a91e7586.tar.bz2 |
[lldb/bindings] Change ScriptedThread initializer parameters
This patch changes the `ScriptedThread` initializer in couple of ways:
- It replaces the `SBTarget` parameter by a `SBProcess` (pointing to the
`ScriptedProcess` that "owns" the `ScriptedThread`).
- It adds a reference to the `ScriptedProcessInfo` Dictionary, to pass
arbitrary user-input to the `ScriptedThread`.
This patch also fixes the SWIG bindings methods that call the
`ScriptedProcess` and `ScriptedThread` initializers by passing all the
arguments to the appropriate `PythonCallable` object.
Differential Revision: https://reviews.llvm.org/D112046
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp index 4d6903d..d2c28bc 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp @@ -36,16 +36,20 @@ StructuredData::GenericSP ScriptedThreadPythonInterface::CreatePluginObject( if (class_name.empty()) return {}; - Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN, - Locker::FreeLock); - + ProcessSP process_sp = exe_ctx.GetProcessSP(); + StructuredDataImpl *args_impl = nullptr; + if (args_sp) { + args_impl = new StructuredDataImpl(); + args_impl->SetObjectSP(args_sp); + } std::string error_string; - TargetSP target_sp = exe_ctx.GetTargetSP(); + Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN, + Locker::FreeLock); void *ret_val = LLDBSwigPythonCreateScriptedThread( - class_name.str().c_str(), m_interpreter.GetDictionaryName(), target_sp, - error_string); + class_name.str().c_str(), m_interpreter.GetDictionaryName(), process_sp, + args_impl, error_string); if (!ret_val) return {}; |