* [commit, gdbserver] Fix SPU gdbserver regression
@ 2009-09-27 20:57 Ulrich Weigand
2009-09-28 18:07 ` Joel Brobecker
0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Weigand @ 2009-09-27 20:57 UTC (permalink / raw)
To: gdb-patches
Hello,
several gdbserver test cases were failing on spu-elf. This turned out
to be caused by the multi-process gdbserver changes. In particular,
gdbserver now always keeps a list a threads, even for a single-threaded
inferior. spu-low.c fails to clear this thread list in the spu_kill
and spu_detach routines, causing GDB to report that the inferior was
still running even when killed.
While debugging this, I noticed that gdbserver leaves the inferior
as zombie after spu_kill, because it never waits on it. The patch
below fixes this issue as well.
Tested on spu-elf, fixes all gdbserver test case failures.
Committed to mainline.
Bye,
Ulrich
ChangeLog:
* spu-low.c (spu_kill): Wait for inferior to terminate.
Call clear_inferiors.
(spu_detach): Call clear_inferiors.
Index: gdb/gdbserver/spu-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/spu-low.c,v
retrieving revision 1.25
diff -c -p -r1.25 spu-low.c
*** gdb/gdbserver/spu-low.c 22 Jun 2009 19:33:41 -0000 1.25
--- gdb/gdbserver/spu-low.c 25 Sep 2009 14:43:07 -0000
*************** spu_attach (unsigned long pid)
*** 321,331 ****
--- 321,340 ----
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;
}
*************** spu_detach (int pid)
*** 339,344 ****
--- 348,355 ----
return -1;
ptrace (PTRACE_DETACH, pid, 0, 0);
+
+ clear_inferiors ();
remove_process (process);
return 0;
}
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [commit, gdbserver] Fix SPU gdbserver regression
2009-09-27 20:57 [commit, gdbserver] Fix SPU gdbserver regression Ulrich Weigand
@ 2009-09-28 18:07 ` Joel Brobecker
2009-09-28 19:15 ` Pedro Alves
0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2009-09-28 18:07 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
> ChangeLog:
>
> * spu-low.c (spu_kill): Wait for inferior to terminate.
> Call clear_inferiors.
> (spu_detach): Call clear_inferiors.
This one seems like a good candidate for the branch.
--
Joel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [commit, gdbserver] Fix SPU gdbserver regression
2009-09-28 18:07 ` Joel Brobecker
@ 2009-09-28 19:15 ` Pedro Alves
2009-09-29 0:43 ` Ulrich Weigand
0 siblings, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2009-09-28 19:15 UTC (permalink / raw)
To: gdb-patches; +Cc: Joel Brobecker, Ulrich Weigand
On Monday 28 September 2009 17:14:26, Joel Brobecker wrote:
> This one seems like a good candidate for the branch.
FWIW, I agree.
--
Pedro Alves
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [commit, gdbserver] Fix SPU gdbserver regression
2009-09-28 19:15 ` Pedro Alves
@ 2009-09-29 0:43 ` Ulrich Weigand
0 siblings, 0 replies; 4+ messages in thread
From: Ulrich Weigand @ 2009-09-29 0:43 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches, Joel Brobecker
Pedro Alves wrote:
> On Monday 28 September 2009 17:14:26, Joel Brobecker wrote:
> > This one seems like a good candidate for the branch.
>
> FWIW, I agree.
OK, I've checked this in to the branch now.
Thanks,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-09-29 0:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-27 20:57 [commit, gdbserver] Fix SPU gdbserver regression Ulrich Weigand
2009-09-28 18:07 ` Joel Brobecker
2009-09-28 19:15 ` Pedro Alves
2009-09-29 0:43 ` Ulrich Weigand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox