Discussion:
[Bug gdb/22619] New: repeat count is forgotten by newline to extend previous 'x' command (examine memory)
jreiser at BitWagon dot com
2017-12-16 12:19:09 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=22619

Bug ID: 22619
Summary: repeat count is forgotten by newline to extend
previous 'x' command (examine memory)
Product: gdb
Version: HEAD
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: jreiser at BitWagon dot com
Target Milestone: ---

The command sequence
(gdb) x/12xw $sp
(gdb) ## newline to show the next 12 words
forgets the repeat count "12"; it displays only one word instead of the
expected 12.

Example:
$ gdb hello
GNU gdb (GNU gdb (GDB) 8.0.50.20171216-git
<<snip>>
(gdb) b main
(gdb) run
Breakpoint 1, main (argc=0x1, argv=0xbefff454) at hello.c:5

(gdb) x/12xw $sp
0xbefff2e8: 0x00010460 0x00000000 0xbefff454 0x00000001
0xbefff2f8: 0x00000000 0x00000000 0x00000000 0xb6e63c40
0xbefff308: 0xb6fb5000 0xbefff454 0x00000001 0x00010404
(gdb) ## type <Enter> or <Return> to ask for the next 12 words
0xbefff318: 0x9fea1ea9 ## only one (1) word shown instead of twelve (12)
(gdb)

gdb was built from git tip:
commit 09da3ecf04d75084ea7d9c43e3cc0b18b2443ea3 (HEAD -> master, origin/master,
origin/HEAD)
Author: GDB Administrator <***@sourceware.org>
Date: Sat Dec 16 00:00:33 2017 +0000

Automatic date update in version.in
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-04-27 21:32:29 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=22619

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-04-27
CC| |tromey at sourceware dot org
Ever confirmed|0 |1

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
The docs say that the default is 1, so I guess this was intended.
However I expected it to work the way you did and so I tend
to think this ought to be changed. I suppose the way it should
work is that plain RET should use the old count, but a new 'x'
command should default to 1 again.
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-04-27 21:33:19 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=22619

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Actually the manual says:

If you use <RET> to repeat the 'x' command, the repeat count N
is used again; the other arguments default as for successive uses of
'x'.


... so this seems like just a plain bug.
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-04-28 04:28:21 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=22619

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at sourceware dot org |tromey at sourceware dot org

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
I have a patch.
--
You are receiving this mail because:
You are on the CC list for the bug.
cvs-commit at gcc dot gnu.org
2018-05-04 18:31:22 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=22619

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <***@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9be2ae8fc6b908746d9d7ebaf77aec8abba5dd2c

commit 9be2ae8fc6b908746d9d7ebaf77aec8abba5dd2c
Author: Tom Tromey <***@tromey.com>
Date: Fri Apr 27 15:52:44 2018 -0600

Use previous count when 'x' command is repeated

About the 'x' command, the manual says:

If you use <RET> to repeat the 'x' command, the repeat count N is
used again; the other arguments default as for successive uses of
'x'.

However, PR gdb/22619 points out that this does not work.

This patch fixes the problem.

ChangeLog
2018-05-04 Tom Tromey <***@tromey.com>

PR gdb/22619:
* printcmd.c (last_count): New global.
(x_command): Use saved count when repeating.

testsuite/ChangeLog
2018-05-04 Tom Tromey <***@tromey.com>

PR gdb/22619:
* gdb.base/long_long.exp (gdb_test_long_long): Add test for repeat
behavior.
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-05-04 13:02:02 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=22619

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |8.2

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...