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]

Re: [non-stop] 08/10 linux native support


> From: Michael Snyder <msnyder@specifix.com>
> Date: Tue, 08 Jul 2008 20:25:36 -0700
> 
> On Mon, 2008-07-07 at 14:20 -0400, Daniel Jacobowitz wrote:
> > On Wed, Jul 02, 2008 at 04:34:50AM +0100, Pedro Alves wrote:
> > > @@ -337,7 +337,9 @@ linux_fork_killall (void)
> > >      {
> > >        pid = PIDGET (fp->ptid);
> > >        do {
> > > -	ptrace (PT_KILL, pid, 0, 0);
> > > +	/* Use SIGKILL instead of PTRACE_KILL because the former works even
> > > +	   if the thread is running, while the later doesn't.  */
> > > +	kill (pid, SIGKILL);
> > >  	ret = waitpid (pid, &status, 0);
> > >  	/* We might get a SIGCHLD instead of an exit status.  This is
> > >  	 aggravated by the first kill above - a child has just
> > 
> > This is OK but if anyone wants to make fork support handle
> > multi-threaded programs someday we may need to expose kill_lwp.
> 
> Fork is undefined in a multi-threaded program.

No it's not.  It's supposed to fork only the running thread, that is,
you get a copy of the vm space withe a single thread in it whose
initial state is a copy of the state of the thread executing fork.

Some OS'es offer an alternative fork that forks all running threads
but it is non-standard.


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