The thread plan destructors may call Thread virtual methods.  That means they have to get cleaned up in the derived class's destructor.  Make sure that happens.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119675 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/Thread.cpp b/source/Target/Thread.cpp
index eccb700..22129d6 100644
--- a/source/Target/Thread.cpp
+++ b/source/Target/Thread.cpp
@@ -54,7 +54,8 @@
     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 @@
     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 @@
         }
 
     }
-    // FIXME: What should we do about the immediate plans?
 }
 
 ThreadPlan *
diff --git a/source/Target/ThreadPlanBase.cpp b/source/Target/ThreadPlanBase.cpp
index 55ef2f7..eceb383 100644
--- a/source/Target/ThreadPlanBase.cpp
+++ b/source/Target/ThreadPlanBase.cpp
@@ -36,7 +36,14 @@
     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);
 }