[Lldb-commits] [lldb] r151741 - /lldb/trunk/source/API/SBTarget.cpp

Han Ming Ong hanming at apple.com
Wed Feb 29 11:16:41 PST 2012


Author: hanming
Date: Wed Feb 29 13:16:40 2012
New Revision: 151741

URL: http://llvm.org/viewvc/llvm-project?rev=151741&view=rev
Log:
<rdar://10949461>

Only set the ProcessSP when the attach is successful.

Modified:
    lldb/trunk/source/API/SBTarget.cpp

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=151741&r1=151740&r2=151741&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Wed Feb 29 13:16:40 2012
@@ -812,8 +812,6 @@
 
         if (process_sp)
         {
-            sb_process.SetSP (process_sp);
-            
             ProcessAttachInfo &attach_info = sb_attach_info.ref();
             lldb::pid_t attach_pid = attach_info.GetProcessID();
             if (attach_pid != LLDB_INVALID_PROCESS_ID)
@@ -825,11 +823,15 @@
                     attach_info.SetUserID(instance_info.GetEffectiveUserID());
                 }
             }
-            error.SetError (process_sp->Attach (attach_info));            
-            // If we are doing synchronous mode, then wait for the
-            // process to stop!
-            if (target_sp->GetDebugger().GetAsyncExecution () == false)
-                process_sp->WaitForProcessToStop (NULL);
+            error.SetError (process_sp->Attach (attach_info));
+            if (error.Success())
+            {
+                sb_process.SetSP (process_sp);
+                // If we are doing synchronous mode, then wait for the
+                // process to stop!
+                if (target_sp->GetDebugger().GetAsyncExecution () == false)
+                    process_sp->WaitForProcessToStop (NULL);
+            }
         }
         else
         {





More information about the lldb-commits mailing list