Cleaned up step logging a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113023 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/Thread.cpp b/source/Target/Thread.cpp
index ce9216a..050c103 100644
--- a/source/Target/Thread.cpp
+++ b/source/Target/Thread.cpp
@@ -360,7 +360,7 @@
{
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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/source/Target/ThreadList.cpp b/source/Target/ThreadList.cpp
index 1c1cf3e..012774f 100644
--- a/source/Target/ThreadList.cpp
+++ b/source/Target/ThreadList.cpp
@@ -187,7 +187,7 @@
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 @@
{
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 @@
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 @@
{
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 @@
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 @@
}
}
if (log)
- log->Printf ("%s returning %s\n", __FUNCTION__, GetVoteAsCString (result));
+ log->Printf ("%s returning %s", __FUNCTION__, GetVoteAsCString (result));
return result;
}
diff --git a/source/Target/ThreadPlan.cpp b/source/Target/ThreadPlan.cpp
index 9675292..dc701b9 100644
--- a/source/Target/ThreadPlan.cpp
+++ b/source/Target/ThreadPlan.cpp
@@ -98,12 +98,12 @@
{
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 @@
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,