[Lldb-commits] [lldb] r177166 - <rdar://problem/13194155>

Enrico Granata egranata at apple.com
Fri Mar 15 10:25:04 PDT 2013


Author: enrico
Date: Fri Mar 15 12:25:04 2013
New Revision: 177166

URL: http://llvm.org/viewvc/llvm-project?rev=177166&view=rev
Log:
<rdar://problem/13194155>

Fixing an issue where threads and frames could get out of sync and cause ValueObjects to fail to retrieve their values correctly

Modified:
    lldb/trunk/source/Target/ExecutionContext.cpp
    lldb/trunk/source/Target/StackFrameList.cpp

Modified: lldb/trunk/source/Target/ExecutionContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ExecutionContext.cpp?rev=177166&r1=177165&r2=177166&view=diff
==============================================================================
--- lldb/trunk/source/Target/ExecutionContext.cpp (original)
+++ lldb/trunk/source/Target/ExecutionContext.cpp Fri Mar 15 12:25:04 2013
@@ -815,22 +815,20 @@ lldb::StackFrameSP
 ExecutionContextRef::GetFrameSP () const
 {
     lldb::StackFrameSP frame_sp (m_frame_wp.lock());
-    if (!frame_sp && m_stack_id.IsValid())
+    if (frame_sp)
     {
-        lldb::ThreadSP thread_sp (GetThreadSP());
-        if (thread_sp)
-        {
-            frame_sp = thread_sp->GetFrameWithStackID (m_stack_id);
-            m_frame_wp = frame_sp;
-        }
-        else
-        {
-            // If the thread that this frame was supposed to belong to is not valid, then
-            // return a NULL frame_sp.
-            frame_sp.reset();
-        }
+        lldb::ThreadSP frame_thread_sp(frame_sp->GetThread());
+        if (frame_thread_sp && frame_thread_sp->IsValid())
+            return frame_sp;
     }
-    return frame_sp;
+    lldb::ThreadSP thread_sp (GetThreadSP());
+    if (thread_sp && thread_sp->IsValid())
+    {
+        frame_sp = thread_sp->GetFrameWithStackID (m_stack_id);
+        m_frame_wp = frame_sp;
+        return frame_sp;
+    }
+    return lldb::StackFrameSP();
 }
 
 ExecutionContext

Modified: lldb/trunk/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrameList.cpp?rev=177166&r1=177165&r2=177166&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrameList.cpp (original)
+++ lldb/trunk/source/Target/StackFrameList.cpp Fri Mar 15 12:25:04 2013
@@ -250,6 +250,10 @@ StackFrameList::SetCurrentInlinedDepth (
 void
 StackFrameList::GetFramesUpTo(uint32_t end_idx)
 {
+    // this makes sure we do not fetch frames for an invalid thread
+    if (m_thread.IsValid() == false)
+        return;
+
     // We've already gotten more frames than asked for, or we've already finished unwinding, return.
     if (m_frames.size() > end_idx || GetAllFramesFetched())
         return;





More information about the lldb-commits mailing list