public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug cli/30320] New: [gdb/cli] lines_per_page not reset on "set height 0"
Date: Thu, 06 Apr 2023 07:50:08 +0000	[thread overview]
Message-ID: <bug-30320-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=30320

            Bug ID: 30320
           Summary: [gdb/cli] lines_per_page not reset on "set height 0"
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: cli
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

I tested the following change:
...
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index bb4bd656471..a29fde6a7f4 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -216,8 +216,8 @@ if ![info exists INTERNAL_GDBFLAGS] {
        [join [list \
                   "-nw" \
                   "-nx" \
-                  {-iex "set height 0"} \
-                  {-iex "set width 0"}]]
+                  {-eiex "set height 0"} \
+                  {-eiex "set width 0"}]]

     # If DEBUGINFOD_URLS is set, gdb will try to download sources and
     # debug info for f.i. system libraries.  Prevent this.
...
and I ran into only one regression:
...
FAIL: gdb.base/paginate-execution-startup.exp: return: send \n to GDB
...

The passing case looks like this:
...
builtin_spawn /data/vries/gdb/leap-15-4/build/gdb/testsuite/../../gdb/gdb -nw
-nx -iex set height 0 -iex set width 0 -data-directory
/data/vries/gdb/leap-15-4/build/gdb/data-directory -ex set height 2 -ex start
--args
/data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.base/paginate-execution-startup/paginate-execution-startup^M
GNU gdb (GDB) 14.0.50.20230405-git^M
Copyright (C) 2023 Free Software Foundation, Inc.^M
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>^M
This is free software: you are free to change and redistribute it.^M
There is NO WARRANTY, to the extent permitted by law.^M
Type "show copying" and "show warranty" for details.^M
This GDB was configured as "x86_64-pc-linux-gnu".^M
Type "show configuration" for configuration details.^M
For bug reporting instructions, please see:^M
<https://www.gnu.org/software/gdb/bugs/>.^M
Find the GDB manual and other documentation resources online at:^M
    <http://www.gnu.org/software/gdb/documentation/>.^M
^M
For help, type "help".^M
Type "apropos word" to search for commands related to "word"...^M
Reading symbols from
/data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.base/paginate-execution-startup/paginate-execution-startup...^M
--Type <RET> for more, q to quit, c to continue without paging--PASS:
gdb.base/paginate-execution-startup.exp: return: run to pagination
^M
Temporary breakpoint 1 at 0x400512: file
/data/vries/gdb/src/gdb/testsuite/gdb.base/paginate-execution-startup.c, line
29.^M
--Type <RET> for more, q to quit, c to continue without paging--^M
Starting program:
/data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.base/paginate-execution-startup/paginate-execution-startup
^M
^M
Temporary breakpoint 1, main () at
/data/vries/gdb/src/gdb/testsuite/gdb.base/paginate-execution-startup.c:29^M
29        sleep (3);^M
(gdb) PASS: gdb.base/paginate-execution-startup.exp: return: send \n to GDB
...

And the failing case looks like this:
...
builtin_spawn /data/vries/gdb/leap-15-4/build/gdb/testsuite/../../gdb/gdb -nw
-nx -eiex set height 0 -eiex set width 0 -data-directory
/data/vries/gdb/leap-15-4/build/gdb/data-directory -ex set height 2 -ex start
--args
/data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.base/paginate-execution-startup/paginate-execution-startup^M
GNU gdb (GDB) 14.0.50.20230405-git^M
Copyright (C) 2023 Free Software Foundation, Inc.^M
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>^M
This is free software: you are free to change and redistribute it.^M
There is NO WARRANTY, to the extent permitted by law.^M
Type "show copying" and "show warranty" for details.^M
This GDB was configured as "x86_64-pc-linux-gnu".^M
Type "show configuration" for configuration details.^M
For bug reporting instructions, please see:^M
<https://www.gnu.org/software/gdb/bugs/>.^M
Find the GDB manual and other documentation resources online at:^M
    <http://www.gnu.org/software/gdb/documentation/>.^M
^M
For help, type "help".^M
Type "apropos word" to search for commands related to "word"...^M
Reading symbols from
/data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.base/paginate-execution-startup/paginate-execution-startup...^M
Temporary breakpoint 1 at 0x400512: file
/data/vries/gdb/src/gdb/testsuite/gdb.base/paginate-execution-startup.c, line
29.^M
--Type <RET> for more, q to quit, c to continue without paging--PASS:
gdb.base/paginate-execution-startup.exp: return: run to pagination
^M
Starting program:
/data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.base/paginate-execution-startup/paginate-execution-startup
^M
^M
Temporary breakpoint 1, main () at
/data/vries/gdb/src/gdb/testsuite/gdb.base/paginate-execution-startup.c:29^M
29        sleep (3);^M
(gdb) FAIL: gdb.base/paginate-execution-startup.exp: return: send \n to GDB
...

On obvious difference is in the amount of pagination prompts: 2 vs 1.

Looking in more detail, the first pagination prompt is in different locations.

Let's track pagination in both scenarios using watch lines_per_page and
printed_lines.

First (passing, 2 pagination prompts):
- lines_per_page 0 -> 21
- lines_printed 0 -> 1 -> ... -> 15
- lines_per_page 21 -> 4294967295
- lines_per_page 4294967295 -> 2
- lines_printed 15 -> 0 (due to subsequent pagination prompt)
- pagination prompt, press enter
- lines_printed 0 -> 1
- lines_printed 1 -> 0 (due to subsequent pagination prompt)
- pagination prompt, press enter
- lines_printed 0 -> 1 -> 2 -> 3 -> 4

Second (failing, 1 pagination prompt):
- lines_per_page 0 -> 21
- lines_per_page 21 -> 4294967295
- lines_per_page 4294967295 -> 2
- lines_printed 0 -> 1
- lines_printed 1 -> 0 (due to subsequent pagination prompt)
- pagination prompt, press enter
- lines_printed 0 -> 1 -> 2 -> 3 -> 4

It seems odd to me that we don't reset lines_printed to 0 when doing "set
height 0", in other words, setting pagination to "off".

In other words, I wonder if the failing scenario shows the correct behaviour.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2023-04-06  7:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06  7:50 vries at gcc dot gnu.org [this message]
2023-04-06  8:07 ` [Bug cli/30320] " vries at gcc dot gnu.org
2023-04-06  8:12 ` vries at gcc dot gnu.org
2023-04-06 11:35 ` vries at gcc dot gnu.org

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=bug-30320-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).