This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [PATCH] driver: ignore SIGINT while waiting on subprocesses to finish


On Sat, 15 Nov 2014, Patrick Palka wrote:

Currently the top-level driver handles SIGINT by immediately killing
itself even when the driver has subprocesses (e.g. cc1, as) running.  I
don't think this is a good idea because

 1. if the top-level driver is waiting on a hanging subprocess,
 pressing ^C will kill the driver but it may not necessarily kill the
 subprocess; an unresponsive, perhaps busy-looping subprocess may be
 running in the background yet the compiler will seem to have to
 terminated successfully.

 2. when debugging gcc with "gcc -wrapper gdb,--args" we are unable to
 use ^C from within the GDB subprocess because pressing ^C immediately
 kills the driver and we lose our terminal.  This makes debugging more
 inconvenient.

This patch fixes these two issues by having the driver ignore SIGINT
while a subprocess is running.  The driver instead will have to wait for
the subprocess to exit before it terminates, like usual.

I tested this change by running "gcc -wrapper gdb", "gcc -wrapper
valgrind" and plain old "gcc" in various ways (-pipe, -flto, -c, etc)
and pressing ^C during compilation.  I noticed no differences in
behavior or promptness other than finally being able to use ^C inside
GDB.

Does this change look OK for trunk after a successful bootstrap +
regtest on x86_64-unknown-linux-gnu?

I forgot a ChangeLog entry:

	* gcc.c (ignore_sigint_p): New static variable.
	(execute): Use it.
	(fatal_signal): Ignore SIGINT if ignore_sigint_p is true.


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