diff options
author | Jim Ingham <jingham@apple.com> | 2013-06-22 00:27:45 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2013-06-22 00:27:45 +0000 |
commit | dee1bc98f9d9dcbb7ea60fc6af699ddda315955c (patch) | |
tree | f271491f2dcf0a6bad368574495d009d3828783a /lldb/source | |
parent | 27982c70fc349da9e63d44367dd63e66c464bcc3 (diff) | |
download | bcm5719-llvm-dee1bc98f9d9dcbb7ea60fc6af699ddda315955c.tar.gz bcm5719-llvm-dee1bc98f9d9dcbb7ea60fc6af699ddda315955c.zip |
Add some useful logging for tracking thread matching problems.
llvm-svn: 184619
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 24 | ||||
-rw-r--r-- | lldb/source/Target/Thread.cpp | 22 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlan.cpp | 5 |
3 files changed, 42 insertions, 9 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 5880e00fa2c..4a2899d8f28 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1314,7 +1314,24 @@ ProcessGDBRemote::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new tid_t tid = m_thread_ids[i]; ThreadSP thread_sp (old_thread_list_copy.RemoveThreadByProtocolID(tid, false)); if (!thread_sp) + { thread_sp.reset (new ThreadGDBRemote (*this, tid)); + if (log && log->GetMask().Test(GDBR_LOG_VERBOSE)) + log->Printf( + "ProcessGDBRemote::%s Making new thread: %p for thread ID: 0x%" PRIx64 ".\n", + __FUNCTION__, + thread_sp.get(), + thread_sp->GetID()); + } + else + { + if (log && log->GetMask().Test(GDBR_LOG_VERBOSE)) + log->Printf( + "ProcessGDBRemote::%s Found old thread: %p for thread ID: 0x%" PRIx64 ".\n", + __FUNCTION__, + thread_sp.get(), + thread_sp->GetID()); + } new_thread_list.AddThread(thread_sp); } } @@ -1403,6 +1420,13 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet) { // Create the thread if we need to thread_sp.reset (new ThreadGDBRemote (*this, tid)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_THREAD)); + if (log && log->GetMask().Test(GDBR_LOG_VERBOSE)) + log->Printf ("ProcessGDBRemote::%s Adding new thread: %p for thread ID: 0x%" PRIx64 ".\n", + __FUNCTION__, + thread_sp.get(), + thread_sp->GetID()); + m_thread_list_real.AddThread(thread_sp); } gdb_thread = static_cast<ThreadGDBRemote *> (thread_sp.get()); diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 0527cb169f8..508238de458 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -704,8 +704,9 @@ Thread::ShouldStop (Event* event_ptr) 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 @@ Thread::ShouldReportRun (Event* event_ptr) { // 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 @@ Thread::ShouldReportRun (Event* event_ptr) 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 @@ Thread::PushPlan (ThreadPlanSP &thread_plan_sp) { 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 @@ Thread::PopPlan () 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 bc0ce57f9fc..ba35db19cf3 100644 --- a/lldb/source/Target/ThreadPlan.cpp +++ b/lldb/source/Target/ThreadPlan.cpp @@ -159,10 +159,11 @@ ThreadPlan::WillResume (StateType resume_state, bool current_plan) 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, |