diff options
author | Greg Clayton <gclayton@apple.com> | 2010-09-03 22:45:01 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2010-09-03 22:45:01 +0000 |
commit | 1346f7e09825d6943c797d0071777220b24e8d3a (patch) | |
tree | 1f90830afb950802dd981df27707bd9c9d2adef5 | |
parent | 725945d5680a38cd284de1a4e6780ced489590c4 (diff) | |
download | bcm5719-llvm-1346f7e09825d6943c797d0071777220b24e8d3a.tar.gz bcm5719-llvm-1346f7e09825d6943c797d0071777220b24e8d3a.zip |
Cleaned up step logging a bit.
llvm-svn: 113023
-rw-r--r-- | lldb/source/Commands/CommandObjectThread.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Target/Thread.cpp | 19 | ||||
-rw-r--r-- | lldb/source/Target/ThreadList.cpp | 32 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlan.cpp | 7 | ||||
-rw-r--r-- | lldb/source/lldb.cpp | 11 |
6 files changed, 43 insertions, 30 deletions
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index f4cc35d1f48..5bc99891e31 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -404,7 +404,7 @@ public: 3, 3)) { - result.AppendErrorWithFormat ("error displaying backtrace for thread: \"%d\"\n", i); + result.AppendErrorWithFormat ("error displaying backtrace for thread: \"0x%4.4x\"\n", i); result.SetStatus (eReturnStatusFailed); return false; } diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp index 80ee9ef7ef6..756a644afeb 100644 --- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp +++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp @@ -1436,7 +1436,7 @@ ProcessMacOSX::ReplyToAllExceptions() if (thread_sp.get()) resume_signal = thread_sp->GetResumeSignal(); if (log) - log->Printf ("Replying to exception %d for thread 0x%4.4x (resume_signal = %i).", std::distance(begin, pos), thread_sp->GetID(), resume_signal); + log->Printf ("Replying to exception %d, tid = 0x%4.4x, resume_signal = %i", std::distance(begin, pos), thread_sp->GetID(), resume_signal); Error curr_error (pos->Reply (Task().GetTaskPort(), GetID(), resume_signal)); // Only report the first error diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index ce9216a7466..050c103b2ca 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -360,7 +360,7 @@ Thread::PushPlan (ThreadPlanSP &thread_plan_sp) { StreamString s; thread_plan_sp->GetDescription (&s, lldb::eDescriptionLevelFull); - log->Printf("Pushing plan: \"%s\" for thread: %d immediate: %s.", + log->Printf("Pushing plan: \"%s\", tid = 0x%4.4x, immediate = %s.", s.GetData(), thread_plan_sp->GetThread().GetID(), thread_plan_sp->IsImmediate() ? "true" : "false"); @@ -378,7 +378,7 @@ Thread::PopPlan () ThreadPlanSP &plan = m_immediate_plan_stack.back(); if (log) { - log->Printf("Popping plan: \"%s\" for thread: %d immediate: true.", plan->GetName(), plan->GetThread().GetID()); + log->Printf("Popping plan: \"%s\", tid = 0x%4.4x, immediate = true.", plan->GetName(), plan->GetThread().GetID()); } plan->WillPop(); m_immediate_plan_stack.pop_back(); @@ -390,7 +390,7 @@ Thread::PopPlan () ThreadPlanSP &plan = m_plan_stack.back(); if (log) { - log->Printf("Popping plan: \"%s\" for thread: 0x%x immediate: false.", plan->GetName(), plan->GetThread().GetID()); + log->Printf("Popping plan: \"%s\", tid = 0x%4.4x, immediate = false.", plan->GetName(), plan->GetThread().GetID()); } m_completed_plan_stack.push_back (plan); plan->WillPop(); @@ -535,7 +535,7 @@ Thread::DiscardThreadPlans(bool force) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); if (log) { - log->Printf("Discarding thread plans for thread: 0x%x: force %d.", GetID(), force); + log->Printf("Discarding thread plans for thread (tid = 0x%4.4x, force %d)", GetID(), force); } if (force) @@ -726,8 +726,9 @@ void Thread::DumpThreadPlans (lldb_private::Stream *s) const { uint32_t stack_size = m_plan_stack.size(); - s->Printf ("Plan Stack for thread #%u: tid = 0x%4.4x - %d elements.\n", GetIndexID(), GetID(), stack_size); - for (int i = stack_size - 1; i > 0; i--) + int i; + s->Printf ("Plan Stack for thread #%u: tid = 0x%4.4x, stack_size = %d\n", GetIndexID(), GetID(), stack_size); + for (i = stack_size - 1; i >= 0; i--) { s->Printf ("Element %d: ", i); s->IndentMore(); @@ -738,7 +739,7 @@ Thread::DumpThreadPlans (lldb_private::Stream *s) const stack_size = m_immediate_plan_stack.size(); s->Printf ("Immediate Plan Stack: %d elements.\n", stack_size); - for (int i = stack_size - 1; i > 0; i--) + for (i = stack_size - 1; i >= 0; i--) { s->Printf ("Element %d: ", i); s->IndentMore(); @@ -749,7 +750,7 @@ Thread::DumpThreadPlans (lldb_private::Stream *s) const stack_size = m_completed_plan_stack.size(); s->Printf ("Completed Plan Stack: %d elements.\n", stack_size); - for (int i = stack_size - 1; i > 0; i--) + for (i = stack_size - 1; i >= 0; i--) { s->Printf ("Element %d: ", i); s->IndentMore(); @@ -760,7 +761,7 @@ Thread::DumpThreadPlans (lldb_private::Stream *s) const stack_size = m_discarded_plan_stack.size(); s->Printf ("Discarded Plan Stack: %d elements.\n", stack_size); - for (int i = stack_size - 1; i > 0; i--) + for (int i = stack_size - 1; i >= 0; i--) { s->Printf ("Element %d: ", i); s->IndentMore(); diff --git a/lldb/source/Target/ThreadList.cpp b/lldb/source/Target/ThreadList.cpp index 1c1cf3e393a..012774faa01 100644 --- a/lldb/source/Target/ThreadList.cpp +++ b/lldb/source/Target/ThreadList.cpp @@ -187,7 +187,7 @@ ThreadList::ShouldStop (Event *event_ptr) collection::iterator pos, end = m_threads.end(); if (log) - log->Printf ("%s %zu threads\n", __FUNCTION__, m_threads.size()); + log->Printf ("%s %zu threads", __FUNCTION__, m_threads.size()); // Run through the threads and ask whether we should stop. Don't ask // suspended threads, however, it makes more sense for them to preserve their @@ -196,33 +196,39 @@ ThreadList::ShouldStop (Event *event_ptr) { ThreadSP thread_sp(*pos); - if (log) - log->Printf ("%s thread 0x%4.4x: pc = 0x%16.16llx ", __FUNCTION__, thread_sp->GetID (), thread_sp->GetRegisterContext()->GetPC()); - if (thread_sp->GetResumeState () == eStateSuspended) { if (log) - log->Printf("ignore: thread was suspended\n", thread_sp->GetID (), thread_sp->GetRegisterContext()->GetPC()); + log->Printf ("%s tid = 0x%4.4x, pc = 0x%16.16llx, should_stop = 0 (ignore since thread was suspended)", + __FUNCTION__, + thread_sp->GetID (), + thread_sp->GetRegisterContext()->GetPC()); continue; } if (thread_sp->ThreadStoppedForAReason() == false) { if (log) - log->Printf("ignore: no stop reason\n", thread_sp->GetID (), thread_sp->GetRegisterContext()->GetPC()); + log->Printf ("%s tid = 0x%4.4x, pc = 0x%16.16llx, should_stop = 0 (ignore since no stop reason)", + __FUNCTION__, + thread_sp->GetID (), + thread_sp->GetRegisterContext()->GetPC()); continue; - } const bool thread_should_stop = thread_sp->ShouldStop(event_ptr); if (log) - log->Printf("should_stop = %i\n", thread_sp->GetID (), thread_sp->GetRegisterContext()->GetPC(), thread_should_stop); + log->Printf ("%s tid = 0x%4.4x, pc = 0x%16.16llx, should_stop = %i", + __FUNCTION__, + thread_sp->GetID (), + thread_sp->GetRegisterContext()->GetPC(), + thread_should_stop); if (thread_should_stop) should_stop |= true; } if (log) - log->Printf ("%s overall should_stop = %i\n", __FUNCTION__, should_stop); + log->Printf ("%s overall should_stop = %i", __FUNCTION__, should_stop); if (should_stop) { @@ -248,7 +254,7 @@ ThreadList::ShouldReportStop (Event *event_ptr) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); if (log) - log->Printf ("%s %zu threads\n", __FUNCTION__, m_threads.size()); + log->Printf ("%s %zu threads", __FUNCTION__, m_threads.size()); // Run through the threads and ask whether we should report this event. // For stopping, a YES vote wins over everything. A NO vote wins over NO opinion. @@ -259,7 +265,7 @@ ThreadList::ShouldReportStop (Event *event_ptr) { const lldb::Vote vote = thread_sp->ShouldReportStop (event_ptr); if (log) - log->Printf ("%s thread 0x%4.4x: pc = 0x%16.16llx vote: %s\n", + log->Printf ("%s thread 0x%4.4x: pc = 0x%16.16llx, vote = %s", __FUNCTION__, thread_sp->GetID (), thread_sp->GetRegisterContext()->GetPC(), @@ -281,7 +287,7 @@ ThreadList::ShouldReportStop (Event *event_ptr) else { if (log) - log->Printf ("%s thread 0x%4.4x: pc = 0x%16.16llx voted %s, but lost out because result was %s\n", + log->Printf ("%s thread 0x%4.4x: pc = 0x%16.16llx voted %s, but lost out because result was %s", __FUNCTION__, thread_sp->GetID (), thread_sp->GetRegisterContext()->GetPC(), @@ -293,7 +299,7 @@ ThreadList::ShouldReportStop (Event *event_ptr) } } if (log) - log->Printf ("%s returning %s\n", __FUNCTION__, GetVoteAsCString (result)); + log->Printf ("%s returning %s", __FUNCTION__, GetVoteAsCString (result)); return result; } diff --git a/lldb/source/Target/ThreadPlan.cpp b/lldb/source/Target/ThreadPlan.cpp index 9675292def5..dc701b9e83b 100644 --- a/lldb/source/Target/ThreadPlan.cpp +++ b/lldb/source/Target/ThreadPlan.cpp @@ -98,12 +98,12 @@ ThreadPlan::ShouldReportStop (Event *event_ptr) { Vote prev_vote = prev_plan->ShouldReportStop (event_ptr); if (log) - log->Printf ("ThreadPlan::ShouldReportStop() returning previous thread plan vote %s\n", GetVoteAsCString (prev_vote)); + log->Printf ("ThreadPlan::ShouldReportStop() returning previous thread plan vote: %s", GetVoteAsCString (prev_vote)); return prev_vote; } } if (log) - log->Printf ("ThreadPlan::ShouldReportStop() returning vote %s\n", GetVoteAsCString (m_stop_vote)); + log->Printf ("ThreadPlan::ShouldReportStop() returning vote: %s", GetVoteAsCString (m_stop_vote)); return m_stop_vote; } @@ -143,7 +143,8 @@ 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("Thread #%u: tid = 0x%4.4x (pc = 0x%8.8llx, sp = 0x%8.8llx, fp = 0x%8.8llx) about to resume the \"%s\" plan - state: %s - stop others: %d.", + log->Printf("%s Thread #%u: tid = 0x%4.4x, pc = 0x%8.8llx, sp = 0x%8.8llx, fp = 0x%8.8llx, plan = '%s', state = %s, stop others = %d", + __FUNCTION__, m_thread.GetIndexID(), m_thread.GetID(), (uint64_t)pc, diff --git a/lldb/source/lldb.cpp b/lldb/source/lldb.cpp index b6d56794eff..dc64ded9753 100644 --- a/lldb/source/lldb.cpp +++ b/lldb/source/lldb.cpp @@ -134,9 +134,14 @@ lldb_private::GetDefaultArchitecture () const char * lldb_private::GetVoteAsCString (lldb::Vote vote) { - static const char * g_vote_cstrings[] = { "no", "no opinion", "yes" }; - if (vote >= eVoteNo && vote <= eVoteYes) - return g_vote_cstrings[vote-1]; + switch (vote) + { + case eVoteNo: return "no"; + case eVoteNoOpinion: return "no opinion"; + case eVoteYes: return "yes"; + default: + break; + } return "invalid"; } |