This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch 2/3] reset pagination counts even when stdin is not a tty
- From: Sandra Loosemore <sandra at codesourcery dot com>
- To: gdb-patches <gdb-patches at sourceware dot org>, Pedro Alves <palves at redhat dot com>
- Date: Fri, 18 Dec 2015 12:43:50 -0700
- Subject: [patch 2/3] reset pagination counts even when stdin is not a tty
- Authentication-results: sourceware.org; auth=none
- References: <56745D29 dot 504 at codesourcery dot com>
In testing gdb.base/paginate-bg-execution.exp on a remote Windows host
via ssh -T, I observed this output:
set height 2
(gdb) PASS: gdb.base/paginate-bg-execution.exp: paginate: set height 2
continue&
---Type <return> to continue, or q <return> to quit---ERROR: Window too
small.
UNRESOLVED: gdb.base/paginate-bg-execution.exp: paginate: continue&
E.g., it was giving the pagination prompt in a place the testcase wasn't
expecting. I tracked this down to the count of lines already printed
not being reset properly with each command. The call to
reinitialize_more_filter is presently conditional on stdin being a tty,
but the pagination logic itself clearly is not so conditionalized (if it
were, I'd not be seeing any pagination prompting at all when testing in
this configuration). So the obvious fix seems to be to remove that
extra condition. Now the output from that snippet is:
set height 2
(gdb) PASS: gdb.base/paginate-bg-execution.exp: paginate: set height 2
continue&
Continuing.
(gdb) PASS: gdb.base/paginate-bg-execution.exp: paginate: continue&
and the pagination prompts do appear in the subsequent tests, same as in
the Linux-host testing with a TTY.
OK to commit?
-Sandra
2015-12-18 Sandra Loosemore <sandra@codesourcery.com>
gdb/
* event-top.c (command_handler): Don't require stdin to be a tty
for call to reinitialize_more_filter.
* top.c (command_loop): Likewise.
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 3f98c05..e5a5ac6 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -469,11 +469,10 @@ async_disable_stdin (void)
static void
command_handler (char *command)
{
- int stdin_is_tty = ISATTY (stdin);
struct cleanup *stat_chain;
clear_quit_flag ();
- if (instream == stdin && stdin_is_tty)
+ if (instream == stdin)
reinitialize_more_filter ();
/* If readline returned a NULL command, it means that the connection
diff --git a/gdb/top.c b/gdb/top.c
index d1e2271..a45f3cc 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -542,7 +542,6 @@ command_loop (void)
{
struct cleanup *old_chain;
char *command;
- int stdin_is_tty = ISATTY (stdin);
while (instream && !feof (instream))
{
@@ -550,7 +549,7 @@ command_loop (void)
(*window_hook) (instream, get_prompt ());
clear_quit_flag ();
- if (instream == stdin && stdin_is_tty)
+ if (instream == stdin)
reinitialize_more_filter ();
old_chain = make_cleanup (null_cleanup, 0);