From 8258415802426fd3e6956cc8dc7aa093052177a5 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 14 Jul 2014 19:55:32 +0100 Subject: 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 * utils.c (prompt_for_continue): Call target_terminal_ours. gdb/testsuite/ 2014-07-14 Pedro Alves * gdb.base/paginate-after-ctrl-c-running.c: New file. * gdb.base/paginate-after-ctrl-c-running.exp: New file. --- gdb/utils.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gdb/utils.c') 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. -- cgit v1.1