[Lldb-commits] [lldb] r165804 - in /lldb/trunk/source: Plugins/Process/Linux/ProcessMonitor.cpp Target/Process.cpp

Greg Clayton gclayton at apple.com
Fri Oct 12 09:10:13 PDT 2012


Author: gclayton
Date: Fri Oct 12 11:10:12 2012
New Revision: 165804

URL: http://llvm.org/viewvc/llvm-project?rev=165804&view=rev
Log:
Modified patch from Matt Kopec that makes sure the run lock is acquired when attaching and makes sure the pid is being set on linux in the process info.


Modified:
    lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=165804&r1=165803&r2=165804&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp Fri Oct 12 11:10:12 2012
@@ -1193,6 +1193,8 @@
         goto FINISH;
     }
 
+    monitor->m_pid = pid;
+
     // Update the process thread list with the attached thread.
     inferior.reset(new POSIXThread(processSP, pid));
     if (log)

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=165804&r1=165803&r2=165804&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Oct 12 11:10:12 2012
@@ -2750,10 +2750,19 @@
                 error = WillAttachToProcessWithName(process_name, wait_for_launch);
                 if (error.Success())
                 {
-                    m_should_detach = true;
+                    if (m_run_lock.WriteTryLock())
+                    {
+                        m_should_detach = true;
+                        SetPublicState (eStateAttaching);
+                        // Now attach using these arguments.
+                        error = DoAttachToProcessWithName (process_name, wait_for_launch, attach_info);
+                    }
+                    else
+                    {
+                        // This shouldn't happen
+                        error.SetErrorString("failed to acquire process run lock");
+                    }
 
-                    SetPublicState (eStateAttaching);
-                    error = DoAttachToProcessWithName (process_name, wait_for_launch, attach_info);
                     if (error.Fail())
                     {
                         if (GetID() != LLDB_INVALID_PROCESS_ID)
@@ -2817,10 +2826,20 @@
         error = WillAttachToProcessWithID(attach_pid);
         if (error.Success())
         {
-            m_should_detach = true;
-            SetPublicState (eStateAttaching);
 
-            error = DoAttachToProcessWithID (attach_pid, attach_info);
+            if (m_run_lock.WriteTryLock())
+            {
+                // Now attach using these arguments.
+                m_should_detach = true;
+                SetPublicState (eStateAttaching);
+                error = DoAttachToProcessWithID (attach_pid, attach_info);
+            }
+            else
+            {
+                // This shouldn't happen
+                error.SetErrorString("failed to acquire process run lock");
+            }
+
             if (error.Success())
             {
                 





More information about the lldb-commits mailing list