From e5f1c8988cfdb37ab24ad311eb8497a0324a1537 Mon Sep 17 00:00:00 2001 From: uweigand Date: Sun, 27 Sep 2009 20:45:20 +0000 Subject: [PATCH] * spu-low.c (spu_kill): Wait for inferior to terminate. Call clear_inferiors. (spu_detach): Call clear_inferiors. --- gdb/gdbserver/ChangeLog | 6 ++++++ gdb/gdbserver/spu-low.c | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 19162a7ac6..a85f26b659 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,9 @@ +2009-09-27 Ulrich Weigand + + * spu-low.c (spu_kill): Wait for inferior to terminate. + Call clear_inferiors. + (spu_detach): Call clear_inferiors. + 2009-08-22 Ralf Wildenhues * aclocal.m4: Regenerate. diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c index 89d80c2591..ed3bdca13d 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; } -- 2.11.0