* spu-low.c (spu_kill): Wait for inferior to terminate.

Call clear_inferiors.
	(spu_detach): Call clear_inferiors.
This commit is contained in:
Ulrich Weigand 2009-09-27 20:45:20 +00:00
parent 0057022f7e
commit 4168d2d616
2 changed files with 17 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2009-09-27 Ulrich Weigand <uweigand@de.ibm.com>
* spu-low.c (spu_kill): Wait for inferior to terminate.
Call clear_inferiors.
(spu_detach): Call clear_inferiors.
2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* aclocal.m4: Regenerate.

View File

@ -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;
}