linux-nat: Eliminate custom target_terminal_{inferior,ours}, stop using set_sigint_trap
authorPedro Alves <palves@redhat.com>
Tue, 30 Jan 2018 14:23:51 +0000 (14:23 +0000)
committerPedro Alves <palves@redhat.com>
Tue, 30 Jan 2018 14:23:51 +0000 (14:23 +0000)
commit9c3a5d9319648db16b30a91253ad02d41d242cef
treec2d7020fdcdc0e3951989f6606298f320b10db05
parent040b4a9eb8430dc5e0fc657da88b08ab730b97ee
linux-nat: Eliminate custom target_terminal_{inferior,ours}, stop using set_sigint_trap

This patch gets rid of linux-nat.c's custom
target_terminal_inferior/target_terminal_ours implementations.

The only remaining reason those overrides exist is to install
clear_sigint_trap in order to pass Ctrl-C/SIGINT to the inferior
process in case the inferior is not sharing GDB's terminal (and
target_wait was called without TARGET_WNOHANG).

However, I think that's better handled by QUIT / target_pass_ctrlc
nowadays.  Going that route avoids the issue with set_sigint_trap only
looking at the current inferior to know whether to override SIGINT or
not, which doesn't really work correctly with multi-inferior in the
picture.  Also centralizing on a single SIGINT handler as much as
possible seems better considering a future multi-target world.

Tested on x86-64 GNU/Linux.

gdb/ChangeLog:
2018-01-30  Pedro Alves  <palves@redhat.com>

* linux-nat.c (wait_for_signal): New function.
(wait_lwp, linux_nat_wait_1): Use it instead of calling sigsuspend
directly.
(async_terminal_is_ours)
(linux_nat_terminal_inferior, linux_nat_terminal_ours): Delete.
(linux_nat_add_target): Don't override
to_terminal_inferior/to_terminal_ours.
gdb/ChangeLog
gdb/linux-nat.c