[Lldb-commits] [lldb] r157327 - /lldb/trunk/source/Target/Process.cpp

Jim Ingham jingham at apple.com
Wed May 23 08:46:31 PDT 2012


Author: jingham
Date: Wed May 23 10:46:31 2012
New Revision: 157327

URL: http://llvm.org/viewvc/llvm-project?rev=157327&view=rev
Log:
Process::Destroy should Halt before it tries to destroy so we don't have race conditions where we are in the middle of trying to service an event when we go to Destroy.
The AttachCompletionHandler should note that it has restarted the target if it indeed does so.

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

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=157327&r1=157326&r2=157327&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Wed May 23 10:46:31 2012
@@ -2553,6 +2553,7 @@
                 {
                     --m_exec_count;
                     m_process->PrivateResume ();
+                    Process::ProcessEventData::SetRestartedInEvent (event_sp.get(), true);
                     return eEventActionRetry;
                 }
                 else
@@ -3026,6 +3027,31 @@
     if (error.Success())
     {
         DisableAllBreakpointSites();
+        if (m_public_state.GetValue() == eStateRunning)
+        {
+            error = Halt();
+            if (error.Success())
+            {
+                // Consume the halt event.
+                EventSP stop_event;
+                TimeValue timeout (TimeValue::Now());
+                timeout.OffsetWithMicroSeconds(1000);
+                StateType state = WaitForProcessToStop (&timeout);
+                if (state != eStateStopped)
+                {
+                    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+                    if (log)
+                        log->Printf("Process::Destroy() Halt failed to stop, state is: %s", StateAsCString(state));
+                }
+            }
+            else
+            {
+                    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+                    if (log)
+                        log->Printf("Process::Destroy() Halt got error: %s", error.AsCString());
+            }
+        }
+        
         error = DoDestroy();
         if (error.Success())
         {





More information about the lldb-commits mailing list