summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Roberts <nickrob@snap.net.nz>2006-09-02 09:42:26 +0000
committerNick Roberts <nickrob@snap.net.nz>2006-09-02 09:42:26 +0000
commita5234a73c0f8fdab0293f1ce3aab87303d990b44 (patch)
tree609f4b1e81db4cf6dcb429ea186d7852a16e6a85
parent50155eeb92ca5d3fcc1d25372ce7521572b31df8 (diff)
downloadgdb-a5234a73c0f8fdab0293f1ce3aab87303d990b44.tar.gz
(inf_ptrace_attach): Destroy any existing thread.
(inf_ptrace_mourn_inferior): Only wait if synchronous.
-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);