diff options
author | Greg Clayton <gclayton@apple.com> | 2013-03-15 23:54:07 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-03-15 23:54:07 +0000 |
commit | 6482d2305efbfdac07b51793a5a8051fefba0f1f (patch) | |
tree | 06a5807386705386068346be45c527355cf5058b | |
parent | 0e4513b030bdd53af547c20f8122cff9658e8686 (diff) | |
download | bcm5719-llvm-6482d2305efbfdac07b51793a5a8051fefba0f1f.tar.gz bcm5719-llvm-6482d2305efbfdac07b51793a5a8051fefba0f1f.zip |
<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.
llvm-svn: 177208
-rw-r--r-- | lldb/include/lldb/Target/ExecutionContext.h | 2 | ||||
-rw-r--r-- | lldb/source/Target/ExecutionContext.cpp | 31 |
2 files changed, 6 insertions, 27 deletions
diff --git a/lldb/include/lldb/Target/ExecutionContext.h b/lldb/include/lldb/Target/ExecutionContext.h index 354c8b62905..de5fe14934a 100644 --- a/lldb/include/lldb/Target/ExecutionContext.h +++ b/lldb/include/lldb/Target/ExecutionContext.h @@ -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 }; diff --git a/lldb/source/Target/ExecutionContext.cpp b/lldb/source/Target/ExecutionContext.cpp index 9ace4c93b17..6ab03553cbc 100644 --- a/lldb/source/Target/ExecutionContext.cpp +++ b/lldb/source/Target/ExecutionContext.cpp @@ -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 (const ExecutionContext *exe_ctx) : 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 (const ExecutionContext &exe_ctx) : 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 (Target *target, bool adopt_selected) : 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 (const ExecutionContextRef &rhs) : 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 ExecutionContextRef &rhs) 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 ExecutionContext &exe_ctx) 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 lldb::StackFrameSP &frame_sp) { if (frame_sp) { - m_frame_wp = frame_sp; m_stack_id = frame_sp->GetStackID(); SetThreadSP (frame_sp->GetThread()); } @@ -814,20 +806,9 @@ ExecutionContextRef::GetThreadSP () const 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(); } |