gdb/remote-fileio.c: Eliminate custom SIGINT signal handler
authorPedro Alves <palves@redhat.com>
Wed, 1 Jun 2016 15:34:49 +0000 (16:34 +0100)
committerPedro Alves <palves@redhat.com>
Wed, 1 Jun 2016 15:34:49 +0000 (16:34 +0100)
commitbb7c96deb1a14ef7e8b51d5339a65a8064515c78
treeed1a03c853ab2d2ec25cf228ec5bf8f705bcfa37
parent315f180f2f0a59af561180e4ed9387f4c7bada78
gdb/remote-fileio.c: Eliminate custom SIGINT signal handler

... and fix Ctrl-C races.

The current remote-fileio.c SIGINT/EINTR code can lose Ctrl-C --
there's a period where SIG_IGN is installed as signal handler, for
example.

Since:

 - remote.c no longer installs a custom SIGINT handler;

 - The current remote-fileio.c SIGINT handler is basically the same as
   the default SIGINT handler (event-top.c:handle_sigint), in
   principle, except that instead of setting the quit flag, it sets a
   separate flag.

I think we should be able to completely remove the remote-fileio.c
SIGINT handler, and centralize on the quit flag, thus fixing the
Ctrl-C race.

gdb/ChangeLog:
yyyy-mm-dd  Pedro Alves  <palves@redhat.com>

* remote-fileio.c (remote_fio_ctrl_c_flag, remote_fio_sa)
(remote_fio_osa)
(remote_fio_ofunc, remote_fileio_sig_init, remote_fileio_sig_set)
(remote_fileio_sig_exit, remote_fileio_ctrl_c_signal_handler):
Delete.
(remote_fileio_o_quit_handler): New global.
(remote_fileio_quit_handler): New function.
(remote_fileio_reply): Check the quit flag instead of the custom
'remote_fio_ctrl_c_flag' flag.  Restore the quit handler instead
of changing the SIGINT handler.
(do_remote_fileio_request): Override the quit handler instead of
changing the SIGINT handler.
gdb/ChangeLog
gdb/remote-fileio.c