diff options
author | Med Ismail Bennani <medismail.bennani@gmail.com> | 2022-01-18 12:52:24 +0100 |
---|---|---|
committer | Med Ismail Bennani <medismail.bennani@gmail.com> | 2022-01-24 20:25:54 +0100 |
commit | 45148bfe8aece6ca319dcc32351e20bba26b2ea7 (patch) | |
tree | 1d4a982e3b7be8f9df51a0fd649108bbef8b02db /lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp | |
parent | cfa55bfe781474a30467b1bbf2e7874985171196 (diff) | |
download | llvm-45148bfe8aece6ca319dcc32351e20bba26b2ea7.zip llvm-45148bfe8aece6ca319dcc32351e20bba26b2ea7.tar.gz llvm-45148bfe8aece6ca319dcc32351e20bba26b2ea7.tar.bz2 |
[lldb/Plugins] Fix ScriptedThread IndexID reporting
When listing all the Scripted Threads of a ScriptedProcess, we can see that all
have the thread index set to 1. This is caused by the lldb_private::Thread
constructor, which sets the m_index_id member using the provided thread id `tid`.
Because the call to the super constructor is done before instantiating
the `ScriptedThreadInterface`, lldb can't fetch the thread id from the
script instance, so it uses `LLDB_INVALID_THREAD_ID` instead.
To mitigate this, this patch takes advantage of the `ScriptedThread::Create`
fallible constructor idiom to defer calling the `ScriptedThread` constructor
(and the `Thread` super constructor with it), until we can fetch a valid
thread id `tid` from the `ScriptedThreadInterface`.
rdar://87432065
Differential Revision: https://reviews.llvm.org/D117076
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 | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp index 511a42f..d471b2c 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp @@ -32,7 +32,7 @@ ScriptedThreadPythonInterface::ScriptedThreadPythonInterface( StructuredData::GenericSP ScriptedThreadPythonInterface::CreatePluginObject( const llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp, StructuredData::Generic *script_obj) { - if (class_name.empty()) + if (class_name.empty() && !script_obj) return {}; ProcessSP process_sp = exe_ctx.GetProcessSP(); |