diff options
author | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2019-04-20 14:02:29 +0200 |
---|---|---|
committer | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2019-05-31 17:10:08 +0200 |
commit | 68bb5386b84af4031175bf186269eb6b54b8611d (patch) | |
tree | b3b9b003d4b9f692f2437a7afb86cd4f7efd1869 /gdb/main.c | |
parent | a0486bac41d6ce47f27795a5abbca5cc53ddba00 (diff) | |
download | gdb-68bb5386b84af4031175bf186269eb6b54b8611d.zip gdb-68bb5386b84af4031175bf186269eb6b54b8611d.tar.gz gdb-68bb5386b84af4031175bf186269eb6b54b8611d.tar.bz2 |
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.
Diffstat (limited to 'gdb/main.c')
-rw-r--r-- | gdb/main.c | 2 |
1 files changed, 0 insertions, 2 deletions
@@ -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. */ |