[Lldb-commits] [lldb] r179738 - Fixed a few m_private_run_lock issues when attaching and also fixed the process to not try to restart the process if the process is exited, crashed or detached. Partial patch from Carlo Kok.

Op 18-4-2013 02:42, Greg Clayton schreef:

Author: gclayton
Date: Wed Apr 17 19:42:25 2013
New Revision: 179738

just realized i sent this to the wrong list. afaik this is still relevant after Thirumurthi, Ashok changes.

URL: http://llvm.org/viewvc/llvm-project?rev=179738&view=rev
Log:
Fixed a few m_private_run_lock issues when attaching and also fixed the process to not try to restart the process if the process is exited, crashed or detached. Partial patch from Carlo Kok.

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=179738&r1=179737&r2=179738&view=diff

--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Wed Apr 17 19:42:25 2013
@@ -2955,6 +2955,7 @@ Process::Attach (ProcessAttachInfo &atta

Process::Attach doesn't get called for GDB remote, so this doesn't get
called for that.

adding this in Process::ConnectRemote makes it work:
...
             if (state == eStateStopped || state == eStateCrashed)
             {
+ if (m_public_run_lock.WriteTryLock())
+ {
+ m_private_run_lock.WriteLock();
                     // If we attached and actually have a process on
the other end, then
                     // this ended up being the equivalent of an attach.
                     CompleteAttach ();

                     // This delays passing the stopped event to
listeners till
                     // CompleteAttach gets a chance to complete...
                     HandlePrivateEvent (event_sp);
                 }
+ }
         }

         if (PrivateStateThreadIsValid ())
             ResumePrivateStateThread ();
         else
             StartPrivateStateThread ();
     }
     return error;
}