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

Adrian Vogelsgesang via lldb-commits lldb-commits at lists.llvm.org
Sat Oct 4 18:00:27 PDT 2025


================
@@ -1439,13 +1444,133 @@ void Thread::CalculateExecutionContext(ExecutionContext &exe_ctx) {
 StackFrameListSP Thread::GetStackFrameList() {
   std::lock_guard<std::recursive_mutex> guard(m_frame_mutex);
 
-  if (!m_curr_frames_sp)
-    m_curr_frames_sp =
-        std::make_shared<StackFrameList>(*this, m_prev_frames_sp, true);
+  if (!m_curr_frames_sp) {
+    
+    StackFrameListSP real_frames_sp =
+          std::make_shared<StackFrameList>(*this, m_prev_frames_sp, true);
+    
+    if (m_frame_provider_sp) {
+      lldb::ScriptedFrameProviderMergeStrategy strategy =
+          m_frame_provider_sp->GetMergeStrategy();
+      
+      auto scripted_list_or_err = GetScriptedFrameList();
+      if (!scripted_list_or_err) {
+        LLDB_LOG_ERROR(GetLog(LLDBLog::Thread),
+                       scripted_list_or_err.takeError(),
+                       "Failed to get scripted frame list: {0}");
+        m_curr_frames_sp = real_frames_sp;
+        return m_curr_frames_sp;
+      }
+      
+      StackFrameListSP scripted_frames_sp = *scripted_list_or_err;
+      uint32_t num_real = real_frames_sp->GetNumFrames(true);
+      uint32_t num_scripted = scripted_frames_sp->GetNumFrames(false);
+
+      switch (strategy) {
----------------
vogelsgesang wrote:

could we leave the merging up to the ScriptedFrameProvider? E.g., by having a `get_frames(iterator) -> iterator` method similar to gdb's frame filters?

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


More information about the lldb-commits mailing list