aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/spu-low.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-09-27 20:45:20 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-09-27 20:45:20 +0000
commit4168d2d6169a4a7160c9abd01253ba2620c717c2 (patch)
treed7b1b1fcf50bcb10830c1c13c6dfbe9087cff127 /gdb/gdbserver/spu-low.c
parent0057022f7eac67cead06ab83249155fadd700c5f (diff)
downloadgdb-4168d2d6169a4a7160c9abd01253ba2620c717c2.zip
gdb-4168d2d6169a4a7160c9abd01253ba2620c717c2.tar.gz
gdb-4168d2d6169a4a7160c9abd01253ba2620c717c2.tar.bz2
* spu-low.c (spu_kill): Wait for inferior to terminate.
Call clear_inferiors. (spu_detach): Call clear_inferiors.
Diffstat (limited to 'gdb/gdbserver/spu-low.c')
-rw-r--r--gdb/gdbserver/spu-low.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c
index 89d80c2..ed3bdca 100644
--- a/gdb/gdbserver/spu-low.c
+++ b/gdb/gdbserver/spu-low.c
@@ -321,11 +321,20 @@ spu_attach (unsigned long pid)
static int
spu_kill (int pid)
{
+ int status, ret;
struct process_info *process = find_process_pid (pid);
if (process == NULL)
return -1;
ptrace (PTRACE_KILL, pid, 0, 0);
+
+ do {
+ ret = waitpid (pid, &status, 0);
+ if (WIFEXITED (status) || WIFSIGNALED (status))
+ break;
+ } while (ret != -1 || errno != ECHILD);
+
+ clear_inferiors ();
remove_process (process);
return 0;
}
@@ -339,6 +348,8 @@ spu_detach (int pid)
return -1;
ptrace (PTRACE_DETACH, pid, 0, 0);
+
+ clear_inferiors ();
remove_process (process);
return 0;
}