summaryrefslogtreecommitdiff
path: root/gdb/inf-ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/inf-ptrace.c')
-rw-r--r--gdb/inf-ptrace.c6
1 files changed, 5 insertions, 1 deletions
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);