]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
(inf_ptrace_attach): Destroy any existing thread.
authorNick Roberts <nickrob@snap.net.nz>
Sat, 2 Sep 2006 09:42:26 +0000 (09:42 +0000)
committerNick Roberts <nickrob@snap.net.nz>
Sat, 2 Sep 2006 09:42:26 +0000 (09:42 +0000)
(inf_ptrace_mourn_inferior): Only wait if synchronous.

gdb/inf-ptrace.c

index 4a9768f8e31286c4ec295cf7ac78ac95bb1ece5a..b3ece3aa22c2c9fb365922c58151f6411fc3ba28 100644 (file)
@@ -182,7 +182,8 @@ inf_ptrace_mourn_inferior (void)
      Do not check whether this succeeds though, since we may be
      dealing with a process that we attached to.  Such a process will
      only report its exit status to its original parent.  */
-  waitpid (ptid_get_pid (inferior_ptid), &status, 0);
+  if (!target_can_async_p ())
+    waitpid (ptid_get_pid (inferior_ptid), &status, 0);
 
   unpush_target (ptrace_ops_hack);
   generic_mourn_inferior ();
@@ -210,6 +211,9 @@ inf_ptrace_attach (char *args, int from_tty)
   if (pid == getpid ())                /* Trying to masturbate?  */
     error (_("I refuse to debug myself!"));
 
+  if (target_can_async_p ())
+    gdb_inferior_destroy (gdb_status);
+
   if (from_tty)
     {
       exec_file = get_exec_file (0);