[Lldb-commits] [lldb] [lldb/docs] Add scripting extensions documentation to the website (PR #97262)

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 1 17:55:55 PDT 2024


================
@@ -0,0 +1,70 @@
+from abc import abstractmethod
+
+import lldb
+
+
+class ScriptedThreadPlan:
+    """
+    Class that provides data for an instance of a LLDB 'ScriptedThreadPlan' plug-in class used to construct custom stepping logic.
+
+    """
+
+    def __init__(self, thread_plan: lldb.SBThreadPlan):
+        """Initialization needs a valid lldb.SBThreadPlan object. This plug-in will get created after a live process is valid and has stopped.
+
+        Args:
+            thread_plan (lldb.SBThreadPlan): The underlying `ThreadPlan` that is pushed onto the plan stack.
+        """
+        self.thread_plan = thread_plan
+
+    def explains_stop(self, event: lldb.SBEvent) -> bool:
+        """Each plan is asked if it "explains" the stop.  The first plan to claim the stop wins.
+
+        Args:
+            event (lldb.SBEvent): The process stop event.
+
+        Returns:
+            bool: `True` if this stop could be claimed by this thread plan, `False` otherwise.
+            Defaults to `True`.
+        """
+        return True
+
+    def is_stale(self) -> bool:
+        """If your plan is no longer relevant (for instance, you were stepping in a particular stack frame, but some other operation pushed that frame off the stack) return True and your plan will get popped.
+
+        Returns:
+            bool: `True` if this thread plan is stale, `False` otherwise.
+            Defaults to `True`.
+        """
+        return True
----------------
medismailben wrote:

I went with `True` since this is the default value in case of an error on the C++ side:

https://github.com/apple/llvm-project/blob/swift/release/6.0/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp#L1754

Do you think we should change the default value everywhere to be False ?

https://github.com/llvm/llvm-project/pull/97262


More information about the lldb-commits mailing list