gdb_readline2 -> gdb_readline_no_editing_callback

The "2" in "gdb_readline2" doesn't really convey much.  Rename for
clarity.

gdb/ChangeLog:
2016-03-09  Pedro Alves  <palves@redhat.com>

	* event-top.c (gdb_readline2): Rename to ...
	(gdb_readline_no_editing_callback): ... this.
	(change_line_handler, stdin_event_handler)
	(gdb_setup_readline): Adjust.
	* event-top.h (gdb_readline2): Rename to ...
	(gdb_readline_no_editing_callback): ... this, and move closer to
	other readline-related declarations.
	* mi/mi-interp.c (mi_interpreter_resume): Adjust.
This commit is contained in:
Pedro Alves
2016-03-09 18:24:59 +00:00
parent 8a24383254
commit c70061cf94
4 changed files with 31 additions and 20 deletions

View File

@ -1,3 +1,14 @@
2016-03-09 Pedro Alves <palves@redhat.com>
* event-top.c (gdb_readline2): Rename to ...
(gdb_readline_no_editing_callback): ... this.
(change_line_handler, stdin_event_handler)
(gdb_setup_readline): Adjust.
* event-top.h (gdb_readline2): Rename to ...
(gdb_readline_no_editing_callback): ... this, and move closer to
other readline-related declarations.
* mi/mi-interp.c (mi_interpreter_resume): Adjust.
2016-03-09 Pedro Alves <palves@redhat.com> 2016-03-09 Pedro Alves <palves@redhat.com>
* top.c (window_hook): Delete. * top.c (window_hook): Delete.

View File

@ -189,9 +189,9 @@ cli_command_loop (void *data)
/* Change the function to be invoked every time there is a character /* Change the function to be invoked every time there is a character
ready on stdin. This is used when the user sets the editing off, ready on stdin. This is used when the user sets the editing off,
therefore bypassing readline, and letting gdb handle the input therefore bypassing readline, and letting gdb handle the input
itself, via gdb_readline2. Also it is used in the opposite case in itself, via gdb_readline_no_editing_callback. Also it is used in
which the user sets editing on again, by restoring readline the opposite case in which the user sets editing on again, by
handling of the input. */ restoring readline handling of the input. */
static void static void
change_line_handler (void) change_line_handler (void)
{ {
@ -209,9 +209,9 @@ change_line_handler (void)
} }
else else
{ {
/* Turn off editing by using gdb_readline2. */ /* Turn off editing by using gdb_readline_no_editing_callback. */
gdb_rl_callback_handler_remove (); gdb_rl_callback_handler_remove ();
call_readline = gdb_readline2; call_readline = gdb_readline_no_editing_callback;
/* Set up the command handler as well, in case we are called as /* Set up the command handler as well, in case we are called as
first thing from .gdbinit. */ first thing from .gdbinit. */
@ -410,8 +410,9 @@ top_level_prompt (void)
/* When there is an event ready on the stdin file desriptor, instead /* When there is an event ready on the stdin file desriptor, instead
of calling readline directly throught the callback function, or of calling readline directly throught the callback function, or
instead of calling gdb_readline2, give gdb a chance to detect instead of calling gdb_readline_no_editing_callback, give gdb a
errors and do something. */ chance to detect errors and do something. */
void void
stdin_event_handler (int error, gdb_client_data client_data) stdin_event_handler (int error, gdb_client_data client_data)
{ {
@ -699,13 +700,11 @@ command_line_handler (char *rl)
} }
/* Does reading of input from terminal w/o the editing features /* Does reading of input from terminal w/o the editing features
provided by the readline library. */ provided by the readline library. Calls the line input handler
once we have a whole input line. */
/* NOTE: 1999-04-30 Asynchronous version of gdb_readline; gdb_readline
will become obsolete when the event loop is made the default
execution for gdb. */
void void
gdb_readline2 (gdb_client_data client_data) gdb_readline_no_editing_callback (gdb_client_data client_data)
{ {
int c; int c;
char *result; char *result;
@ -728,11 +727,12 @@ gdb_readline2 (gdb_client_data client_data)
result = (char *) xmalloc (result_size); result = (char *) xmalloc (result_size);
/* We still need the while loop here, even though it would seem /* We still need the while loop here, even though it would seem
obvious to invoke gdb_readline2 at every character entered. If obvious to invoke gdb_readline_no_editing_callback at every
not using the readline library, the terminal is in cooked mode, character entered. If not using the readline library, the
which sends the characters all at once. Poll will notice that the terminal is in cooked mode, which sends the characters all at
input fd has changed state only after enter is pressed. At this once. Poll will notice that the input fd has changed state only
point we still need to fetch all the chars entered. */ after enter is pressed. At this point we still need to fetch all
the chars entered. */
while (1) while (1)
{ {
@ -1055,7 +1055,7 @@ gdb_setup_readline (void)
else else
{ {
async_command_editing_p = 0; async_command_editing_p = 0;
call_readline = gdb_readline2; call_readline = gdb_readline_no_editing_callback;
} }
/* When readline has read an end-of-line character, it passes the /* When readline has read an end-of-line character, it passes the

View File

@ -44,7 +44,6 @@ extern void handle_stop_sig (int sig);
#endif #endif
extern void handle_sigint (int sig); extern void handle_sigint (int sig);
extern void handle_sigterm (int sig); extern void handle_sigterm (int sig);
extern void gdb_readline2 (void *client_data);
extern void async_request_quit (void *arg); extern void async_request_quit (void *arg);
extern void stdin_event_handler (int error, void *client_data); extern void stdin_event_handler (int error, void *client_data);
extern void async_disable_stdin (void); extern void async_disable_stdin (void);
@ -62,6 +61,7 @@ extern void (*input_handler) (char *);
extern int input_fd; extern int input_fd;
extern void (*after_char_processing_hook) (void); extern void (*after_char_processing_hook) (void);
extern int call_stdin_event_handler_again_p; extern int call_stdin_event_handler_again_p;
extern void gdb_readline_no_editing_callback (void *client_data);
/* Wrappers for rl_callback_handler_remove and /* Wrappers for rl_callback_handler_remove and
rl_callback_handler_install that keep track of whether the callback rl_callback_handler_install that keep track of whether the callback

View File

@ -181,7 +181,7 @@ mi_interpreter_resume (void *data)
/* These overwrite some of the initialization done in /* These overwrite some of the initialization done in
_intialize_event_loop. */ _intialize_event_loop. */
call_readline = gdb_readline2; call_readline = gdb_readline_no_editing_callback;
input_handler = mi_execute_command_input_handler; input_handler = mi_execute_command_input_handler;
async_command_editing_p = 0; async_command_editing_p = 0;
/* FIXME: This is a total hack for now. PB's use of the MI /* FIXME: This is a total hack for now. PB's use of the MI