mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-04 13:57:12 +08:00
* NEWS: Updated.
* event-loop.c (start_event_loop): Call after_char_processing_hook. * event-top.h (after_char_processing_hook): Declare. * event-top.c (rl_callback_read_char_wrapper): Call after_char_processing_hook. (after_char_processing_hook): New global. * top.c (operate_saved_history): New global. (gdb_rl_operate_and_get_next): New function. (init_main): Add the operate-and-get-next defun. (gdb_rl_operate_and_get_next_completion): New function.
This commit is contained in:
@ -1,3 +1,17 @@
|
|||||||
|
2001-11-26 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* NEWS: Updated.
|
||||||
|
* event-loop.c (start_event_loop): Call
|
||||||
|
after_char_processing_hook.
|
||||||
|
* event-top.h (after_char_processing_hook): Declare.
|
||||||
|
* event-top.c (rl_callback_read_char_wrapper): Call
|
||||||
|
after_char_processing_hook.
|
||||||
|
(after_char_processing_hook): New global.
|
||||||
|
* top.c (operate_saved_history): New global.
|
||||||
|
(gdb_rl_operate_and_get_next): New function.
|
||||||
|
(init_main): Add the operate-and-get-next defun.
|
||||||
|
(gdb_rl_operate_and_get_next_completion): New function.
|
||||||
|
|
||||||
2001-11-26 Tom Tromey <tromey@redhat.com>
|
2001-11-26 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* NEWS: Update for --args.
|
* NEWS: Update for --args.
|
||||||
|
4
gdb/NEWS
4
gdb/NEWS
@ -12,6 +12,10 @@ x86 OpenBSD i[3456]86-*-openbsd*
|
|||||||
The new `--args' feature can be used to specify command-line arguments
|
The new `--args' feature can be used to specify command-line arguments
|
||||||
for the inferior from gdb's command line.
|
for the inferior from gdb's command line.
|
||||||
|
|
||||||
|
* Changes to key bindings
|
||||||
|
|
||||||
|
There is a new `operate-and-get-next' function bound to `C-o'.
|
||||||
|
|
||||||
*** Changes in GDB 5.1:
|
*** Changes in GDB 5.1:
|
||||||
|
|
||||||
* New native configurations
|
* New native configurations
|
||||||
|
@ -402,6 +402,14 @@ start_event_loop (void)
|
|||||||
interface specific, because interfaces can display the
|
interface specific, because interfaces can display the
|
||||||
prompt in their own way. */
|
prompt in their own way. */
|
||||||
display_gdb_prompt (0);
|
display_gdb_prompt (0);
|
||||||
|
/* This call looks bizarre, but it is required. If the user
|
||||||
|
entered a command that caused an error,
|
||||||
|
after_char_processing_hook won't be called from
|
||||||
|
rl_callback_read_char_wrapper. Using a cleanup there
|
||||||
|
won't work, since we want this function to be called
|
||||||
|
after a new prompt is printed. */
|
||||||
|
if (after_char_processing_hook)
|
||||||
|
(*after_char_processing_hook) ();
|
||||||
/* Maybe better to set a flag to be checked somewhere as to
|
/* Maybe better to set a flag to be checked somewhere as to
|
||||||
whether display the prompt or not. */
|
whether display the prompt or not. */
|
||||||
}
|
}
|
||||||
|
@ -153,6 +153,10 @@ struct readline_input_state
|
|||||||
char *linebuffer_ptr;
|
char *linebuffer_ptr;
|
||||||
}
|
}
|
||||||
readline_input_state;
|
readline_input_state;
|
||||||
|
|
||||||
|
/* This hook is called by rl_callback_read_char_wrapper after each
|
||||||
|
character is processed. */
|
||||||
|
void (*after_char_processing_hook) ();
|
||||||
|
|
||||||
|
|
||||||
/* Wrapper function for calling into the readline library. The event
|
/* Wrapper function for calling into the readline library. The event
|
||||||
@ -162,6 +166,8 @@ static void
|
|||||||
rl_callback_read_char_wrapper (gdb_client_data client_data)
|
rl_callback_read_char_wrapper (gdb_client_data client_data)
|
||||||
{
|
{
|
||||||
rl_callback_read_char ();
|
rl_callback_read_char ();
|
||||||
|
if (after_char_processing_hook)
|
||||||
|
(*after_char_processing_hook) ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize all the necessary variables, start the event loop,
|
/* Initialize all the necessary variables, start the event loop,
|
||||||
|
@ -108,3 +108,4 @@ extern struct prompts the_prompts;
|
|||||||
extern void (*call_readline) (void *);
|
extern void (*call_readline) (void *);
|
||||||
extern void (*input_handler) (char *);
|
extern void (*input_handler) (char *);
|
||||||
extern int input_fd;
|
extern int input_fd;
|
||||||
|
extern void (*after_char_processing_hook) (void);
|
||||||
|
50
gdb/top.c
50
gdb/top.c
@ -1035,6 +1035,52 @@ init_signals (void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The current saved history number from operate-and-get-next.
|
||||||
|
This is -1 if not valid. */
|
||||||
|
static int operate_saved_history = -1;
|
||||||
|
|
||||||
|
/* This is put on the appropriate hook and helps operate-and-get-next
|
||||||
|
do its work. */
|
||||||
|
void
|
||||||
|
gdb_rl_operate_and_get_next_completion ()
|
||||||
|
{
|
||||||
|
int delta = where_history () - operate_saved_history;
|
||||||
|
/* The `key' argument to rl_get_previous_history is ignored. */
|
||||||
|
rl_get_previous_history (delta, 0);
|
||||||
|
operate_saved_history = -1;
|
||||||
|
|
||||||
|
/* readline doesn't automatically update the display for us. */
|
||||||
|
rl_redisplay ();
|
||||||
|
|
||||||
|
after_char_processing_hook = NULL;
|
||||||
|
rl_pre_input_hook = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is a gdb-local readline command handler. It accepts the
|
||||||
|
current command line (like RET does) and, if this command was taken
|
||||||
|
from the history, arranges for the next command in the history to
|
||||||
|
appear on the command line when the prompt returns.
|
||||||
|
We ignore the arguments. */
|
||||||
|
static int
|
||||||
|
gdb_rl_operate_and_get_next (int count, int key)
|
||||||
|
{
|
||||||
|
if (event_loop_p)
|
||||||
|
{
|
||||||
|
/* Use the async hook. */
|
||||||
|
after_char_processing_hook = gdb_rl_operate_and_get_next_completion;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* This hook only works correctly when we are using the
|
||||||
|
synchronous readline. */
|
||||||
|
rl_pre_input_hook = (Function *) gdb_rl_operate_and_get_next_completion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add 1 because we eventually want the next line. */
|
||||||
|
operate_saved_history = where_history () + 1;
|
||||||
|
return rl_newline (1, key);
|
||||||
|
}
|
||||||
|
|
||||||
/* Read one line from the command input stream `instream'
|
/* Read one line from the command input stream `instream'
|
||||||
into the local static buffer `linebuffer' (whose current length
|
into the local static buffer `linebuffer' (whose current length
|
||||||
is `linelength').
|
is `linelength').
|
||||||
@ -1880,6 +1926,10 @@ init_main (void)
|
|||||||
rl_completer_quote_characters = get_gdb_completer_quote_characters ();
|
rl_completer_quote_characters = get_gdb_completer_quote_characters ();
|
||||||
rl_readline_name = "gdb";
|
rl_readline_name = "gdb";
|
||||||
|
|
||||||
|
/* The name for this defun comes from Bash, where it originated.
|
||||||
|
15 is Control-o, the same binding this function has in Bash. */
|
||||||
|
rl_add_defun ("operate-and-get-next", gdb_rl_operate_and_get_next, 15);
|
||||||
|
|
||||||
/* The set prompt command is different depending whether or not the
|
/* The set prompt command is different depending whether or not the
|
||||||
async version is run. NOTE: this difference is going to
|
async version is run. NOTE: this difference is going to
|
||||||
disappear as we make the event loop be the default engine of
|
disappear as we make the event loop be the default engine of
|
||||||
|
Reference in New Issue
Block a user