From 1b86344fa80bd11853e0347ea33dc6cb5a460c4f Mon Sep 17 00:00:00 2001 From: Med Ismail Bennani Date: Tue, 18 Jan 2022 12:45:27 +0100 Subject: [lldb/Plugins] Move ScriptedThreadInterface to ScriptedThread Since we can have multiple Scripted Threads per Scripted Process, having only a single ScriptedThreadInterface (with a single object instance) will cause the method calls to be done on the wrong object. Instead, this patch creates a separate ScriptedThreadInterface for each new lldb_private::ScriptedThread to make sure we interact with the right instance. rdar://87427911 Differential Revision: https://reviews.llvm.org/D117070 Signed-off-by: Med Ismail Bennani --- lldb/source/Plugins/Process/scripted/ScriptedThread.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lldb/source/Plugins/Process/scripted/ScriptedThread.cpp') diff --git a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp index 959b8c581885..4185e1b67587 100644 --- a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp +++ b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp @@ -29,7 +29,9 @@ void ScriptedThread::CheckInterpreterAndScriptObject() const { } ScriptedThread::ScriptedThread(ScriptedProcess &process, Status &error) - : Thread(process, LLDB_INVALID_THREAD_ID), m_scripted_process(process) { + : Thread(process, LLDB_INVALID_THREAD_ID), m_scripted_process(process), + m_scripted_thread_interface_sp( + m_scripted_process.GetInterface().CreateScriptedThreadInterface()) { if (!process.IsValid()) { error.SetErrorString("Invalid scripted process"); return; @@ -190,7 +192,7 @@ void ScriptedThread::RefreshStateAfterStop() { } lldb::ScriptedThreadInterfaceSP ScriptedThread::GetInterface() const { - return m_scripted_process.GetInterface().GetScriptedThreadInterface(); + return m_scripted_thread_interface_sp; } std::shared_ptr ScriptedThread::GetDynamicRegisterInfo() { -- cgit v1.2.3