[lldb/Plugins] Add support of multiple ScriptedThreads in a ScriptedProcess

This patch adds support of multiple Scripted Threads in a ScriptedProcess.

This is done by fetching the Scripted Threads info dictionary at every
ScriptedProcess::DoUpdateThreadList and iterate over each element to
create a new ScriptedThread using the object instance, if it was not
already available.

This patch also adds the ability to pass a pointer of a script interpreter
object instance to initialize a ScriptedInterface instead of having to call
the script object initializer in the ScriptedInterface constructor.

This is used to instantiate the ScriptedThreadInterface from the
ScriptedThread constructor, to be able to perform call on that script
interpreter object instance.

Finally, the patch also updates the scripted process test to check for
multiple threads.

rdar://84507704

Differential Revision: https://reviews.llvm.org/D117071

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
Med Ismail Bennani
2022-01-18 12:45:57 +01:00
parent 1b86344fa8
commit d3e0f7e150
16 changed files with 175 additions and 72 deletions

View File

@@ -70,7 +70,7 @@ class ScriptedProcess:
tid (int): Thread ID to look for in the scripted process.
Returns:
Dict: The thread represented as a dictionary, withr the
Dict: The thread represented as a dictionary, with the
tid thread ID. None if tid doesn't match any of the scripted
process threads.
"""
@@ -212,11 +212,12 @@ class ScriptedThread:
self.target = None
self.process = None
self.args = None
if isinstance(process, lldb.SBProcess) and process.IsValid():
self.process = process
self.target = process.GetTarget()
if isinstance(process, ScriptedProcess):
self.target = process.target
self.process = self.target.GetProcess()
self.id = None
self.idx = None
self.name = None
self.queue = None
self.state = None