diff options
author | Pedro Alves <palves@redhat.com> | 2016-03-09 18:25:00 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2016-03-09 18:25:00 +0000 |
commit | b69d38afdea34e4fecab5ea47ffe1e594e0b6233 (patch) | |
tree | 301f91f19eb5968ab8b281eb1510be71f40200c8 /gdb/ChangeLog | |
parent | 2669cade3dcebf5d572bcd535cf21934cbc1633c (diff) | |
download | gdb-b69d38afdea34e4fecab5ea47ffe1e594e0b6233.zip gdb-b69d38afdea34e4fecab5ea47ffe1e594e0b6233.tar.gz gdb-b69d38afdea34e4fecab5ea47ffe1e594e0b6233.tar.bz2 |
Command line input handling TLC
I didn't manage to usefully split this further into smaller
independent pieces, so:
- Use "struct buffer" more.
- Split out the responsibility of composing a complete command line
from multiple input lines split with backslash
(
E.g.:
(gdb) print \
1 + \
2
$1 = 3
(gdb)
)
to a separate function. Note we don't need the separate
readline_input_state and more_to_come globals at all. They were
just obfuscating the logic.
- Factor out the tricky mostly duplicated code in
command_line_handler and command_line_input.
gdb/ChangeLog
2016-03-09 Pedro Alves <palves@redhat.com>
* event-top.c (more_to_come): Delete.
(struct readline_input_state): Delete.
(readline_input_state): Delete.
(get_command_line_buffer): New function.
(command_handler): Update comments. Don't handle NULL commands
here. Do not execute commented lines.
(command_line_append_input_line): New function.
(handle_line_of_input): New function, partly based on
command_line_handler and command_line_input.
(command_line_handler): Rewrite.
* event-top.h (command_handler): New declaration.
(command_loop): Defer command execution to command_handler.
(command_line_input): Update comments. Simplify, using struct
buffer and handle_line_of_input.
* top.h (struct buffer): New forward declaration.
(handle_line_of_input): New declaration.
Diffstat (limited to 'gdb/ChangeLog')
-rw-r--r-- | gdb/ChangeLog | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bc2e99e..37118c5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,24 @@ 2016-03-09 Pedro Alves <palves@redhat.com> + * event-top.c (more_to_come): Delete. + (struct readline_input_state): Delete. + (readline_input_state): Delete. + (get_command_line_buffer): New function. + (command_handler): Update comments. Don't handle NULL commands + here. Do not execute commented lines. + (command_line_append_input_line): New function. + (handle_line_of_input): New function, partly based on + command_line_handler and command_line_input. + (command_line_handler): Rewrite. + * event-top.h (command_handler): New declaration. + (command_loop): Defer command execution to command_handler. + (command_line_input): Update comments. Simplify, using struct + buffer and handle_line_of_input. + * top.h (struct buffer): New forward declaration. + (handle_line_of_input): New declaration. + +2016-03-09 Pedro Alves <palves@redhat.com> + * event-top.c (command_line_handler): Use xfree + xstrdup instead of xrealloc + strcpy. * main.c (captured_main): Use xstrdup instead of xmalloc plus |