Author: gclayton
Date: Mon Oct 19 19:14:20 2015
New Revision: 250768

URL: http://llvm.org/viewvc/llvm-project?rev=250768&view=rev
Log:
Make sure we restore the process events so they aren't hijacked when using the 
async attach when attaching to a process by name and with waitfor.

<rdar://problem/22821480>


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

Modified: lldb/trunk/source/Target/Target.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=250768&r1=250767&r2=250768&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Oct 19 19:14:20 2015
@@ -3162,19 +3162,26 @@ Target::Attach (ProcessAttachInfo &attac
         error = process_sp->Attach (attach_info);
     }
 
-    if (error.Success () && process_sp && async == false)
+    if (error.Success () && process_sp)
     {
-        state = process_sp->WaitForProcessToStop (nullptr, nullptr, false, 
attach_info.GetHijackListener ().get (), stream);
-        process_sp->RestoreProcessEvents ();
-
-        if (state != eStateStopped)
+        if (async)
+        {
+            process_sp->RestoreProcessEvents ();
+        }
+        else
         {
-            const char *exit_desc = process_sp->GetExitDescription ();
-            if (exit_desc)
-                error.SetErrorStringWithFormat ("%s", exit_desc);
-            else
-                error.SetErrorString ("process did not stop (no such process 
or permission problem?)");
-            process_sp->Destroy (false);
+            state = process_sp->WaitForProcessToStop (nullptr, nullptr, false, 
attach_info.GetHijackListener ().get (), stream);
+            process_sp->RestoreProcessEvents ();
+
+            if (state != eStateStopped)
+            {
+                const char *exit_desc = process_sp->GetExitDescription ();
+                if (exit_desc)
+                    error.SetErrorStringWithFormat ("%s", exit_desc);
+                else
+                    error.SetErrorString ("process did not stop (no such 
process or permission problem?)");
+                process_sp->Destroy (false);
+            }
         }
     }
     return error;


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to