[Lldb-commits] [lldb] r113023 - in /lldb/trunk/source: Commands/CommandObjectThread.cpp Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp Target/Thread.cpp Target/ThreadList.cpp Target/ThreadPlan.cpp lldb.cpp

Greg Clayton gclayton at apple.com
Fri Sep 3 15:45:01 PDT 2010


Author: gclayton
Date: Fri Sep  3 17:45:01 2010
New Revision: 113023

URL: http://llvm.org/viewvc/llvm-project?rev=113023&view=rev
Log:
Cleaned up step logging a bit.


Modified:
    lldb/trunk/source/Commands/CommandObjectThread.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/Target/ThreadList.cpp
    lldb/trunk/source/Target/ThreadPlan.cpp
    lldb/trunk/source/lldb.cpp

Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=113023&r1=113022&r2=113023&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Fri Sep  3 17:45:01 2010
@@ -404,7 +404,7 @@
                                                       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;
                 }

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp?rev=113023&r1=113022&r2=113023&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp Fri Sep  3 17:45:01 2010
@@ -1436,7 +1436,7 @@
             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

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=113023&r1=113022&r2=113023&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Fri Sep  3 17:45:01 2010
@@ -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();

Modified: lldb/trunk/source/Target/ThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=113023&r1=113022&r2=113023&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadList.cpp (original)
+++ lldb/trunk/source/Target/ThreadList.cpp Fri Sep  3 17:45:01 2010
@@ -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;
 }
 

Modified: lldb/trunk/source/Target/ThreadPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlan.cpp?rev=113023&r1=113022&r2=113023&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlan.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlan.cpp Fri Sep  3 17:45:01 2010
@@ -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,

Modified: lldb/trunk/source/lldb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=113023&r1=113022&r2=113023&view=diff
==============================================================================
--- lldb/trunk/source/lldb.cpp (original)
+++ lldb/trunk/source/lldb.cpp Fri Sep  3 17:45:01 2010
@@ -134,9 +134,14 @@
 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";
 }
 





More information about the lldb-commits mailing list