[PATCH] Add gdb remote protocol handling to strace

Eugene Syromiatnikov esyr at redhat.com
Thu Nov 2 13:01:20 UTC 2017

On Thu, Nov 02, 2017 at 06:38:39AM +0300, Dmitry V. Levin wrote:
> On Tue, Oct 17, 2017 at 02:29:31PM -0400, Stan Cox wrote:
> [...]
> > +	/* Make sure SIGCHLD has the default action so that waitpid
> > +	   definitely works without losing track of children.  The user
> > +	   should not have given us a bogus state to inherit, but he might
> > +	   have.  Arguably we should detect SIG_IGN here and pass it on
> > +	   to children, but probably noone really needs that.  */
> > +	signal(SIGCHLD, SIG_DFL);
> Why do you ever need this change?

This change is needed for handling the child gdbserver process; I assume
that ought to be handled in a way similar to the way -o| child process
is handled now. And that leads to the fact that it ought to be refactored
into something that can handle both, as there are some parts of the code
that do the same things twice; moreover, personally I'd prefer Josh's
way of spawning child process that employs posix_spawn rather than
that current implementation which incorrectly uses vfork.

> It essentially reverts the key part of commit v4.17-8-ge97a66f:
> Do not reset SIGCHLD handler in tracees to SIG_DFL
> While strace resets SIGCHLD handler to the default action so that
> waitpid definitely works without losing track of children, tracees
> should not inherit this change.
> * strace.c (struct exec_params): Add child_sa field.
> (init): When setting SIGCHLD handler to SIG_DFL, save the old handler.
> (exec_or_die): Restore SIGCHLD handler if it was different from SIG_DFL
> at startup.
> * NEWS: Mention this change.
> -- 
> ldv

> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot

> _______________________________________________
> Strace-devel mailing list
> Strace-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/strace-devel

More information about the Strace-devel mailing list