Put GDB's terminal settings into effect when paginating
When the target is resumed in the foreground, we put the inferior's
terminal settings into effect, and remove stdin from the event loop.
When the target stops, we put GDB's terminal settings into effect
again, and re-register stdin in the event loop, ready for user input.
The former is done by target_terminal_inferior, and the latter by
target_terminal_ours.
There's an intermediate -- target_terminal_ours_for_output -- that is
called when printing output related to target events, and we don't
know yet whether we'll stop the program. That puts our terminal
settings into effect, enough to get proper results from our output,
but leaves input wired into the inferior.
If such output paginates, then we need the full target_terminal_ours
in order for the user to be able to provide input to answer the
pagination query.
The test in this commit hangs in async-capable targets without the fix
(as the user/test can't answer the pagination query). It doesn't hang
on sync targets because on those we don't unregister stdin from the
event loop while the target is running (because we block in
target_wait instead of in the event loop in that case).
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* utils.c (prompt_for_continue): Call target_terminal_ours.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
* gdb.base/paginate-after-ctrl-c-running.c: New file.
* gdb.base/paginate-after-ctrl-c-running.exp: New file.