Add some useful logging for tracking thread matching problems.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184619 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/Thread.cpp b/source/Target/Thread.cpp
index 0527cb1..508238d 100644
--- a/source/Target/Thread.cpp
+++ b/source/Target/Thread.cpp
@@ -704,8 +704,9 @@
     
     if (log)
     {
-        log->Printf ("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64 ", pc = 0x%16.16" PRIx64,
-                     __FUNCTION__, 
+        log->Printf ("Thread::%s(%p) for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64 ", pc = 0x%16.16" PRIx64,
+                     __FUNCTION__,
+                     this,
                      GetID (),
                      GetProtocolID (),
                      GetRegisterContext() ? GetRegisterContext()->GetPC() : LLDB_INVALID_ADDRESS);
@@ -966,8 +967,9 @@
     {
         // Don't use GetCompletedPlan here, since that suppresses private plans.
         if (log)
-            log->Printf ("Current Plan for thread %d (0x%4.4" PRIx64 ", %s): %s being asked whether we should report run.",
-                         GetIndexID(), 
+            log->Printf ("Current Plan for thread %d(%p) (0x%4.4" PRIx64 ", %s): %s being asked whether we should report run.",
+                         GetIndexID(),
+                         this,
                          GetID(),
                          StateAsCString(GetTemporaryResumeState()),
                          m_completed_plan_stack.back()->GetName());
@@ -977,8 +979,9 @@
     else
     {
         if (log)
-            log->Printf ("Current Plan for thread %d (0x%4.4" PRIx64 ", %s): %s being asked whether we should report run.",
-                         GetIndexID(), 
+            log->Printf ("Current Plan for thread %d(%p) (0x%4.4" PRIx64 ", %s): %s being asked whether we should report run.",
+                         GetIndexID(),
+                         this,
                          GetID(),
                          StateAsCString(GetTemporaryResumeState()),
                          GetCurrentPlan()->GetName());
@@ -1013,7 +1016,8 @@
         {
             StreamString s;
             thread_plan_sp->GetDescription (&s, lldb::eDescriptionLevelFull);
-            log->Printf("Pushing plan: \"%s\", tid = 0x%4.4" PRIx64 ".",
+            log->Printf("Thread::PushPlan(0x%p): \"%s\", tid = 0x%4.4" PRIx64 ".",
+                        this,
                         s.GetData(),
                         thread_plan_sp->GetThread().GetID());
         }
@@ -1043,9 +1047,13 @@
 void
 Thread::DiscardPlan ()
 {
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     if (m_plan_stack.size() > 1)
     {
         ThreadPlanSP &plan = m_plan_stack.back();
+        if (log)
+            log->Printf("Discarding plan: \"%s\", tid = 0x%4.4" PRIx64 ".", plan->GetName(), plan->GetThread().GetID());
+
         m_discarded_plan_stack.push_back (plan);
         plan->WillPop();
         m_plan_stack.pop_back();