Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [RFA v2] Add "continue" response to pager
Date: Wed, 09 May 2018 19:51:00 -0000	[thread overview]
Message-ID: <941985b1-5166-44ab-72fe-b0f62d411e2e@redhat.com> (raw)
In-Reply-To: <20180425145200.27734-1-tom@tromey.com>

On 04/25/2018 03:52 PM, Tom Tromey wrote:
> This adds a "continue" response to the pager.  If the user types "c"
> in response to the pager prompt, pagination will be disabled for the
> duration of one command -- but re-enabled afterward.  This is handy if
> you type a command that produces a lot of output, and you don't want
> to baby-sit it by typing "return" each time the prompt comes up.
> 
> This is v2 of a patch originally sent here but never committed.
> 
>     https://sourceware.org/ml/gdb-patches/2014-06/msg00862.html
> 
> I think this version addresses all comments in that thread.
> 
> Tested by the buildbot.

Thanks, cool feature.  I've wanted it before too.

I gave the patch a quick try, and I have to say that it looks a
bit odd to me that the pager prompt takes two lines:

---Type <return> to continue, q <return> to quit, or c <return> to
   continue without paging---

I'm wondering whether we can shorten that, to, say:

---Type <return> for more, q to quit, c to continue without paging---

That seems clear enough to me, and is still 69 cols.  I doubt
anyone would miss the indication to type enter after q or c.
We could shorten it more, like, say:

---Type <return> for more, q to quit, c to continue without paging---  # 69 cols
---Type <ret> for more, q to quit, c to continue without paging---     # 66 cols
--Type <return> for more, q to quit, c to continue without paging--    # 67 cols
--Type <ret> for more, q to quit, c to continue without paging--       # 64 cols

> diff --git a/gdb/testsuite/gdb.cp/static-print-quit.exp b/gdb/testsuite/gdb.cp/static-print-quit.exp
> index ab60a0cba0..81ea61f7ce 100644
> --- a/gdb/testsuite/gdb.cp/static-print-quit.exp
> +++ b/gdb/testsuite/gdb.cp/static-print-quit.exp
> @@ -41,14 +41,7 @@ gdb_test_multiple "print c" $test {
>  
>  set test "print c - q <return>"
>  gdb_test_multiple "" $test {
> -    -re " to continue, or q <return>" {
> -	pass $test
> -    }
> -}
> -
> -set test "print c - to quit"
> -gdb_test_multiple "" $test {
> -    -re " to quit---$" {
> +    -re " continue without paging---$" {
>  	pass $test
>      }
>  }

This looks like it was split in two for some reason:

commit 7db6f30f9d4707b04e7292d7d8bfa5d37eaff67f
Author:     Jan Kratochvil <jan.kratochvil@redhat.com>
AuthorDate: Fri May 6 13:38:35 2011 +0000

    gdb/testsuite/
            Fix a race.
            * gdb.cp/static-print-quit.exp (print c): Split to ...
            (print c - <return>, print c - q <return>, print c - to quit):
            ... these.  Make the testfile untested on gdb-7.1.


Did you look up the patch submission, see if it still makes sense?


> diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
> index cee195f315..8b296582a9 100644
> --- a/gdb/testsuite/gdb.python/python.exp
> +++ b/gdb/testsuite/gdb.python/python.exp
> @@ -139,33 +139,24 @@ set lines 10
>  gdb_test_no_output "set height $lines"
>  
>  set test "verify pagination beforehand"
> -gdb_test_multiple "python print (\"\\n\" * $lines)" $test {
> -    -re "---Type <return>" {
> -	exp_continue
> -    }
> -    -re " to continue, or q <return>" {
> -	exp_continue
> -    }
> -    -re " to quit---$" {
> -	pass $test
> -    }

So I'm wondering whether this was split for a
similar reason.  Likewise other testsuite spots in the patch.

> diff --git a/gdb/utils.c b/gdb/utils.c
> index b957b0dc5c..4478c52166 100644
> --- a/gdb/utils.c
> +++ b/gdb/utils.c
> @@ -1282,6 +1282,10 @@ show_chars_per_line (struct ui_file *file, int from_tty,
>  /* Current count of lines printed on this page, chars on this line.  */
>  static unsigned int lines_printed, chars_printed;
>  
> +/* True if pagination is disabled for just one command.  */
> +
> +static int pagination_disabled_for_command;

Use bool?

> +
>  /* Buffer and start column of buffered text, for doing smarter word-
>     wrapping.  When someone calls wrap_here(), we start buffering output
>     that comes through fputs_filtered().  If we see a newline, we just
> @@ -1466,12 +1470,14 @@ prompt_for_continue (void)
>       prompt_for_continue_wait_time.  */
>    using namespace std::chrono;
>    steady_clock::time_point prompt_started = steady_clock::now ();
> +  int disable_pagination = pagination_disabled_for_command;

Ditto.

Thanks,
Pedro Alves


  parent reply	other threads:[~2018-05-09 19:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-25 14:52 Tom Tromey
2018-05-09 15:43 ` Tom Tromey
2018-05-09 19:51 ` Pedro Alves [this message]
2018-05-09 21:28   ` Tom Tromey
2018-05-10  0:23     ` Pedro Alves
2018-05-27 15:20       ` Tom Tromey
2018-05-27 21:01         ` Eli Zaretskii
2018-05-28 18:57         ` Pedro Alves
2018-05-29  9:03           ` Tom Tromey
2018-05-29 17:04             ` Pedro Alves
2018-06-04 21:47               ` Tom Tromey
2018-06-05 14:44                 ` Eli Zaretskii

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=941985b1-5166-44ab-72fe-b0f62d411e2e@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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