This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gdbserver] Fix killing of a multi-threaded application


Gdbserver contains a workaround for a Linux kernel quirk.  If you
PTRACE_KILL the first thread of a multi-threaded application, waiting
for it won't report an exit.  You have to kill the other threads
first.  The symptom for this is a successful test run, but a
sleeping gdbserver and a zombie process for each multi-threaded test
that doesn't run to exit.

When gdbserver was overhauled for multi-process support this
accidentally became "don't kill the last thread" instead of
"don't kill the first thread".  The new version is more
self-explanatory than the old one was.

Tested on ARM GNU/Linux, checked in.

-- 
Daniel Jacobowitz
CodeSourcery

2009-07-28  Daniel Jacobowitz  <dan@codesourcery.com>

	* linux-low.c (linux_kill_one_lwp): Adjust kernel workaround to skip
	the main thread again.

---
 gdb/gdbserver/linux-low.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: gdb-mainline/gdb/gdbserver/linux-low.c
===================================================================
--- gdb-mainline.orig/gdb/gdbserver/linux-low.c	2009-07-27 10:07:47.000000000 -0700
+++ gdb-mainline/gdb/gdbserver/linux-low.c	2009-07-27 14:34:20.000000000 -0700
@@ -589,7 +589,7 @@ linux_kill_one_lwp (struct inferior_list
      the children get a chance to be reaped, it will remain a zombie
      forever.  */
 
-  if (last_thread_of_process_p (thread))
+  if (lwpid_of (lwp) == pid)
     {
       if (debug_threads)
 	fprintf (stderr, "lkop: is last of process %s\n",


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]