Skip to content

Conversation

@Michael137
Copy link
Member

The new test fails on x86 and arm64 public macOS bots:

09:27:59  ======================================================================
09:27:59  FAIL: test_append_frames (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that we can add frames after real stack.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 122, in test_append_frames
09:27:59      self.assertEqual(new_frame_count, original_frame_count + 1)
09:27:59  AssertionError: 5 != 6
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ======================================================================
09:27:59  FAIL: test_applies_to_thread (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that applies_to_thread filters which threads get the provider.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 218, in test_applies_to_thread
09:27:59      self.assertEqual(
09:27:59  AssertionError: 5 != 1 : Thread with ID 1 should have 1 synthetic frame
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ======================================================================
09:27:59  FAIL: test_prepend_frames (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that we can add frames before real stack.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 84, in test_prepend_frames
09:27:59      self.assertEqual(new_frame_count, original_frame_count + 2)
09:27:59  AssertionError: 5 != 7
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ======================================================================
09:27:59  FAIL: test_remove_frame_provider_by_id (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that RemoveScriptedFrameProvider removes a specific provider by ID.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 272, in test_remove_frame_provider_by_id
09:27:59      self.assertEqual(thread.GetNumFrames(), 3, "Should have 3 synthetic frames")
09:27:59  AssertionError: 5 != 3 : Should have 3 synthetic frames
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ======================================================================
09:27:59  FAIL: test_replace_all_frames (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that we can replace the entire stack.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 41, in test_replace_all_frames
09:27:59      self.assertEqual(thread.GetNumFrames(), 3, "Should have 3 synthetic frames")
09:27:59  AssertionError: 5 != 3 : Should have 3 synthetic frames
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ======================================================================
09:27:59  FAIL: test_scripted_frame_objects (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that provider can return ScriptedFrame objects.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 159, in test_scripted_frame_objects
09:27:59      self.assertEqual(frame0.GetFunctionName(), "custom_scripted_frame_0")
09:27:59  AssertionError: 'thread_func(int)' != 'custom_scripted_frame_0'
09:27:59  - thread_func(int)
09:27:59  + custom_scripted_frame_0
09:27:59  
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ----------------------------------------------------------------------
09:27:59  Ran 6 tests in 14.242s
09:27:59  
09:27:59  FAILED (failures=6)

Reverts #161870

@Michael137 Michael137 enabled auto-merge (squash) November 12, 2025 10:07
@llvmbot llvmbot added the lldb label Nov 12, 2025
@Michael137 Michael137 requested review from medismailben and removed request for JDevlieghere November 12, 2025 10:07
@llvmbot
Copy link
Member

llvmbot commented Nov 12, 2025

@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)

Changes

The new test fails on x86 and arm64 public macOS bots:

09:27:59  ======================================================================
09:27:59  FAIL: test_append_frames (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that we can add frames after real stack.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 122, in test_append_frames
09:27:59      self.assertEqual(new_frame_count, original_frame_count + 1)
09:27:59  AssertionError: 5 != 6
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ======================================================================
09:27:59  FAIL: test_applies_to_thread (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that applies_to_thread filters which threads get the provider.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 218, in test_applies_to_thread
09:27:59      self.assertEqual(
09:27:59  AssertionError: 5 != 1 : Thread with ID 1 should have 1 synthetic frame
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ======================================================================
09:27:59  FAIL: test_prepend_frames (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that we can add frames before real stack.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 84, in test_prepend_frames
09:27:59      self.assertEqual(new_frame_count, original_frame_count + 2)
09:27:59  AssertionError: 5 != 7
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ======================================================================
09:27:59  FAIL: test_remove_frame_provider_by_id (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that RemoveScriptedFrameProvider removes a specific provider by ID.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 272, in test_remove_frame_provider_by_id
09:27:59      self.assertEqual(thread.GetNumFrames(), 3, "Should have 3 synthetic frames")
09:27:59  AssertionError: 5 != 3 : Should have 3 synthetic frames
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ======================================================================
09:27:59  FAIL: test_replace_all_frames (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that we can replace the entire stack.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 41, in test_replace_all_frames
09:27:59      self.assertEqual(thread.GetNumFrames(), 3, "Should have 3 synthetic frames")
09:27:59  AssertionError: 5 != 3 : Should have 3 synthetic frames
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ======================================================================
09:27:59  FAIL: test_scripted_frame_objects (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that provider can return ScriptedFrame objects.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 159, in test_scripted_frame_objects
09:27:59      self.assertEqual(frame0.GetFunctionName(), "custom_scripted_frame_0")
09:27:59  AssertionError: 'thread_func(int)' != 'custom_scripted_frame_0'
09:27:59  - thread_func(int)
09:27:59  + custom_scripted_frame_0
09:27:59  
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ----------------------------------------------------------------------
09:27:59  Ran 6 tests in 14.242s
09:27:59  
09:27:59  FAILED (failures=6)

Reverts llvm/llvm-project#161870


Patch is 113.82 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/167662.diff

43 Files Affected:

  • (modified) lldb/bindings/python/python-wrapper.swig (-12)
  • (modified) lldb/examples/python/templates/scripted_frame_provider.py (-47)
  • (modified) lldb/examples/python/templates/scripted_process.py (+16-31)
  • (modified) lldb/include/lldb/API/SBTarget.h (-30)
  • (modified) lldb/include/lldb/API/SBThread.h (-1)
  • (modified) lldb/include/lldb/API/SBThreadCollection.h (-1)
  • (modified) lldb/include/lldb/Interpreter/Interfaces/ScriptedFrameProviderInterface.h (-18)
  • (modified) lldb/include/lldb/Interpreter/ScriptInterpreter.h (-3)
  • (modified) lldb/include/lldb/Target/StackFrame.h (+2-5)
  • (modified) lldb/include/lldb/Target/StackFrameList.h (+5-31)
  • (modified) lldb/include/lldb/Target/SyntheticFrameProvider.h (+6-24)
  • (modified) lldb/include/lldb/Target/Target.h (-38)
  • (modified) lldb/include/lldb/Target/Thread.h (-12)
  • (modified) lldb/include/lldb/Target/ThreadSpec.h (-2)
  • (modified) lldb/include/lldb/Utility/ScriptedMetadata.h (-27)
  • (modified) lldb/include/lldb/lldb-private-interfaces.h (+2-2)
  • (modified) lldb/source/API/SBTarget.cpp (-82)
  • (modified) lldb/source/Commands/CommandObjectTarget.cpp (-200)
  • (modified) lldb/source/Interpreter/ScriptInterpreter.cpp (-7)
  • (modified) lldb/source/Plugins/CMakeLists.txt (-1)
  • (modified) lldb/source/Plugins/Process/scripted/ScriptedFrame.cpp (+27-58)
  • (modified) lldb/source/Plugins/Process/scripted/ScriptedFrame.h (+7-26)
  • (modified) lldb/source/Plugins/Process/scripted/ScriptedThread.cpp (+3-3)
  • (modified) lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.cpp (-2)
  • (modified) lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.cpp (+1-57)
  • (modified) lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.h (+2-21)
  • (modified) lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp (-13)
  • (modified) lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h (+5-116)
  • (modified) lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h (-1)
  • (removed) lldb/source/Plugins/SyntheticFrameProvider/CMakeLists.txt (-1)
  • (removed) lldb/source/Plugins/SyntheticFrameProvider/ScriptedFrameProvider/CMakeLists.txt (-12)
  • (removed) lldb/source/Plugins/SyntheticFrameProvider/ScriptedFrameProvider/ScriptedFrameProvider.cpp (-215)
  • (removed) lldb/source/Plugins/SyntheticFrameProvider/ScriptedFrameProvider/ScriptedFrameProvider.h (-53)
  • (modified) lldb/source/Target/StackFrameList.cpp (-35)
  • (modified) lldb/source/Target/SyntheticFrameProvider.cpp (+2-23)
  • (modified) lldb/source/Target/Target.cpp (-55)
  • (modified) lldb/source/Target/Thread.cpp (+1-71)
  • (modified) lldb/source/Target/ThreadSpec.cpp (-4)
  • (removed) lldb/test/API/functionalities/scripted_frame_provider/Makefile (-3)
  • (removed) lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py (-339)
  • (removed) lldb/test/API/functionalities/scripted_frame_provider/main.cpp (-55)
  • (removed) lldb/test/API/functionalities/scripted_frame_provider/test_frame_providers.py (-176)
  • (modified) lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp (-5)
diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig
index 84fb3a95c0942..3a0995e84f643 100644
--- a/lldb/bindings/python/python-wrapper.swig
+++ b/lldb/bindings/python/python-wrapper.swig
@@ -422,18 +422,6 @@ void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBBreakpoint(PyObject *
   return sb_ptr;
 }
 
-void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBThread(PyObject * data) {
-  lldb::SBThread *sb_ptr = nullptr;
-
-  int valid_cast =
-      SWIG_ConvertPtr(data, (void **)&sb_ptr, SWIGTYPE_p_lldb__SBThread, 0);
-
-  if (valid_cast == -1)
-    return NULL;
-
-  return sb_ptr;
-}
-
 void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBFrame(PyObject * data) {
   lldb::SBFrame *sb_ptr = nullptr;
 
diff --git a/lldb/examples/python/templates/scripted_frame_provider.py b/lldb/examples/python/templates/scripted_frame_provider.py
index 7a72f1a24c9da..20f4d76d188c2 100644
--- a/lldb/examples/python/templates/scripted_frame_provider.py
+++ b/lldb/examples/python/templates/scripted_frame_provider.py
@@ -31,54 +31,7 @@ class ScriptedFrameProvider(metaclass=ABCMeta):
         )
     """
 
-    @staticmethod
-    def applies_to_thread(thread):
-        """Determine if this frame provider should be used for a given thread.
-
-        This static method is called before creating an instance of the frame
-        provider to determine if it should be applied to a specific thread.
-        Override this method to provide custom filtering logic.
-
-        Args:
-            thread (lldb.SBThread): The thread to check.
-
-        Returns:
-            bool: True if this frame provider should be used for the thread,
-                False otherwise. The default implementation returns True for
-                all threads.
-
-        Example:
-
-        .. code-block:: python
-
-            @staticmethod
-            def applies_to_thread(thread):
-                # Only apply to thread 1
-                return thread.GetIndexID() == 1
-        """
-        return True
-
-    @staticmethod
     @abstractmethod
-    def get_description():
-        """Get a description of this frame provider.
-
-        This method should return a human-readable string describing what
-        this frame provider does. The description is used for debugging
-        and display purposes.
-
-        Returns:
-            str: A description of the frame provider.
-
-        Example:
-
-        .. code-block:: python
-
-            def get_description(self):
-                return "Crash log frame provider for thread 1"
-        """
-        pass
-
     def __init__(self, input_frames, args):
         """Construct a scripted frame provider.
 
diff --git a/lldb/examples/python/templates/scripted_process.py b/lldb/examples/python/templates/scripted_process.py
index 136edce165140..49059d533f38a 100644
--- a/lldb/examples/python/templates/scripted_process.py
+++ b/lldb/examples/python/templates/scripted_process.py
@@ -245,7 +245,6 @@ def __init__(self, process, args):
                 key/value pairs used by the scripted thread.
         """
         self.target = None
-        self.arch = None
         self.originating_process = None
         self.process = None
         self.args = None
@@ -267,9 +266,6 @@ def __init__(self, process, args):
             and process.IsValid()
         ):
             self.target = process.target
-            triple = self.target.triple
-            if triple:
-                self.arch = triple.split("-")[0]
             self.originating_process = process
             self.process = self.target.GetProcess()
             self.get_register_info()
@@ -356,14 +352,17 @@ def get_stackframes(self):
     def get_register_info(self):
         if self.register_info is None:
             self.register_info = dict()
-            if "x86_64" in self.arch:
+            if "x86_64" in self.originating_process.arch:
                 self.register_info["sets"] = ["General Purpose Registers"]
                 self.register_info["registers"] = INTEL64_GPR
-            elif "arm64" in self.arch or self.arch == "aarch64":
+            elif (
+                "arm64" in self.originating_process.arch
+                or self.originating_process.arch == "aarch64"
+            ):
                 self.register_info["sets"] = ["General Purpose Registers"]
                 self.register_info["registers"] = ARM64_GPR
             else:
-                raise ValueError("Unknown architecture", self.arch)
+                raise ValueError("Unknown architecture", self.originating_process.arch)
         return self.register_info
 
     @abstractmethod
@@ -406,12 +405,11 @@ def __init__(self, thread, args):
         """Construct a scripted frame.
 
         Args:
-            thread (ScriptedThread/lldb.SBThread): The thread owning this frame.
+            thread (ScriptedThread): The thread owning this frame.
             args (lldb.SBStructuredData): A Dictionary holding arbitrary
                 key/value pairs used by the scripted frame.
         """
         self.target = None
-        self.arch = None
         self.originating_thread = None
         self.thread = None
         self.args = None
@@ -421,17 +419,15 @@ def __init__(self, thread, args):
         self.register_ctx = {}
         self.variables = []
 
-        if isinstance(thread, ScriptedThread) or (
-            isinstance(thread, lldb.SBThread) and thread.IsValid()
+        if (
+            isinstance(thread, ScriptedThread)
+            or isinstance(thread, lldb.SBThread)
+            and thread.IsValid()
         ):
+            self.target = thread.target
             self.process = thread.process
-            self.target = self.process.target
-            triple = self.target.triple
-            if triple:
-                self.arch = triple.split("-")[0]
-            tid = thread.tid if isinstance(thread, ScriptedThread) else thread.id
             self.originating_thread = thread
-            self.thread = self.process.GetThreadByIndexID(tid)
+            self.thread = self.process.GetThreadByIndexID(thread.tid)
             self.get_register_info()
 
     @abstractmethod
@@ -512,18 +508,7 @@ def get_variables(self, filters):
 
     def get_register_info(self):
         if self.register_info is None:
-            if isinstance(self.originating_thread, ScriptedThread):
-                self.register_info = self.originating_thread.get_register_info()
-            elif isinstance(self.originating_thread, lldb.SBThread):
-                self.register_info = dict()
-                if "x86_64" in self.arch:
-                    self.register_info["sets"] = ["General Purpose Registers"]
-                    self.register_info["registers"] = INTEL64_GPR
-                elif "arm64" in self.arch or self.arch == "aarch64":
-                    self.register_info["sets"] = ["General Purpose Registers"]
-                    self.register_info["registers"] = ARM64_GPR
-                else:
-                    raise ValueError("Unknown architecture", self.arch)
+            self.register_info = self.originating_thread.get_register_info()
         return self.register_info
 
     @abstractmethod
@@ -657,12 +642,12 @@ def get_stop_reason(self):
 
             # TODO: Passthrough stop reason from driving process
             if self.driving_thread.GetStopReason() != lldb.eStopReasonNone:
-                if "arm64" in self.arch:
+                if "arm64" in self.originating_process.arch:
                     stop_reason["type"] = lldb.eStopReasonException
                     stop_reason["data"]["desc"] = (
                         self.driving_thread.GetStopDescription(100)
                     )
-                elif self.arch == "x86_64":
+                elif self.originating_process.arch == "x86_64":
                     stop_reason["type"] = lldb.eStopReasonSignal
                     stop_reason["data"]["signal"] = signal.SIGTRAP
                 else:
diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h
index c2fd3e2f50e3b..379a0bb7e9513 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -19,7 +19,6 @@
 #include "lldb/API/SBLaunchInfo.h"
 #include "lldb/API/SBStatisticsOptions.h"
 #include "lldb/API/SBSymbolContextList.h"
-#include "lldb/API/SBThreadCollection.h"
 #include "lldb/API/SBType.h"
 #include "lldb/API/SBValue.h"
 #include "lldb/API/SBWatchpoint.h"
@@ -987,35 +986,6 @@ class LLDB_API SBTarget {
 
   lldb::SBMutex GetAPIMutex() const;
 
-  /// Register a scripted frame provider for this target.
-  /// If a scripted frame provider with the same name and same argument
-  /// dictionary is already registered on this target, it will be overwritten.
-  ///
-  /// \param[in] class_name
-  ///     The name of the Python class that implements the frame provider.
-  ///
-  /// \param[in] args_dict
-  ///     A dictionary of arguments to pass to the frame provider class.
-  ///
-  /// \param[out] error
-  ///     An error object indicating success or failure.
-  ///
-  /// \return
-  ///     A unique identifier for the frame provider descriptor that was
-  ///     registered. 0 if the registration failed.
-  uint32_t RegisterScriptedFrameProvider(const char *class_name,
-                                         lldb::SBStructuredData args_dict,
-                                         lldb::SBError &error);
-
-  /// Remove a scripted frame provider from this target by name.
-  ///
-  /// \param[in] provider_id
-  ///     The id of the frame provider class to remove.
-  ///
-  /// \return
-  ///     An error object indicating success or failure.
-  lldb::SBError RemoveScriptedFrameProvider(uint32_t provider_id);
-
 protected:
   friend class SBAddress;
   friend class SBAddressRange;
diff --git a/lldb/include/lldb/API/SBThread.h b/lldb/include/lldb/API/SBThread.h
index 639e7a0a1a5c0..f6a6d19935b83 100644
--- a/lldb/include/lldb/API/SBThread.h
+++ b/lldb/include/lldb/API/SBThread.h
@@ -256,7 +256,6 @@ class LLDB_API SBThread {
   friend class SBThreadPlan;
   friend class SBTrace;
 
-  friend class lldb_private::ScriptInterpreter;
   friend class lldb_private::python::SWIGBridge;
 
   SBThread(const lldb::ThreadSP &lldb_object_sp);
diff --git a/lldb/include/lldb/API/SBThreadCollection.h b/lldb/include/lldb/API/SBThreadCollection.h
index d13dea0f11cd2..5a052e6246026 100644
--- a/lldb/include/lldb/API/SBThreadCollection.h
+++ b/lldb/include/lldb/API/SBThreadCollection.h
@@ -46,7 +46,6 @@ class LLDB_API SBThreadCollection {
   void SetOpaque(const lldb::ThreadCollectionSP &threads);
 
 private:
-  friend class SBTarget;
   friend class SBProcess;
   friend class SBThread;
   friend class SBSaveCoreOptions;
diff --git a/lldb/include/lldb/Interpreter/Interfaces/ScriptedFrameProviderInterface.h b/lldb/include/lldb/Interpreter/Interfaces/ScriptedFrameProviderInterface.h
index 49b60131399d5..2d9f713676f90 100644
--- a/lldb/include/lldb/Interpreter/Interfaces/ScriptedFrameProviderInterface.h
+++ b/lldb/include/lldb/Interpreter/Interfaces/ScriptedFrameProviderInterface.h
@@ -16,29 +16,11 @@
 namespace lldb_private {
 class ScriptedFrameProviderInterface : public ScriptedInterface {
 public:
-  virtual bool AppliesToThread(llvm::StringRef class_name,
-                               lldb::ThreadSP thread_sp) {
-    return true;
-  }
-
   virtual llvm::Expected<StructuredData::GenericSP>
   CreatePluginObject(llvm::StringRef class_name,
                      lldb::StackFrameListSP input_frames,
                      StructuredData::DictionarySP args_sp) = 0;
 
-  /// Get a description string for the frame provider.
-  ///
-  /// This is called by the descriptor to fetch a description from the
-  /// scripted implementation. Implementations should call a static method
-  /// on the scripting class to retrieve the description.
-  ///
-  /// \param class_name The name of the scripting class implementing the
-  /// provider.
-  ///
-  /// \return A string describing what this frame provider does, or an
-  ///         empty string if no description is available.
-  virtual std::string GetDescription(llvm::StringRef class_name) { return {}; }
-
   virtual StructuredData::ObjectSP GetFrameAtIndex(uint32_t index) {
     return {};
   }
diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreter.h b/lldb/include/lldb/Interpreter/ScriptInterpreter.h
index 0b91d6756552d..7fed4940b85bf 100644
--- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h
+++ b/lldb/include/lldb/Interpreter/ScriptInterpreter.h
@@ -21,7 +21,6 @@
 #include "lldb/API/SBMemoryRegionInfo.h"
 #include "lldb/API/SBStream.h"
 #include "lldb/API/SBSymbolContext.h"
-#include "lldb/API/SBThread.h"
 #include "lldb/Breakpoint/BreakpointOptions.h"
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Core/SearchFilter.h"
@@ -581,8 +580,6 @@ class ScriptInterpreter : public PluginInterface {
 
   lldb::StreamSP GetOpaqueTypeFromSBStream(const lldb::SBStream &stream) const;
 
-  lldb::ThreadSP GetOpaqueTypeFromSBThread(const lldb::SBThread &exe_ctx) const;
-
   lldb::StackFrameSP GetOpaqueTypeFromSBFrame(const lldb::SBFrame &frame) const;
 
   SymbolContext
diff --git a/lldb/include/lldb/Target/StackFrame.h b/lldb/include/lldb/Target/StackFrame.h
index af2e49b4a67da..cdbe8ae3c6779 100644
--- a/lldb/include/lldb/Target/StackFrame.h
+++ b/lldb/include/lldb/Target/StackFrame.h
@@ -441,11 +441,8 @@ class StackFrame : public ExecutionContextScope,
   ///   frames are included in this frame index count.
   uint32_t GetFrameIndex() const;
 
-  /// Set this frame's frame index.
-  void SetFrameIndex(uint32_t index) {
-    m_frame_index = index;
-    m_concrete_frame_index = index;
-  }
+  /// Set this frame's synthetic frame index.
+  void SetFrameIndex(uint32_t index) { m_frame_index = index; }
 
   /// Query this frame to find what frame it is in this Thread's
   /// StackFrameList, not counting inlined frames.
diff --git a/lldb/include/lldb/Target/StackFrameList.h b/lldb/include/lldb/Target/StackFrameList.h
index 539c070ff0f4b..5b0df0ddb3e29 100644
--- a/lldb/include/lldb/Target/StackFrameList.h
+++ b/lldb/include/lldb/Target/StackFrameList.h
@@ -20,13 +20,13 @@ namespace lldb_private {
 
 class ScriptedThread;
 
-class StackFrameList : public std::enable_shared_from_this<StackFrameList> {
+class StackFrameList {
 public:
   // Constructors and Destructors
   StackFrameList(Thread &thread, const lldb::StackFrameListSP &prev_frames_sp,
                  bool show_inline_frames);
 
-  virtual ~StackFrameList();
+  ~StackFrameList();
 
   /// Get the number of visible frames. Frames may be created if \p can_create
   /// is true. Synthetic (inline) frames expanded from the concrete frame #0
@@ -106,7 +106,6 @@ class StackFrameList : public std::enable_shared_from_this<StackFrameList> {
 
 protected:
   friend class Thread;
-  friend class ScriptedFrameProvider;
   friend class ScriptedThread;
 
   /// Use this API to build a stack frame list (used for scripted threads, for
@@ -212,23 +211,19 @@ class StackFrameList : public std::enable_shared_from_this<StackFrameList> {
   /// Whether or not to show synthetic (inline) frames. Immutable.
   const bool m_show_inlined_frames;
 
-  /// Returns true if fetching frames was interrupted, false otherwise.
-  virtual bool FetchFramesUpTo(uint32_t end_idx,
-                               InterruptionControl allow_interrupt);
-
 private:
   uint32_t SetSelectedFrameNoLock(lldb_private::StackFrame *frame);
   lldb::StackFrameSP
   GetFrameAtIndexNoLock(uint32_t idx,
                         std::shared_lock<std::shared_mutex> &guard);
 
-  /// @{
   /// These two Fetch frames APIs and SynthesizeTailCallFrames are called in
   /// GetFramesUpTo, they are the ones that actually add frames.  They must be
   /// called with the writer end of the list mutex held.
-  ///
+
+  /// Returns true if fetching frames was interrupted, false otherwise.
+  bool FetchFramesUpTo(uint32_t end_idx, InterruptionControl allow_interrupt);
   /// Not currently interruptible so returns void.
-  /// }@
   void FetchOnlyConcreteFramesUpTo(uint32_t end_idx);
   void SynthesizeTailCallFrames(StackFrame &next_frame);
 
@@ -236,27 +231,6 @@ class StackFrameList : public std::enable_shared_from_this<StackFrameList> {
   const StackFrameList &operator=(const StackFrameList &) = delete;
 };
 
-/// A StackFrameList that wraps another StackFrameList and uses a
-/// SyntheticFrameProvider to lazily provide frames from either the provider
-/// or the underlying real stack frame list.
-class SyntheticStackFrameList : public StackFrameList {
-public:
-  SyntheticStackFrameList(Thread &thread, lldb::StackFrameListSP input_frames,
-                          const lldb::StackFrameListSP &prev_frames_sp,
-                          bool show_inline_frames);
-
-protected:
-  /// Override FetchFramesUpTo to lazily return frames from the provider
-  /// or from the actual stack frame list.
-  bool FetchFramesUpTo(uint32_t end_idx,
-                       InterruptionControl allow_interrupt) override;
-
-private:
-  /// The input stack frame list that the provider transforms.
-  /// This could be a real StackFrameList or another SyntheticStackFrameList.
-  lldb::StackFrameListSP m_input_frames;
-};
-
 } // namespace lldb_private
 
 #endif // LLDB_TARGET_STACKFRAMELIST_H
diff --git a/lldb/include/lldb/Target/SyntheticFrameProvider.h b/lldb/include/lldb/Target/SyntheticFrameProvider.h
index 2d5330cb03105..61a492f356ece 100644
--- a/lldb/include/lldb/Target/SyntheticFrameProvider.h
+++ b/lldb/include/lldb/Target/SyntheticFrameProvider.h
@@ -24,25 +24,22 @@ namespace lldb_private {
 
 /// This struct contains the metadata needed to instantiate a frame provider
 /// and optional filters to control which threads it applies to.
-struct ScriptedFrameProviderDescriptor {
+struct SyntheticFrameProviderDescriptor {
   /// Metadata for instantiating the provider (e.g. script class name and args).
   lldb::ScriptedMetadataSP scripted_metadata_sp;
 
-  /// Interface for calling static methods on the provider class.
-  lldb::ScriptedFrameProviderInterfaceSP interface_sp;
-
   /// Optional list of thread specifications to which this provider applies.
   /// If empty, the provider applies to all threads. A thread matches if it
   /// satisfies ANY of the specs in this vector (OR logic).
   std::vector<ThreadSpec> thread_specs;
 
-  ScriptedFrameProviderDescriptor() = default;
+  SyntheticFrameProviderDescriptor() = default;
 
-  ScriptedFrameProviderDescriptor(lldb::ScriptedMetadataSP metadata_sp)
+  SyntheticFrameProviderDescriptor(lldb::ScriptedMetadataSP metadata_sp)
       : scripted_metadata_sp(metadata_sp) {}
 
-  ScriptedFrameProviderDescriptor(lldb::ScriptedMetadataSP metadata_sp,
-                                  const std::vector<ThreadSpec> &specs)
+  SyntheticFrameProviderDescriptor(lldb::ScriptedMetadataSP metadata_sp,
+                                   const std::vector<ThreadSpec> &specs)
       : scripted_metadata_sp(metadata_sp), thread_specs(specs) {}
 
   /// Get the name of this descriptor (the scripted class name).
@@ -50,12 +47,6 @@ struct ScriptedFrameProviderDescriptor {
     return scripted_metadata_sp ? scripted_metadata_sp->GetClassName() : "";
   }
 
-  /// Get the description of this frame provider.
-  ///
-  /// \return A string describing what this frame provider does, or an
-  ///         empty string if no description is available.
-  std::string GetDescription() const;
-
   /// Check if this descriptor applies to the given thread.
   bool AppliesToThread(Thread &thread) const {
     // If no thread specs specified, applies to all threads.
@@ -73,13 +64,6 @@ struct ScriptedFrameProviderDescriptor {
   /// Check if this descriptor has valid metadata for script-based providers.
   bool IsValid() const { return scripted_metadata_sp != nullptr; }
 
-  /// Get a unique identifier for this descriptor based on its contents.
-  /// The ID is computed from the class name and arguments dictionary,
-  /// not from the pointer address, so two descriptors with the same
-  /// contents will have the same ID.
-  uint32_t GetID() const;
-
-  /// Dump a description of this descriptor to the given stream.
   void Dump(Stream *s) const;
 };
 
@@ -111,7 +95,7 @@ class SyntheticFrameProvider : public PluginInterface {
   ///     otherwise an \a llvm::Error.
   static llvm::Expected<lldb::SyntheticFram...
[truncated]

@Michael137 Michael137 merged commit b7bc4a2 into main Nov 12, 2025
9 of 11 checks passed
@Michael137 Michael137 deleted the revert-161870-scripted-frame-provider branch November 12, 2025 10:13
git-crd pushed a commit to git-crd/crd-llvm-project that referenced this pull request Nov 13, 2025
…m#167662)

The new test fails on x86 and arm64 public macOS bots:
```
09:27:59  ======================================================================
09:27:59  FAIL: test_append_frames (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that we can add frames after real stack.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 122, in test_append_frames
09:27:59      self.assertEqual(new_frame_count, original_frame_count + 1)
09:27:59  AssertionError: 5 != 6
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ======================================================================
09:27:59  FAIL: test_applies_to_thread (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that applies_to_thread filters which threads get the provider.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 218, in test_applies_to_thread
09:27:59      self.assertEqual(
09:27:59  AssertionError: 5 != 1 : Thread with ID 1 should have 1 synthetic frame
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ======================================================================
09:27:59  FAIL: test_prepend_frames (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that we can add frames before real stack.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 84, in test_prepend_frames
09:27:59      self.assertEqual(new_frame_count, original_frame_count + 2)
09:27:59  AssertionError: 5 != 7
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ======================================================================
09:27:59  FAIL: test_remove_frame_provider_by_id (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that RemoveScriptedFrameProvider removes a specific provider by ID.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 272, in test_remove_frame_provider_by_id
09:27:59      self.assertEqual(thread.GetNumFrames(), 3, "Should have 3 synthetic frames")
09:27:59  AssertionError: 5 != 3 : Should have 3 synthetic frames
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ======================================================================
09:27:59  FAIL: test_replace_all_frames (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that we can replace the entire stack.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 41, in test_replace_all_frames
09:27:59      self.assertEqual(thread.GetNumFrames(), 3, "Should have 3 synthetic frames")
09:27:59  AssertionError: 5 != 3 : Should have 3 synthetic frames
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ======================================================================
09:27:59  FAIL: test_scripted_frame_objects (TestScriptedFrameProvider.ScriptedFrameProviderTestCase)
09:27:59     Test that provider can return ScriptedFrame objects.
09:27:59  ----------------------------------------------------------------------
09:27:59  Traceback (most recent call last):
09:27:59    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 159, in test_scripted_frame_objects
09:27:59      self.assertEqual(frame0.GetFunctionName(), "custom_scripted_frame_0")
09:27:59  AssertionError: 'thread_func(int)' != 'custom_scripted_frame_0'
09:27:59  - thread_func(int)
09:27:59  + custom_scripted_frame_0
09:27:59  
09:27:59  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
09:27:59  ----------------------------------------------------------------------
09:27:59  Ran 6 tests in 14.242s
09:27:59  
09:27:59  FAILED (failures=6)
```

Reverts llvm#161870
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants