From 85c4be7c83b80acf647e6ffcaed0f0cdbcb8c3eb Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 12 Oct 2017 08:27:21 -0600 Subject: Add set_repeat_arguments function The "x", "list", and "show commands" commands have special repetition behavior: repeating the command doesn't re-run it with the same arguments This is currently implemented by modifying the passed-in argument; but that won't work properly with const arguments (and seems pretty obscure besides). This patch adds a new "set_repeat_arguments" function and changes the relevant places to call it. gdb/ChangeLog 2017-11-07 Tom Tromey * printcmd.c (x_command): Call set_repeat_arguments. * cli/cli-cmds.c (list_command): Call set_repeat_arguments. * top.c (repeat_arguments): New global. (set_repeat_arguments): New function. (execute_command): Handle repeat_arguments. (show_commands): Calls set_repeat_arguments. * command.h (set_repeat_arguments): Declare. --- gdb/printcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/printcmd.c') diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 017c7be..51e3d38 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1646,7 +1646,7 @@ x_command (char *exp, int from_tty) repeated with Newline. But don't clobber a user-defined command's definition. */ if (from_tty) - *exp = 0; + set_repeat_arguments (""); val = evaluate_expression (expr.get ()); if (TYPE_IS_REFERENCE (value_type (val))) val = coerce_ref (val); -- cgit v1.1