================
@@ -1506,29 +1506,39 @@ llvm::Error Thread::LoadScriptedFrameProvider(
     const ScriptedFrameProviderDescriptor &descriptor) {
   std::lock_guard<std::recursive_mutex> guard(m_frame_mutex);
 
-  // Note: We don't create input_frames here - it will be created lazily
-  // by SyntheticStackFrameList when frames are first fetched.
-  // Creating them too early can cause crashes during thread initialization.
-
-  // Create a temporary StackFrameList just to get the thread reference for the
-  // provider. The provider won't actually use this - it will get real input
-  // frames from SyntheticStackFrameList later.
-  StackFrameListSP temp_frames =
-      std::make_shared<StackFrameList>(*this, m_prev_frames_sp, true);
+  // Create input frames for this provider:
+  // - If no providers exist yet, use real unwinder frames
+  // - If providers exist, wrap the previous provider in a
+  // SyntheticStackFrameList
+  //   This creates the chain: each provider's OUTPUT becomes the next
+  //   provider's INPUT
+  StackFrameListSP input_frames;
+  if (m_frame_providers.empty()) {
+    // First provider gets real unwinder frames
+    input_frames =
+        std::make_shared<StackFrameList>(*this, m_prev_frames_sp, true);
+  } else {
+    // Subsequent providers get the previous provider's OUTPUT
+    // We create a SyntheticStackFrameList that wraps the previous provider
+    SyntheticFrameProviderSP prev_provider = m_frame_providers.back();
+    StackFrameListSP prev_input = prev_provider->GetInputFrames();
----------------
bulbazord wrote:

Something here feels strange. The comment saying you're getting the previous 
provider's output but then you call this variable prev_input. It _sounds_ like 
`prev_input` represents the frame list that the previous provider received? Or 
is it supposed to be the input *from* the previous provider?

I think I understand what's supposed to happen but I'm having trouble following 
the implementation logic here.

https://github.com/llvm/llvm-project/pull/172849
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to