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: [gdb/testsuite] Fix hang in fork-running-state.c


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


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