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 ();
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);