This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 10/10] Command line input handling TLC
- From: Luis Machado <lgustavo at codesourcery dot com>
- To: Pedro Alves <palves at redhat dot com>, <gdb-patches at sourceware dot org>
- Date: Wed, 24 Feb 2016 09:41:05 -0300
- Subject: Re: [PATCH 10/10] Command line input handling TLC
- Authentication-results: sourceware.org; auth=none
- References: <1455817236-13642-1-git-send-email-palves at redhat dot com> <1455817236-13642-11-git-send-email-palves at redhat dot com>
- Reply-to: Luis Machado <lgustavo at codesourcery dot com>
On 02/18/2016 03:40 PM, Pedro Alves wrote:
I didn't manage to usefully split this further into smaller
independent pieces, so:
- Use "struct buffer" more.
- Split out the responsability 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-02-18 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.
---
gdb/event-top.c | 340 +++++++++++++++++++++++++++-----------------------------
gdb/event-top.h | 2 +
gdb/top.c | 170 +++++-----------------------
gdb/top.h | 6 +
4 files changed, 200 insertions(+), 318 deletions(-)
This and the rest of the series look good to me. That's a nice cleanup.
Thanks,
Luis