This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Don't immediately SIGTERM the child of "target remote |".
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Doug Evans <dje at google dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 27 Nov 2011 21:40:11 +0100
- Subject: Re: [RFC] Don't immediately SIGTERM the child of "target remote |".
- References: <20111124000052.14DC12461B1@ruffy.mtv.corp.google.com>
On Thu, 24 Nov 2011 01:00:51 +0100, Doug Evans wrote:
[...]
> - int status;
> - kill (state->pid, SIGTERM);
> + int rc, status;
> + void (*ofunc) (); /* Previous SIGALRM handler. */
^int (or void)
> +
> + /* Don't kill the task right away, give it a chance to shut down cleanly.
> + But don't wait forever though. */
> +#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
> + {
> + struct sigaction sa, osa;
> + sa.sa_handler = sigalrm_handler;
> + sigemptyset (&sa.sa_mask);
> + sa.sa_flags = 0;
> + sigaction (SIGALRM, &sa, &osa);
> + ofunc = osa.sa_handler;
> + }
> +#else
> + ofunc = (void (*)()) signal (SIGALRM, sigalrm_handler);
> +#endif
[...]
> + alarm (0);
> + signal (SIGALRM, ofunc);
You should restore OSA, not just OFUNC.
Thanks,
Jan