diff options
| -rw-r--r-- | lldb/include/lldb/Target/Thread.h | 7 | ||||
| -rw-r--r-- | lldb/lldb.xcodeproj/project.pbxproj | 1 | ||||
| -rw-r--r-- | lldb/source/Expression/ClangFunction.cpp | 3 | ||||
| -rw-r--r-- | lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp | 1 | ||||
| -rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp | 1 | ||||
| -rw-r--r-- | lldb/source/Target/Thread.cpp | 15 | ||||
| -rw-r--r-- | lldb/source/Target/ThreadPlanBase.cpp | 7 |
7 files changed, 30 insertions, 5 deletions
diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h index 3f72909928a..e8042bc4110 100644 --- a/lldb/include/lldb/Target/Thread.h +++ b/lldb/include/lldb/Target/Thread.h @@ -616,7 +616,7 @@ public: // type than the actual system thread ID. uint32_t GetIndexID () const; - + //------------------------------------------------------------------ // lldb::ExecutionContextScope pure virtual functions //------------------------------------------------------------------ @@ -642,6 +642,10 @@ protected: friend class ThreadPlan; friend class StackFrameList; + + // This is necessary to make sure thread assets get destroyed while the thread is still in good shape + // to call virtual thread methods. This must be called by classes that derive from Thread in their destructor. + virtual void DestroyThread (); void PushPlan (lldb::ThreadPlanSP &plan_sp); @@ -688,6 +692,7 @@ protected: int m_resume_signal; ///< The signal that should be used when continuing this thread. lldb::StateType m_resume_state; ///< The state that indicates what this thread should do when the process is resumed. std::auto_ptr<lldb_private::Unwind> m_unwinder_ap; + bool m_destroy_called; // This is used internally to make sure derived Thread classes call DestroyThread. private: //------------------------------------------------------------------ // For Thread only diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj index 118eae7a0c8..ef4258c918c 100644 --- a/lldb/lldb.xcodeproj/project.pbxproj +++ b/lldb/lldb.xcodeproj/project.pbxproj @@ -2452,7 +2452,6 @@ isa = PBXProject; buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */; compatibilityVersion = "Xcode 3.1"; - developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( en, diff --git a/lldb/source/Expression/ClangFunction.cpp b/lldb/source/Expression/ClangFunction.cpp index 84b8bff9a26..1eeeb006291 100644 --- a/lldb/source/Expression/ClangFunction.cpp +++ b/lldb/source/Expression/ClangFunction.cpp @@ -590,7 +590,8 @@ ClangFunction::ExecuteFunction ( break; } - if (try_all_threads) + if (try_all_threads + && (stop_state == lldb::eStateStopped && Process::ProcessEventData::GetInterruptedFromEvent (event_sp.get()))) { call_plan_ptr->SetStopOthers (false); diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp index 2a9754a268f..4509eb7f150 100644 --- a/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp +++ b/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp @@ -55,6 +55,7 @@ ThreadMacOSX::ThreadMacOSX (ProcessMacOSX &process, lldb::tid_t tid) : ThreadMacOSX::~ThreadMacOSX () { + DestroyThread(); } #if defined (__i386__) || defined (__x86_64__) diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp index 6ee14060191..c1b5fa47d93 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp @@ -48,6 +48,7 @@ ThreadGDBRemote::ThreadGDBRemote (ProcessGDBRemote &process, lldb::tid_t tid) : ThreadGDBRemote::~ThreadGDBRemote () { ProcessGDBRemoteLog::LogIf(GDBR_LOG_THREAD, "%p: ThreadGDBRemote::~ThreadGDBRemote (pid = %i, tid = 0x%4.4x)", this, m_process.GetID(), GetID()); + DestroyThread(); } diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index eccb700fd26..22129d6ff6a 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -54,7 +54,8 @@ Thread::Thread (Process &process, lldb::tid_t tid) : m_curr_frames_ap (), m_resume_signal (LLDB_INVALID_SIGNAL_NUMBER), m_resume_state (eStateRunning), - m_unwinder_ap () + m_unwinder_ap (), + m_destroy_called (false) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); @@ -71,6 +72,17 @@ Thread::~Thread() LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Thread::~Thread(tid = 0x%4.4x)", this, GetID()); + /// If you hit this assert, it means your derived class forgot to call DoDestroy in its destructor. + assert (m_destroy_called); +} + +void +Thread::DestroyThread () +{ + m_plan_stack.clear(); + m_discarded_plan_stack.clear(); + m_completed_plan_stack.clear(); + m_destroy_called = true; } int @@ -625,7 +637,6 @@ Thread::DiscardThreadPlans(bool force) } } - // FIXME: What should we do about the immediate plans? } ThreadPlan * diff --git a/lldb/source/Target/ThreadPlanBase.cpp b/lldb/source/Target/ThreadPlanBase.cpp index 55ef2f71551..eceb383b380 100644 --- a/lldb/source/Target/ThreadPlanBase.cpp +++ b/lldb/source/Target/ThreadPlanBase.cpp @@ -36,7 +36,14 @@ ThreadPlanBase::ThreadPlanBase (Thread &thread) : ThreadPlan(ThreadPlan::eKindBase, "base plan", thread, eVoteYes, eVoteNoOpinion) { // Set the tracer to a default tracer. + // FIXME: need to add a thread settings variable to pix various tracers... +#define THREAD_PLAN_USE_ASSEMBLY_TRACER 1 + +#ifdef THREAD_PLAN_USE_ASSEMBLY_TRACER + ThreadPlanTracerSP new_tracer_sp (new ThreadPlanAssemblyTracer (m_thread)); +#else ThreadPlanTracerSP new_tracer_sp (new ThreadPlanTracer (m_thread)); +#endif new_tracer_sp->EnableTracing (m_thread.GetTraceEnabledState()); SetThreadPlanTracer(new_tracer_sp); } |

