[Lldb-commits] [lldb] r177208 - <rdar://problem/13194155>
Greg Clayton
gclayton at apple.com
Fri Mar 15 16:54:07 PDT 2013
Author: gclayton
Date: Fri Mar 15 18:54:07 2013
New Revision: 177208
URL: http://llvm.org/viewvc/llvm-project?rev=177208&view=rev
Log:
<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.
Modified:
lldb/trunk/include/lldb/Target/ExecutionContext.h
lldb/trunk/source/Target/ExecutionContext.cpp
Modified: lldb/trunk/include/lldb/Target/ExecutionContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ExecutionContext.h?rev=177208&r1=177207&r2=177208&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ExecutionContext.h (original)
+++ lldb/trunk/include/lldb/Target/ExecutionContext.h Fri Mar 15 18:54:07 2013
@@ -335,7 +335,6 @@ public:
ClearFrame ()
{
m_stack_id.Clear();
- m_frame_wp.reset();
}
protected:
@@ -345,7 +344,6 @@ protected:
lldb::TargetWP m_target_wp; ///< A weak reference to a target
lldb::ProcessWP m_process_wp; ///< A weak reference to a process
mutable lldb::ThreadWP m_thread_wp; ///< A weak reference to a thread
- mutable lldb::StackFrameWP m_frame_wp; ///< A weak reference to a frame
lldb::tid_t m_tid; ///< The thread ID that this object refers to in case the backing object changes
StackID m_stack_id; ///< The stack ID that this object refers to in case the backing object changes
};
Modified: lldb/trunk/source/Target/ExecutionContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ExecutionContext.cpp?rev=177208&r1=177207&r2=177208&view=diff
==============================================================================
--- lldb/trunk/source/Target/ExecutionContext.cpp (original)
+++ lldb/trunk/source/Target/ExecutionContext.cpp Fri Mar 15 18:54:07 2013
@@ -524,8 +524,7 @@ ExecutionContextRef::ExecutionContextRef
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 @@ ExecutionContextRef::ExecutionContextRef
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 @@ ExecutionContextRef::ExecutionContextRef
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 @@ ExecutionContextRef::ExecutionContextRef
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 @@ ExecutionContextRef::ExecutionContextRef
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 @@ ExecutionContextRef::operator =(const Ex
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 @@ ExecutionContextRef::operator =(const Ex
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 @@ ExecutionContextRef::SetFrameSP (const l
{
if (frame_sp)
{
- m_frame_wp = frame_sp;
m_stack_id = frame_sp->GetStackID();
SetThreadSP (frame_sp->GetThread());
}
@@ -814,20 +806,9 @@ ExecutionContextRef::GetThreadSP () cons
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();
}
More information about the lldb-commits
mailing list