Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sandra Loosemore <sandra@codesourcery.com>
To: gdb-patches <gdb-patches@sourceware.org>,
	Pedro Alves <palves@redhat.com>
Subject: [patch 2/3] reset pagination counts even when stdin is not a tty
Date: Fri, 18 Dec 2015 19:44:00 -0000	[thread overview]
Message-ID: <567461F6.4000609@codesourcery.com> (raw)
In-Reply-To: <56745D29.504@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]

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


[-- Attachment #2: gdb-paginate-2.log --]
[-- Type: text/x-log, Size: 204 bytes --]

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.


[-- Attachment #3: gdb-paginate-2.patch --]
[-- Type: text/x-patch, Size: 1037 bytes --]

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);
 

  parent reply	other threads:[~2015-12-18 19:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18 19:23 [patch 0/3] fix some gdb.base/paginate-bg-execution.exp problems Sandra Loosemore
2015-12-18 19:31 ` [patch 1/3] make prompt_for_continue call throw_quit directly Sandra Loosemore
2015-12-18 19:34   ` Pedro Alves
2015-12-18 19:44 ` Sandra Loosemore [this message]
2015-12-18 20:17   ` [patch 2/3] reset pagination counts even when stdin is not a tty Pedro Alves
2015-12-18 19:50 ` [patch 3/3] add missing gdb_test arguments in paginate-bg-execution.exp Sandra Loosemore
2015-12-18 20:40   ` Pedro Alves
2015-12-18 23:49     ` Sandra Loosemore
2015-12-21 11:53       ` Pedro Alves
2015-12-21 12:27         ` Joel Brobecker
2015-12-25 19:39           ` Sandra Loosemore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=567461F6.4000609@codesourcery.com \
    --to=sandra@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox