diff options
author | Tom Tromey <tom@tromey.com> | 2018-04-27 15:52:44 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-05-04 12:22:37 -0600 |
commit | 9be2ae8fc6b908746d9d7ebaf77aec8abba5dd2c (patch) | |
tree | 38e6471f828844582b6f39bd627884aac9738409 /gdb/printcmd.c | |
parent | f0b3976bdcd29e308bed185630a24806037a717c (diff) | |
download | gdb-9be2ae8fc6b908746d9d7ebaf77aec8abba5dd2c.zip gdb-9be2ae8fc6b908746d9d7ebaf77aec8abba5dd2c.tar.gz gdb-9be2ae8fc6b908746d9d7ebaf77aec8abba5dd2c.tar.bz2 |
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 <tom@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 <tom@tromey.com>
PR gdb/22619:
* gdb.base/long_long.exp (gdb_test_long_long): Add test for repeat
behavior.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r-- | gdb/printcmd.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c index a6d6d7e..18c4110 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -62,6 +62,10 @@ static char last_format = 0; static char last_size = 'w'; +/* Last specified count for the 'x' command. */ + +static int last_count; + /* Default address to examine next, and associated architecture. */ static struct gdbarch *next_gdbarch; @@ -1616,6 +1620,11 @@ x_command (const char *exp, int from_tty) fmt.count = 1; fmt.raw = 0; + /* If there is no expression and no format, use the most recent + count. */ + if (exp == nullptr && last_count > 0) + fmt.count = last_count; + if (exp && *exp == '/') { const char *tmp = exp + 1; @@ -1624,6 +1633,8 @@ x_command (const char *exp, int from_tty) exp = (char *) tmp; } + last_count = fmt.count; + /* If we have an expression, evaluate it and use it as the address. */ if (exp != 0 && *exp != 0) |