From 68bb5386b84af4031175bf186269eb6b54b8611d Mon Sep 17 00:00:00 2001 From: Philippe Waroquiers <philippe.waroquiers@skynet.be> Date: Sat, 20 Apr 2019 14:02:29 +0200 Subject: Add previous_saved_command_line to allow a command to repeat a previous command. Currently, a previous command can be repeated when the user types an empty line. This is implemented in handle_line_of_input by returning saved_command_line in case an empty line has been input. If we want a command to repeat the previous command, we need to save the previous saved_command_line, as when a command runs, the saved_command_line already contains the current command line of the command being executed. As suggested by Tom, the previous_saved_command_line is made static. At the same time, saved_command_line is also made static. The support functions/variables for the repeat command logic are now all located inside top.c. gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * top.h (saved_command_line): Remove declaration. * top.c (previous_saved_command_line, previous_repeat_arguments): New variables. (saved_command_line): Make static, define together with other 'repeat variables'. (dont_repeat): Clear repeat_arguments. (repeat_previous, get_saved_command_line, save_command_line): New functions. (gdb_init): Initialize saved_command_line and previous_saved_command_line. * main.c (captured_main_1): Remove saved_command_line initialization. * event-top.c (handle_line_of_input): Update to use the new 'repeat' related functions instead of direct access to saved_command_line. * command.h (repeat_previous, get_saved_command_line, save_command_line): New declarations. (dont_repeat): Add comment. --- gdb/main.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'gdb/main.c') diff --git a/gdb/main.c b/gdb/main.c index 35df1e4..ef9bfe8 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -499,8 +499,6 @@ captured_main_1 (struct captured_main_args *context) notice_open_fds (); - saved_command_line = (char *) xstrdup (""); - #ifdef __MINGW32__ /* Ensure stderr is unbuffered. A Cygwin pty or pipe is implemented as a Windows pipe, and Windows buffers on pipes. */ -- cgit v1.1