public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug cli/30320] New: [gdb/cli] lines_per_page not reset on "set height 0"
@ 2023-04-06  7:50 vries at gcc dot gnu.org
  2023-04-06  8:07 ` [Bug cli/30320] " vries at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-06  7:50 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug cli/30320] [gdb/cli] lines_per_page not reset on "set height 0"
  2023-04-06  7:50 [Bug cli/30320] New: [gdb/cli] lines_per_page not reset on "set height 0" vries at gcc dot gnu.org
@ 2023-04-06  8:07 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-06  8:07 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 14805
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14805&action=edit
tentative patch

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug cli/30320] [gdb/cli] lines_per_page not reset on "set height 0"
  2023-04-06  7:50 [Bug cli/30320] New: [gdb/cli] lines_per_page not reset on "set height 0" vries at gcc dot gnu.org
  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
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-06  8:12 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> - lines_printed 0 -> 1 -> 2 -> 3 -> 4

FTR, I also investigated why we're not getting a pagination prompt here,
despite lines_per_page being set to 2, but that's due to this code in
fetch_inferior_event:
...
 /* Temporarily disable pagination.  Otherwise, the user would be               
     given an option to press 'q' to quit, which would cause an early           
     exit and could leave GDB in a half-baked state.  */
  scoped_restore save_pagination
    = make_scoped_restore (&pagination_enabled, false);
...

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug cli/30320] [gdb/cli] lines_per_page not reset on "set height 0"
  2023-04-06  7:50 [Bug cli/30320] New: [gdb/cli] lines_per_page not reset on "set height 0" vries at gcc dot gnu.org
  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
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-06 11:35 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2023-April/198651.html

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-06 11:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-06  7:50 [Bug cli/30320] New: [gdb/cli] lines_per_page not reset on "set height 0" vries at gcc dot gnu.org
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

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