[Lldb-commits] [lldb] [lldb] Introduce ScriptedFrameProvider for real threads (PR #161870)

via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 31 13:03:02 PDT 2025


================
@@ -55,6 +56,38 @@ StackFrameList::~StackFrameList() {
   Clear();
 }
 
+SyntheticStackFrameList::SyntheticStackFrameList(
+    Thread &thread, const lldb::StackFrameListSP &prev_frames_sp,
+    bool show_inline_frames)
+    : StackFrameList(thread, prev_frames_sp, show_inline_frames) {}
+
+bool SyntheticStackFrameList::FetchFramesUpTo(
+    uint32_t end_idx, InterruptionControl allow_interrupt) {
+  // Check if the thread has a synthetic frame provider
+  if (auto provider_sp = m_thread.GetFrameProvider()) {
+    // Use the synthetic frame provider to generate frames lazily
+    // Keep fetching until we reach end_idx or the provider returns an error
+    StackFrameListSP real_frames = std::make_shared<StackFrameList>(
+        m_thread, m_prev_frames_sp, m_show_inlined_frames);
+    for (uint32_t idx = m_frames.size(); idx <= end_idx; idx++) {
+      auto frame_or_err = provider_sp->GetFrameAtIndex(real_frames, idx);
+      if (!frame_or_err) {
----------------
jimingham wrote:

You should check for WasInterrupted here.  Since the provider is generating frames lazily, it should be fine with us not asking for all the frames we had originally intended.

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


More information about the lldb-commits mailing list