<rdar://problem/13194155>
Variables view out of sync with lldb in Xcode is now fixed. Depending on what happened stack frames could get out of date and a stale shared pointer (one that is no longer a current frame in a thread) could end up being used.
Now we don't store a weak_ptr to a frame in the ExecutionContextRef class, we just store its stack ID and we always regrab the frame from the thread by stack ID.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@177208 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/ExecutionContext.cpp b/source/Target/ExecutionContext.cpp
index 9ace4c9..6ab0355 100644
--- a/source/Target/ExecutionContext.cpp
+++ b/source/Target/ExecutionContext.cpp
@@ -524,8 +524,7 @@
m_target_wp (),
m_process_wp (),
m_thread_wp (),
- m_frame_wp (),
- m_tid(LLDB_INVALID_THREAD_ID),
+ m_tid(LLDB_INVALID_THREAD_ID),
m_stack_id ()
{
}
@@ -534,8 +533,7 @@
m_target_wp (),
m_process_wp (),
m_thread_wp (),
- m_frame_wp (),
- m_tid(LLDB_INVALID_THREAD_ID),
+ m_tid(LLDB_INVALID_THREAD_ID),
m_stack_id ()
{
if (exe_ctx)
@@ -546,8 +544,7 @@
m_target_wp (),
m_process_wp (),
m_thread_wp (),
- m_frame_wp (),
- m_tid(LLDB_INVALID_THREAD_ID),
+ m_tid(LLDB_INVALID_THREAD_ID),
m_stack_id ()
{
*this = exe_ctx;
@@ -558,8 +555,7 @@
m_target_wp(),
m_process_wp(),
m_thread_wp(),
- m_frame_wp(),
- m_tid(LLDB_INVALID_THREAD_ID),
+ m_tid(LLDB_INVALID_THREAD_ID),
m_stack_id ()
{
SetTargetPtr (target, adopt_selected);
@@ -572,7 +568,6 @@
m_target_wp (rhs.m_target_wp),
m_process_wp(rhs.m_process_wp),
m_thread_wp (rhs.m_thread_wp),
- m_frame_wp (rhs.m_frame_wp),
m_tid (rhs.m_tid),
m_stack_id (rhs.m_stack_id)
{
@@ -586,7 +581,6 @@
m_target_wp = rhs.m_target_wp;
m_process_wp = rhs.m_process_wp;
m_thread_wp = rhs.m_thread_wp;
- m_frame_wp = rhs.m_frame_wp;
m_tid = rhs.m_tid;
m_stack_id = rhs.m_stack_id;
}
@@ -605,7 +599,6 @@
else
m_tid = LLDB_INVALID_THREAD_ID;
lldb::StackFrameSP frame_sp (exe_ctx.GetFrameSP());
- m_frame_wp = frame_sp;
if (frame_sp)
m_stack_id = frame_sp->GetStackID();
else
@@ -669,7 +662,6 @@
{
if (frame_sp)
{
- m_frame_wp = frame_sp;
m_stack_id = frame_sp->GetStackID();
SetThreadSP (frame_sp->GetThread());
}
@@ -814,20 +806,9 @@
lldb::StackFrameSP
ExecutionContextRef::GetFrameSP () const
{
- lldb::StackFrameSP frame_sp (m_frame_wp.lock());
- if (frame_sp)
- {
- lldb::ThreadSP frame_thread_sp(frame_sp->GetThread());
- if (frame_thread_sp && frame_thread_sp->IsValid())
- 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;
- }
+ if (thread_sp)
+ return thread_sp->GetFrameWithStackID (m_stack_id);
return lldb::StackFrameSP();
}