Add some useful logging for tracking thread matching problems.
llvm-svn: 184619
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 0527cb1..508238d 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/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();
diff --git a/lldb/source/Target/ThreadPlan.cpp b/lldb/source/Target/ThreadPlan.cpp
index bc0ce57..ba35db1 100644
--- a/lldb/source/Target/ThreadPlan.cpp
+++ b/lldb/source/Target/ThreadPlan.cpp
@@ -159,10 +159,11 @@
addr_t pc = reg_ctx->GetPC();
addr_t sp = reg_ctx->GetSP();
addr_t fp = reg_ctx->GetFP();
- log->Printf("%s Thread #%u: tid = 0x%4.4" PRIx64 ", pc = 0x%8.8" PRIx64 ", sp = 0x%8.8" PRIx64 ", fp = 0x%8.8" PRIx64 ", "
+ log->Printf("%s Thread #%u (0x%p): tid = 0x%4.4" PRIx64 ", pc = 0x%8.8" PRIx64 ", sp = 0x%8.8" PRIx64 ", fp = 0x%8.8" PRIx64 ", "
"plan = '%s', state = %s, stop others = %d",
__FUNCTION__,
- m_thread.GetIndexID(),
+ m_thread.GetIndexID(),
+ &m_thread,
m_thread.GetID(),
(uint64_t)pc,
(uint64_t)sp,