Fix in 2.0.32 for debugging of multithreaded processes

Philip Gladstone (philip@raptor.com)
Wed, 10 Dec 1997 12:08:24 -0500


This is a multi-part message in MIME format.
--------------25BF3CD95801B6DE4EF77990
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The attached (small) patch to kernel/exit.c allows gdb and strace
to be used on the threads of a multithreaded process. This is
not the end of the the problems, but a big step forward.

I suspect that the same patch could be applied to the 2.1.x
series as well.

Philip

-- 
Philip Gladstone                           +1 781 487 7700
Raptor Systems, Waltham, MA         http://www.raptor.com/
--------------25BF3CD95801B6DE4EF77990
Content-Type: text/plain; charset=us-ascii; name="exit3.pf"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="exit3.pf"

--- linux/kernel/exit.c.orig Wed Nov 19 16:33:22 1997 +++ linux/kernel/exit.c Wed Nov 19 16:36:38 1997 @@ -639,9 +639,14 @@ if (p->pgrp != -pid) continue; } - /* wait for cloned processes iff the __WCLONE flag is set */ - if ((p->exit_signal != SIGCHLD) ^ ((options & __WCLONE) != 0)) - continue; + /* If you are tracing a process, then you don't need to get the + * WCLONE bit right -- useful for strace and gdb + */ + if (!(p->flags & (PF_PTRACED|PF_TRACESYS))) { + /* wait for cloned processes iff the __WCLONE flag is set */ + if ((p->exit_signal != SIGCHLD) ^ ((options & __WCLONE) != 0)) + continue; + } flag = 1; switch (p->state) { case TASK_STOPPED:

--------------25BF3CD95801B6DE4EF77990--