aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2014-07-14 19:55:32 +0100
committerPedro Alves <palves@redhat.com>2014-07-14 20:35:31 +0100
commit8258415802426fd3e6956cc8dc7aa093052177a5 (patch)
treee9065f05c260d48ea45a1494d5fe84957e8e8abe /gdb/utils.c
parent1e9735707b34b8141ea3bfd88205ea26e99891fc (diff)
downloadgdb-8258415802426fd3e6956cc8dc7aa093052177a5.zip
gdb-8258415802426fd3e6956cc8dc7aa093052177a5.tar.gz
gdb-8258415802426fd3e6956cc8dc7aa093052177a5.tar.bz2
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.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index 6f47cb0..d324227 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1877,6 +1877,10 @@ prompt_for_continue (void)
immediate_quit++;
QUIT;
+
+ /* We'll need to handle input. */
+ target_terminal_ours ();
+
/* On a real operating system, the user can quit with SIGINT.
But not on GO32.