From a5234a73c0f8fdab0293f1ce3aab87303d990b44 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Sat, 2 Sep 2006 09:42:26 +0000 Subject: (inf_ptrace_attach): Destroy any existing thread. (inf_ptrace_mourn_inferior): Only wait if synchronous. --- gdb/inf-ptrace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- cgit v1.2.1