[Lldb-commits] [PATCH] D118482: [lldb/Plugins] Add lldb.ScriptedProcess.get_most_relevant_thread_index interpreter method

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 31 13:47:27 PST 2022

mib updated this revision to Diff 404707.
mib retitled this revision from "[lldb/Plugins] Add ScriptedProcessInterface::GetSelectedThreadIndex method" to "[lldb/Plugins] Add lldb.ScriptedProcess.get_most_relevant_thread_index interpreter method".
mib edited the summary of this revision.
mib added a comment.

Following an offline discussion with @jingham, we agreed that we should leave the internal lldb machinery deal with selecting the right thread to be stopped at.

However, the interpreter `ScriptedProcess` method to let the user provide the most relevant thread index can still be very useful, for instance when creating the appropriate stop reason from the `ScriptedThread` instances to fetch the `most_relevant_thread_index` from `ScriptedProcess`.

This is why this update removes all the thread selecting logic from the ScriptedProcess plugin and makes it so `get_most_relevant_thread_index` cannot be accessed from the debugger.




Index: lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py
--- lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py
+++ lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py
@@ -57,6 +57,9 @@
         return data
+    def get_most_relevant_thread_index(self):
+        return 3
     def get_loaded_images(self):
         # TODO: Iterate over corefile_target modules and build a data structure
         # from it.
Index: lldb/examples/python/scripted_process/scripted_process.py
--- lldb/examples/python/scripted_process/scripted_process.py
+++ lldb/examples/python/scripted_process/scripted_process.py
@@ -76,6 +76,15 @@
+    def get_most_relevant_thread_index(self):
+        """ Get the index of the most releveant scripted process thread.
+        Returns:
+            Int: The most relevant thread index according to the user.
+                 (default: 0)
+        """
+        return 0
     def get_registers_for_thread(self, tid):
         """ Get the register context dictionary for a certain thread of

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118482.404707.patch
Type: text/x-patch
Size: 1284 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220131/ea915d02/attachment.bin>

More information about the lldb-commits mailing list