[Lldb-commits] [lldb] r154709 - /lldb/trunk/source/Target/ThreadPlanCallFunction.cpp

Jim Ingham jingham at apple.com
Fri Apr 13 16:11:52 PDT 2012


Author: jingham
Date: Fri Apr 13 18:11:52 2012
New Revision: 154709

URL: http://llvm.org/viewvc/llvm-project?rev=154709&view=rev
Log:
Don't do the work in DoTakedown if the thread plan isn't valid.
Also fixed up some logging.

Modified:
    lldb/trunk/source/Target/ThreadPlanCallFunction.cpp

Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=154709&r1=154708&r2=154709&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Fri Apr 13 18:11:52 2012
@@ -57,7 +57,7 @@
     
     TargetSP target_sp (thread.CalculateTarget());
 
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
     
     SetBreakpoints();
     
@@ -69,7 +69,7 @@
     if (!error.Success())
     {
         if (log)
-            log->Printf ("Trying to put the stack in unreadable memory at: 0x%llx.", m_function_sp);
+            log->Printf ("ThreadPlanCallFunction(%p): Trying to put the stack in unreadable memory at: 0x%llx.", this, m_function_sp);
         return false;
     }
     
@@ -78,7 +78,7 @@
     if (exe_module == NULL)
     {
         if (log)
-            log->Printf ("Can't execute code without an executable module.");
+            log->Printf ("ThreadPlanCallFunction(%p): Can't execute code without an executable module.", this);
         return false;
     }
     else
@@ -87,16 +87,16 @@
         if (!objectFile)
         {
             if (log)
-                log->Printf ("Could not find object file for module \"%s\".", 
-                             exe_module->GetFileSpec().GetFilename().AsCString());
+                log->Printf ("ThreadPlanCallFunction(%p): Could not find object file for module \"%s\".", 
+                             this, exe_module->GetFileSpec().GetFilename().AsCString());
             return false;
         }
         m_start_addr = objectFile->GetEntryPointAddress();
         if (!m_start_addr.IsValid())
         {
             if (log)
-                log->Printf ("Could not find entry point address for executable module \"%s\".", 
-                             exe_module->GetFileSpec().GetFilename().AsCString());
+                log->Printf ("ThreadPlanCallFunction(%p): Could not find entry point address for executable module \"%s\".", 
+                             this, exe_module->GetFileSpec().GetFilename().AsCString());
             return false;
         }
     }
@@ -110,7 +110,7 @@
     if (!thread.CheckpointThreadState (m_stored_thread_state))
     {
         if (log)
-            log->Printf ("Setting up ThreadPlanCallFunction, failed to checkpoint thread state.");
+            log->Printf ("ThreadPlanCallFunction(%p): Setting up ThreadPlanCallFunction, failed to checkpoint thread state.", this);
         return false;
     }
     // Now set the thread state to "no reason" so we don't run with whatever signal was outstanding...
@@ -262,7 +262,16 @@
 void
 ThreadPlanCallFunction::DoTakedown ()
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
+    
+    if (!m_valid)
+    {
+        //Don't call DoTakedown if we were never valid to begin with.
+        if (log)
+            log->Printf ("ThreadPlanCallFunction(%p): Log called on ThreadPlanCallFunction that was never valid.", this);
+        return;
+    }
+    
     if (!m_takedown_done)
     {
         ProcessSP process_sp (m_thread.GetProcess());
@@ -274,7 +283,7 @@
         }
 
         if (log)
-            log->Printf ("DoTakedown called for thread 0x%4.4llx, m_valid: %d complete: %d.\n", m_thread.GetID(), m_valid, IsPlanComplete());
+            log->Printf ("ThreadPlanCallFunction(%p): DoTakedown called for thread 0x%4.4llx, m_valid: %d complete: %d.\n", this, m_thread.GetID(), m_valid, IsPlanComplete());
         m_takedown_done = true;
         m_stop_address = m_thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC();
         m_real_stop_info_sp = GetPrivateStopReason();
@@ -288,7 +297,7 @@
     else
     {
         if (log)
-            log->Printf ("DoTakedown called as no-op for thread 0x%4.4llx, m_valid: %d complete: %d.\n", m_thread.GetID(), m_valid, IsPlanComplete());
+            log->Printf ("ThreadPlanCallFunction(%p): DoTakedown called as no-op for thread 0x%4.4llx, m_valid: %d complete: %d.\n", this, m_thread.GetID(), m_valid, IsPlanComplete());
     }
 }
 
@@ -447,7 +456,7 @@
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
         if (log)
-            log->Printf("Completed call function plan.");
+            log->Printf("ThreadPlanCallFunction(%p): Completed call function plan.", this);
 
         ThreadPlan::MischiefManaged ();
         return true;





More information about the lldb-commits mailing list