This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [gdb/testsuite] Fix hang in fork-running-state.c
- From: Pedro Alves <palves at redhat dot com>
- To: Tom de Vries <tdevries at suse dot de>, gdb-patches at sourceware dot org
- Date: Wed, 13 Jun 2018 13:10:41 +0100
- Subject: Re: [gdb/testsuite] Fix hang in fork-running-state.c
- References: <20180612155134.7fninj4us5lq4hfc@localhost.localdomain>
On 06/12/2018 04:51 PM, Tom de Vries wrote:
> ...
> So, AFAIU, the hanging process is the child process that gdb detaches from.
>
> There's an alarm set in main before the fork, but alarms are not preserved in
> the fork child:
> ...
> $ man alarm
> ...
> NOTES
> Alarms created by alarm() are preserved across execve(2) and are not inherited by children created via fork(2).
Whoops.
> ...
> So, AFAIU, once the parent is killed, there's no alarm to terminate the child.
Indeed.
Your patch is definitely a good idea. Please push.
However, I think that still leaves an unnecessary delay until
the detached child/parent terminate. They used to exit themselves,
but that caused a race, so they no longer do, see here:
https://sourceware.org/ml/gdb-patches/2018-03/msg00588.html
Sounds like the best would be to restore the self-killing,
but make it controlled by a variable that gdb sets, depending
on whether gdb is staying attached to the child/parent.
Thanks,
Pedro Alves