From: Nick Roberts Date: Sat, 2 Sep 2006 09:42:26 +0000 (+0000) Subject: (inf_ptrace_attach): Destroy any existing thread. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c73a67331d5d3ed424c4ecedfbb7f953a8e4fb18;p=thirdparty%2Fbinutils-gdb.git (inf_ptrace_attach): Destroy any existing thread. (inf_ptrace_mourn_inferior): Only wait if synchronous. --- diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index 4a9768f8e31..b3ece3aa22c 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -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);