* PATCH: operate-and-get-next
@ 2001-10-03 16:05 Tom Tromey
2001-10-04 0:00 ` Eli Zaretskii
2001-10-10 17:53 ` Elena Zannoni
0 siblings, 2 replies; 17+ messages in thread
From: Tom Tromey @ 2001-10-03 16:05 UTC (permalink / raw)
To: gdb-patches
Bash has a readline command called `operate-and-get-next' which I use
very frequently (many times per day). It works like this: go up the
history list using C-p. Then type C-o (the operate-and-get-next key).
This acts like Enter, but when the prompt returns the next command in
history is already available for editing. This key binding makes it
very convenient to replay a previously-entered sequence of commands.
I've long missed it in gdb; for some reason it is a bash-specific key
binding and is not available in readline itself.
The appended patch implements this new readline command and gives it
the same binding in gdb that it has in bash.
The implementation is a little ugly (it adds a couple new global
variables). It is the fourth or fifth try. Anything more obvious (to
me) didn't work out. You can see some of the reasoning in the
comments in rl_callback_read_char_wrapper.
Built and tested on x86 Red Hat Linux 6.2. I tested it interactively,
with both --async and --noasync. I also ran the test suite with no
regressions.
Is this ok to commit?
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* command.h (gdb_rl_pre_input_hook): Declare.
* event-top.c (display_gdb_prompt): Set prompt_just_set.
(prompt_just_set): New global.
(rl_callback_read_char_wrapper): Call gdb_rl_pre_input_hook if
required.
* top.c (operate_saved_history): New global.
(gdb_rl_operate_and_get_next): New function.
(gdb_rl_pre_input_hook): New function.
(init_main): Set rl_pre_input_hook and add the
operate-and-get-next defun.
Index: command.h
===================================================================
RCS file: /cvs/src/src/gdb/command.h,v
retrieving revision 1.18
diff -u -r1.18 command.h
--- command.h 2001/07/16 14:46:34 1.18
+++ command.h 2001/10/03 22:41:30
@@ -350,6 +350,8 @@
extern NORETURN void error_no_arg (char *) ATTR_NORETURN;
+extern void gdb_rl_pre_input_hook ();
+
extern void dont_repeat (void);
/* Used to mark commands that don't do anything. If we just leave the
Index: event-top.c
===================================================================
RCS file: /cvs/src/src/gdb/event-top.c,v
retrieving revision 1.16
diff -u -r1.16 event-top.c
--- event-top.c 2001/08/27 22:39:55 1.16
+++ event-top.c 2001/10/03 22:41:31
@@ -153,6 +153,11 @@
char *linebuffer_ptr;
}
readline_input_state;
+
+/* This is used to communicate from the prompt machinery back to the
+ character handler. See rl_callback_read_char_wrapper for more
+ information. */
+static int prompt_just_set = 0;
\f
/* Wrapper function for calling into the readline library. The event
@@ -162,6 +167,19 @@
rl_callback_read_char_wrapper (gdb_client_data client_data)
{
rl_callback_read_char ();
+
+ /* If the prompt was just set, see if we need to do some work for
+ the operate-and-get-next key binding.
+ We can't use rl_pre_input_hook for this, because the callback-driven
+ readline clears the current command line after this hook is
+ called. We can't put this code directly in display_gdb_prompt,
+ because that is called from a callback before the current command
+ line is cleared in readline. So instead we arrange for a flag to
+ be set at the right moment; if this flag is set after we process
+ a character then we know we've just printed a new prompt and we
+ are now ready to do any pre-input processing. */
+ if (prompt_just_set)
+ gdb_rl_pre_input_hook ();
}
/* Initialize all the necessary variables, start the event loop,
@@ -293,6 +311,9 @@
{
rl_callback_handler_remove ();
rl_callback_handler_install (new_prompt, input_handler);
+
+ /* See rl_callback_read_char_wrapper to understand this. */
+ prompt_just_set = 1;
}
/* new_prompt at this point can be the top of the stack or the one passed in */
else if (new_prompt)
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.45
diff -u -r1.45 top.c
--- top.c 2001/09/07 21:33:08 1.45
+++ top.c 2001/10/03 22:41:33
@@ -1032,6 +1032,41 @@
#endif
}
\f
+/* The current saved history number from operate-and-get-next.
+ This is -1 if not valid. */
+static int operate_saved_history = -1;
+
+/* 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)
+{
+ /* Add 1 because we eventually want the next line. */
+ operate_saved_history = where_history () + 1;
+ return rl_newline (1, key);
+}
+
+/* This function is put on the `rl_pre_input_hook' and helps
+ operate-and-get-next do its work. */
+void
+gdb_rl_pre_input_hook ()
+{
+ if (operate_saved_history != -1)
+ {
+ 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 ();
+ }
+}
+
+\f
/* Read one line from the command input stream `instream'
into the local static buffer `linebuffer' (whose current length
is `linelength').
@@ -1847,6 +1882,10 @@
if (!event_loop_p)
{
gdb_prompt_string = savestring (DEFAULT_PROMPT, strlen (DEFAULT_PROMPT));
+
+ /* This hook only works correctly when we are using the
+ synchronous readline. */
+ rl_pre_input_hook = (Function *) gdb_rl_pre_input_hook;
}
else
{
@@ -1881,6 +1920,10 @@
get_gdb_completer_word_break_characters ();
rl_completer_quote_characters = get_gdb_completer_quote_characters ();
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
async version is run. NOTE: this difference is going to
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: PATCH: operate-and-get-next 2001-10-03 16:05 PATCH: operate-and-get-next Tom Tromey @ 2001-10-04 0:00 ` Eli Zaretskii 2001-10-04 18:16 ` Tom Tromey 2001-10-10 17:53 ` Elena Zannoni 1 sibling, 1 reply; 17+ messages in thread From: Eli Zaretskii @ 2001-10-04 0:00 UTC (permalink / raw) To: tromey; +Cc: gdb-patches > From: Tom Tromey <tromey@redhat.com> > Date: 03 Oct 2001 17:17:44 -0600 > > Bash has a readline command called `operate-and-get-next' which I use > very frequently (many times per day). It works like this: go up the > history list using C-p. Then type C-o (the operate-and-get-next key). > This acts like Enter, but when the prompt returns the next command in > history is already available for editing. This key binding makes it > very convenient to replay a previously-entered sequence of commands. > I've long missed it in gdb; for some reason it is a bash-specific key > binding and is not available in readline itself. I was missing such a feature as well. Thanks for implementing it. > The appended patch implements this new readline command and gives it > the same binding in gdb that it has in bash. I think we should mention this in the "Command Syntax" section, where the action of RET is described. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: PATCH: operate-and-get-next 2001-10-04 0:00 ` Eli Zaretskii @ 2001-10-04 18:16 ` Tom Tromey 2001-10-09 12:06 ` Eli Zaretskii 0 siblings, 1 reply; 17+ messages in thread From: Tom Tromey @ 2001-10-04 18:16 UTC (permalink / raw) To: Eli Zaretskii; +Cc: gdb-patches >>>>> "Eli" == Eli Zaretskii <eliz@is.elta.co.il> writes: Eli> I was missing such a feature as well. Thanks for implementing it. You're welcome. >> The appended patch implements this new readline command and gives >> it the same binding in gdb that it has in bash. Eli> I think we should mention this in the "Command Syntax" section, Eli> where the action of RET is described. Thanks. How about the appended? I took the bulk of the text from the Bash manual. Tom Index: doc/ChangeLog from Tom Tromey <tromey@redhat.com> * gdb.texinfo (Command Syntax): Document C-o binding. Index: doc/gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.51 diff -u -r1.51 gdb.texinfo --- doc/gdb.texinfo 2001/09/12 19:49:52 1.51 +++ doc/gdb.texinfo 2001/10/05 00:34:19 @@ -1190,6 +1190,13 @@ nothing. This is useful mainly in command files (@pxref{Command Files,,Command files}). +@cindex repeating command sequences +@kindex C-o @r{(operate-and-get-next)} +The @kbd{C-o} binding is useful for repeating a complex sequence of +commands. This command accepts the current line, like @kbd{RET}, and +then fetches the next line relative to the current line from the history +for editing. + @node Completion @section Command completion ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: PATCH: operate-and-get-next 2001-10-04 18:16 ` Tom Tromey @ 2001-10-09 12:06 ` Eli Zaretskii 2001-10-09 12:48 ` Tom Tromey 0 siblings, 1 reply; 17+ messages in thread From: Eli Zaretskii @ 2001-10-09 12:06 UTC (permalink / raw) To: Tom Tromey; +Cc: gdb-patches > Eli> I think we should mention this in the "Command Syntax" section, > Eli> where the action of RET is described. > > Thanks. How about the appended? > I took the bulk of the text from the Bash manual. Perfect; approved. Thanks! ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: PATCH: operate-and-get-next 2001-10-09 12:06 ` Eli Zaretskii @ 2001-10-09 12:48 ` Tom Tromey 0 siblings, 0 replies; 17+ messages in thread From: Tom Tromey @ 2001-10-09 12:48 UTC (permalink / raw) To: Eli Zaretskii; +Cc: gdb-patches >>>>> "Eli" == Eli Zaretskii <eliz@is.elta.co.il> writes: Eli> I think we should mention this in the "Command Syntax" section, Eli> where the action of RET is described. >> Thanks. How about the appended? >> I took the bulk of the text from the Bash manual. Eli> Perfect; approved. Thanks! Thanks. I'll check it in once the rest of the patch is approved. Tom ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: PATCH: operate-and-get-next 2001-10-03 16:05 PATCH: operate-and-get-next Tom Tromey 2001-10-04 0:00 ` Eli Zaretskii @ 2001-10-10 17:53 ` Elena Zannoni 2001-10-13 10:24 ` Tom Tromey 1 sibling, 1 reply; 17+ messages in thread From: Elena Zannoni @ 2001-10-10 17:53 UTC (permalink / raw) To: tromey; +Cc: gdb-patches Tom Tromey writes: > Bash has a readline command called `operate-and-get-next' which I use > very frequently (many times per day). It works like this: go up the > history list using C-p. Then type C-o (the operate-and-get-next key). > This acts like Enter, but when the prompt returns the next command in > history is already available for editing. This key binding makes it > very convenient to replay a previously-entered sequence of commands. > I've long missed it in gdb; for some reason it is a bash-specific key > binding and is not available in readline itself. > Yes, I like this feature. > The appended patch implements this new readline command and gives it > the same binding in gdb that it has in bash. > > The implementation is a little ugly (it adds a couple new global > variables). It is the fourth or fifth try. Anything more obvious (to > me) didn't work out. You can see some of the reasoning in the > comments in rl_callback_read_char_wrapper. > > Built and tested on x86 Red Hat Linux 6.2. I tested it interactively, > with both --async and --noasync. I also ran the test suite with no > regressions. > > Is this ok to commit? > It looks to me that prompt_just_set is always 1, after it is set the very first time. So it doesn't really help. If I get this right, your problem is that readline needs to somehow retain the memory of the fact that it was executing a cntrl-o before returning control to gdb, and that it needs to complete its job, by displaying the next command in the history. (This is very similar to the same problem the gdb is facing of remembering what command it was executing and for which I had to introduce the 'continuation' mechanism.) Instead of having this global variable, could it be possible to play with installing and un-installing the hook itself? And then have rl_callback_read_char_wrapper do a check if (blah_hook) blah_hook(); Actually I would like to make bla_hook be a generic function pointer, and assign to this a function with a more specific name like 'operate_and_get_next_completion' or something of the sort. Also, by setting the variable (or the hook) in gdb_display_prompt, we do this call every time we process one single char, not only after a cntrl-o was issued. It is the body of the hook function that knows whether or not a cntrl-o was done because of the operate_saved_history value not being -1. Could we instead set this hook in the operate_and_get_next function itself? And call it at the same spot you call it now. In the same way the rl_pre_input_hook could also be set in the same operate-and-get-next function. You can even use event_loop_p in there to determine what hook to set. We must also find a way to deinstall the hook after the whole cntrl-o has completed. thanks Elena > Tom > > Index: ChangeLog > from Tom Tromey <tromey@redhat.com> > > * command.h (gdb_rl_pre_input_hook): Declare. > * event-top.c (display_gdb_prompt): Set prompt_just_set. > (prompt_just_set): New global. > (rl_callback_read_char_wrapper): Call gdb_rl_pre_input_hook if > required. > * top.c (operate_saved_history): New global. > (gdb_rl_operate_and_get_next): New function. > (gdb_rl_pre_input_hook): New function. > (init_main): Set rl_pre_input_hook and add the > operate-and-get-next defun. > > Index: command.h > =================================================================== > RCS file: /cvs/src/src/gdb/command.h,v > retrieving revision 1.18 > diff -u -r1.18 command.h > --- command.h 2001/07/16 14:46:34 1.18 > +++ command.h 2001/10/03 22:41:30 > @@ -350,6 +350,8 @@ > > extern NORETURN void error_no_arg (char *) ATTR_NORETURN; > > +extern void gdb_rl_pre_input_hook (); > + > extern void dont_repeat (void); > > /* Used to mark commands that don't do anything. If we just leave the > Index: event-top.c > =================================================================== > RCS file: /cvs/src/src/gdb/event-top.c,v > retrieving revision 1.16 > diff -u -r1.16 event-top.c > --- event-top.c 2001/08/27 22:39:55 1.16 > +++ event-top.c 2001/10/03 22:41:31 > @@ -153,6 +153,11 @@ > char *linebuffer_ptr; > } > readline_input_state; > + > +/* This is used to communicate from the prompt machinery back to the > + character handler. See rl_callback_read_char_wrapper for more > + information. */ > +static int prompt_just_set = 0; > \f > > /* Wrapper function for calling into the readline library. The event > @@ -162,6 +167,19 @@ > rl_callback_read_char_wrapper (gdb_client_data client_data) > { > rl_callback_read_char (); > + > + /* If the prompt was just set, see if we need to do some work for > + the operate-and-get-next key binding. > + We can't use rl_pre_input_hook for this, because the callback-driven > + readline clears the current command line after this hook is > + called. We can't put this code directly in display_gdb_prompt, > + because that is called from a callback before the current command > + line is cleared in readline. So instead we arrange for a flag to > + be set at the right moment; if this flag is set after we process > + a character then we know we've just printed a new prompt and we > + are now ready to do any pre-input processing. */ > + if (prompt_just_set) > + gdb_rl_pre_input_hook (); > } > > /* Initialize all the necessary variables, start the event loop, > @@ -293,6 +311,9 @@ > { > rl_callback_handler_remove (); > rl_callback_handler_install (new_prompt, input_handler); > + > + /* See rl_callback_read_char_wrapper to understand this. */ > + prompt_just_set = 1; > } > /* new_prompt at this point can be the top of the stack or the one passed in */ > else if (new_prompt) > Index: top.c > =================================================================== > RCS file: /cvs/src/src/gdb/top.c,v > retrieving revision 1.45 > diff -u -r1.45 top.c > --- top.c 2001/09/07 21:33:08 1.45 > +++ top.c 2001/10/03 22:41:33 > @@ -1032,6 +1032,41 @@ > #endif > } > \f > +/* The current saved history number from operate-and-get-next. > + This is -1 if not valid. */ > +static int operate_saved_history = -1; > + > +/* 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) > +{ > + /* Add 1 because we eventually want the next line. */ > + operate_saved_history = where_history () + 1; > + return rl_newline (1, key); > +} > + > +/* This function is put on the `rl_pre_input_hook' and helps > + operate-and-get-next do its work. */ > +void > +gdb_rl_pre_input_hook () > +{ > + if (operate_saved_history != -1) > + { > + 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 (); > + } > +} > + > +\f > /* Read one line from the command input stream `instream' > into the local static buffer `linebuffer' (whose current length > is `linelength'). > @@ -1847,6 +1882,10 @@ > if (!event_loop_p) > { > gdb_prompt_string = savestring (DEFAULT_PROMPT, strlen (DEFAULT_PROMPT)); > + > + /* This hook only works correctly when we are using the > + synchronous readline. */ > + rl_pre_input_hook = (Function *) gdb_rl_pre_input_hook; > } > else > { > @@ -1881,6 +1920,10 @@ > get_gdb_completer_word_break_characters (); > rl_completer_quote_characters = get_gdb_completer_quote_characters (); > 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 > async version is run. NOTE: this difference is going to ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: PATCH: operate-and-get-next 2001-10-10 17:53 ` Elena Zannoni @ 2001-10-13 10:24 ` Tom Tromey 2001-10-15 9:13 ` Elena Zannoni 0 siblings, 1 reply; 17+ messages in thread From: Tom Tromey @ 2001-10-13 10:24 UTC (permalink / raw) To: Elena Zannoni; +Cc: gdb-patches >>>>> "Elena" == Elena Zannoni <ezannoni@cygnus.com> writes: Elena> It looks to me that prompt_just_set is always 1, after it is Elena> set the very first time. So it doesn't really help. Quite right, sorry. Elena> Instead of having this global variable, could it be possible to Elena> play with installing and un-installing the hook itself? And Elena> then have rl_callback_read_char_wrapper do a check Ok, I implemented this. And it does make things cleaner. Thanks. I don't really like the hook name I chose but I was unable to think of a better one. I can rename it to whatever you like. The new patch is appended. It has one very ugly thing, namely the call to after_char_processing_hook in start_event_loop. Without this call, if the user entered a command that caused an error, then the C-o binding wouldn't work. For instance I tested it like this: output 1\n <- gives an error p 1 C-p C-p <- move up history C-o <- re-accept the error line This would fail to put `p 1' into the editing buffer. The reason is that the error causes us to unwind past the call to after_char_processing_hook. I tried calling the hook from a cleanup in rl_callback_read_char_wrapper, but that didn't work. The problem is that the error unwinding leaves the readline in a state that we can't anticipate -- the where_history() value is wrong, so the operate-and-get-next completion code doesn't work. What I'd really like is a hook which is called at the right point after the prompt is printed. It doesn't need to be called for every character (that is the conceptual problem, I think, with the appended). Unfortunately calling the hook in display_gdb_prompt won't work, for reasons mentioned in my first patch. I guess I could try to put an `after_prompt_hook' into start_event_loop. This might work ok. What would you think of that? Or is there another approach you'd like me to try? Thanks, Tom Index: ChangeLog from Tom Tromey <tromey@redhat.com> * 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. Index: event-loop.c =================================================================== RCS file: /cvs/src/src/gdb/event-loop.c,v retrieving revision 1.16 diff -u -r1.16 event-loop.c --- event-loop.c 2001/03/27 20:36:23 1.16 +++ event-loop.c 2001/10/13 17:11:13 @@ -402,6 +402,14 @@ interface specific, because interfaces can display the prompt in their own way. */ 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 whether display the prompt or not. */ } Index: event-top.c =================================================================== RCS file: /cvs/src/src/gdb/event-top.c,v retrieving revision 1.16 diff -u -r1.16 event-top.c --- event-top.c 2001/08/27 22:39:55 1.16 +++ event-top.c 2001/10/13 17:11:15 @@ -153,6 +153,10 @@ char *linebuffer_ptr; } readline_input_state; + +/* This hook is called by rl_callback_read_char_wrapper after each + character is processed. */ +void (*after_char_processing_hook) (); \f /* Wrapper function for calling into the readline library. The event @@ -162,6 +166,8 @@ rl_callback_read_char_wrapper (gdb_client_data client_data) { rl_callback_read_char (); + if (after_char_processing_hook) + (*after_char_processing_hook) (); } /* Initialize all the necessary variables, start the event loop, Index: event-top.h =================================================================== RCS file: /cvs/src/src/gdb/event-top.h,v retrieving revision 1.3 diff -u -r1.3 event-top.h --- event-top.h 2001/04/20 14:25:59 1.3 +++ event-top.h 2001/10/13 17:11:15 @@ -108,3 +108,4 @@ extern void (*call_readline) (void *); extern void (*input_handler) (char *); extern int input_fd; +extern void (*after_char_processing_hook) (void); Index: top.c =================================================================== RCS file: /cvs/src/src/gdb/top.c,v retrieving revision 1.45 diff -u -r1.45 top.c --- top.c 2001/09/07 21:33:08 1.45 +++ top.c 2001/10/13 17:11:17 @@ -1032,6 +1032,55 @@ #endif } \f +/* 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 () +{ + if (operate_saved_history != -1) + { + 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); +} +\f /* Read one line from the command input stream `instream' into the local static buffer `linebuffer' (whose current length is `linelength'). @@ -1881,6 +1930,10 @@ get_gdb_completer_word_break_characters (); rl_completer_quote_characters = get_gdb_completer_quote_characters (); 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 async version is run. NOTE: this difference is going to Index: doc/ChangeLog from Tom Tromey <tromey@redhat.com> * gdb.texinfo (Command Syntax): Document C-o binding. Index: doc/gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.51 diff -u -r1.51 gdb.texinfo --- doc/gdb.texinfo 2001/09/12 19:49:52 1.51 +++ doc/gdb.texinfo 2001/10/13 17:11:34 @@ -1190,6 +1190,13 @@ nothing. This is useful mainly in command files (@pxref{Command Files,,Command files}). +@cindex repeating command sequences +@kindex C-o @r{(operate-and-get-next)} +The @kbd{C-o} binding is useful for repeating a complex sequence of +commands. This command accepts the current line, like @kbd{RET}, and +then fetches the next line relative to the current line from the history +for editing. + @node Completion @section Command completion ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: PATCH: operate-and-get-next 2001-10-13 10:24 ` Tom Tromey @ 2001-10-15 9:13 ` Elena Zannoni [not found] ` <878zdibdxb.fsf@creche.redhat.com> 0 siblings, 1 reply; 17+ messages in thread From: Elena Zannoni @ 2001-10-15 9:13 UTC (permalink / raw) To: tromey; +Cc: Elena Zannoni, gdb-patches Tom Tromey writes: > >>>>> "Elena" == Elena Zannoni <ezannoni@cygnus.com> writes: > > Elena> It looks to me that prompt_just_set is always 1, after it is > Elena> set the very first time. So it doesn't really help. > > Quite right, sorry. > > Elena> Instead of having this global variable, could it be possible to > Elena> play with installing and un-installing the hook itself? And > Elena> then have rl_callback_read_char_wrapper do a check > > Ok, I implemented this. And it does make things cleaner. Thanks. > > I don't really like the hook name I chose but I was unable to think of > a better one. I can rename it to whatever you like. > > The new patch is appended. Ok, much claner. The only thing I wonder now about is, is it necessary to have operate_saved_history be checked in the gdb_rl_operate_and_get_next_completion () function. It looks like it would be always != -1 when that function is called, bacause of the way the hooks are installed. The hooks are not null while the var is not -1. It still needs to be a global, though. > > It has one very ugly thing, namely the call to > after_char_processing_hook in start_event_loop. Without this call, > if the user entered a command that caused an error, then the > C-o binding wouldn't work. > > For instance I tested it like this: > > output 1\n <- gives an error > p 1 > C-p C-p <- move up history > C-o <- re-accept the error line > > This would fail to put `p 1' into the editing buffer. > > The reason is that the error causes us to unwind past the call to > after_char_processing_hook. > > I tried calling the hook from a cleanup in rl_callback_read_char_wrapper, > but that didn't work. The problem is that the error unwinding leaves > the readline in a state that we can't anticipate -- the where_history() > value is wrong, so the operate-and-get-next completion code doesn't > work. > > What I'd really like is a hook which is called at the right point > after the prompt is printed. It doesn't need to be called for every > character (that is the conceptual problem, I think, with the appended). > Unfortunately calling the hook in display_gdb_prompt won't work, for > reasons mentioned in my first patch. > > I guess I could try to put an `after_prompt_hook' into start_event_loop. > This might work ok. What would you think of that? Or is there > another approach you'd like me to try? > I cannot think of another approach at the moment. But I agree that a different hook in start_event_loop could be used. The after_char_processing_hook seems a bit out of place there. Elena > Thanks, > Tom > > > Index: ChangeLog > from Tom Tromey <tromey@redhat.com> > > * 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. > > Index: event-loop.c > =================================================================== > RCS file: /cvs/src/src/gdb/event-loop.c,v > retrieving revision 1.16 > diff -u -r1.16 event-loop.c > --- event-loop.c 2001/03/27 20:36:23 1.16 > +++ event-loop.c 2001/10/13 17:11:13 > @@ -402,6 +402,14 @@ > interface specific, because interfaces can display the > prompt in their own way. */ > 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 > whether display the prompt or not. */ > } > Index: event-top.c > =================================================================== > RCS file: /cvs/src/src/gdb/event-top.c,v > retrieving revision 1.16 > diff -u -r1.16 event-top.c > --- event-top.c 2001/08/27 22:39:55 1.16 > +++ event-top.c 2001/10/13 17:11:15 > @@ -153,6 +153,10 @@ > char *linebuffer_ptr; > } > readline_input_state; > + > +/* This hook is called by rl_callback_read_char_wrapper after each > + character is processed. */ > +void (*after_char_processing_hook) (); > \f > > /* Wrapper function for calling into the readline library. The event > @@ -162,6 +166,8 @@ > rl_callback_read_char_wrapper (gdb_client_data client_data) > { > rl_callback_read_char (); > + if (after_char_processing_hook) > + (*after_char_processing_hook) (); > } > > /* Initialize all the necessary variables, start the event loop, > Index: event-top.h > =================================================================== > RCS file: /cvs/src/src/gdb/event-top.h,v > retrieving revision 1.3 > diff -u -r1.3 event-top.h > --- event-top.h 2001/04/20 14:25:59 1.3 > +++ event-top.h 2001/10/13 17:11:15 > @@ -108,3 +108,4 @@ > extern void (*call_readline) (void *); > extern void (*input_handler) (char *); > extern int input_fd; > +extern void (*after_char_processing_hook) (void); > Index: top.c > =================================================================== > RCS file: /cvs/src/src/gdb/top.c,v > retrieving revision 1.45 > diff -u -r1.45 top.c > --- top.c 2001/09/07 21:33:08 1.45 > +++ top.c 2001/10/13 17:11:17 > @@ -1032,6 +1032,55 @@ > #endif > } > \f > +/* 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 () > +{ > + if (operate_saved_history != -1) > + { > + 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); > +} > +\f > /* Read one line from the command input stream `instream' > into the local static buffer `linebuffer' (whose current length > is `linelength'). > @@ -1881,6 +1930,10 @@ > get_gdb_completer_word_break_characters (); > rl_completer_quote_characters = get_gdb_completer_quote_characters (); > 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 > async version is run. NOTE: this difference is going to > Index: doc/ChangeLog > from Tom Tromey <tromey@redhat.com> > > * gdb.texinfo (Command Syntax): Document C-o binding. > > Index: doc/gdb.texinfo > =================================================================== > RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v > retrieving revision 1.51 > diff -u -r1.51 gdb.texinfo > --- doc/gdb.texinfo 2001/09/12 19:49:52 1.51 > +++ doc/gdb.texinfo 2001/10/13 17:11:34 > @@ -1190,6 +1190,13 @@ > nothing. This is useful mainly in command files (@pxref{Command > Files,,Command files}). > > +@cindex repeating command sequences > +@kindex C-o @r{(operate-and-get-next)} > +The @kbd{C-o} binding is useful for repeating a complex sequence of > +commands. This command accepts the current line, like @kbd{RET}, and > +then fetches the next line relative to the current line from the history > +for editing. > + > @node Completion > @section Command completion > ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <878zdibdxb.fsf@creche.redhat.com>]
* Re: PATCH: operate-and-get-next [not found] ` <878zdibdxb.fsf@creche.redhat.com> @ 2001-11-08 16:01 ` Elena Zannoni 2001-11-08 18:22 ` Tom Tromey 0 siblings, 1 reply; 17+ messages in thread From: Elena Zannoni @ 2001-11-08 16:01 UTC (permalink / raw) To: tromey; +Cc: Elena Zannoni, gdb-patches Tom, you appended the wrong patch... :-) Can you resend? Thanks Elena Tom Tromey writes: > >>>>> "Elena" == Elena Zannoni <ezannoni@cygnus.com> writes: > > Elena> Ok, much claner. The only thing I wonder now about is, is it > Elena> necessary to have operate_saved_history be checked in the > Elena> gdb_rl_operate_and_get_next_completion () function. It looks > Elena> like it would be always != -1 when that function is called, > Elena> bacause of the way the hooks are installed. The hooks are not > Elena> null while the var is not -1. It still needs to be a global, > Elena> though. > > I agree. I've made this change. > > >> I guess I could try to put an `after_prompt_hook' into > >> start_event_loop. This might work ok. What would you think of > >> that? Or is there another approach you'd like me to try? > > Elena> I cannot think of another approach at the moment. But I agree > Elena> that a different hook in start_event_loop could be used. The > Elena> after_char_processing_hook seems a bit out of place there. > > I didn't do this. I couldn't think of a good name for the hook. Also > I couldn't think of any coherent description of the semantics of such > a hook. So my reasoning is that if we're going to have a hack we > might as well have just a single hook with a comment explaining the > hack. > > The very best fix, imho, would be to make rl_pre_input_hook work > correctly with the async readline. I believe this requires some work > in readline itself though. I don't have the time to do this, but I > could submit a PR for it if you'd like. > > Is this patch ok? > > Tom > > Index: ChangeLog > from Tom Tromey <tromey@redhat.com> > > * configure, config.in: Rebuilt. > * configure.in: Check for realpath. > * defs.h (gdb_realpath): Declare. > * symtab.h (partial_symtab): Added fullname field. > * source.c (openp): Use gdb_realpath. > (forget_cached_source_info): Clear full name of each partial > symtab. > * utils.c (gdb_realpath): New function. > * symtab.c (lookup_symtab): Removed. > (lookup_symtab_1): Renamed to lookup_symtab. > (lookup_symtab): Look for real path. > (lookup_partial_symtab): Likewise. > > Index: config.in > =================================================================== > RCS file: /cvs/src/src/gdb/config.in,v > retrieving revision 1.30 > diff -u -r1.30 config.in > --- config.in 2001/08/27 22:39:55 1.30 > +++ config.in 2001/11/07 04:53:26 > @@ -220,6 +220,9 @@ > /* Define if you have the putenv function. */ > #undef HAVE_PUTENV > > +/* Define if you have the realpath function. */ > +#undef HAVE_REALPATH > + > /* Define if you have the sbrk function. */ > #undef HAVE_SBRK > > Index: configure > =================================================================== > RCS file: /cvs/src/src/gdb/configure,v > retrieving revision 1.72 > diff -u -r1.72 configure > --- configure 2001/11/05 23:54:49 1.72 > +++ configure 2001/11/07 04:53:31 > @@ -3582,7 +3582,7 @@ > fi > > > -for ac_func in bcopy btowc bzero isascii poll sbrk setpgid setpgrp \ > +for ac_func in bcopy btowc bzero isascii poll realpath sbrk setpgid setpgrp \ > sigaction sigprocmask sigsetmask > do > echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 > Index: configure.in > =================================================================== > RCS file: /cvs/src/src/gdb/configure.in,v > retrieving revision 1.74 > diff -u -r1.74 configure.in > --- configure.in 2001/11/05 23:54:49 1.74 > +++ configure.in 2001/11/07 04:53:32 > @@ -131,7 +131,7 @@ > > AC_C_CONST > > -AC_CHECK_FUNCS(bcopy btowc bzero isascii poll sbrk setpgid setpgrp \ > +AC_CHECK_FUNCS(bcopy btowc bzero isascii poll realpath sbrk setpgid setpgrp \ > sigaction sigprocmask sigsetmask) > AC_FUNC_ALLOCA > AC_FUNC_VFORK > Index: defs.h > =================================================================== > RCS file: /cvs/src/src/gdb/defs.h,v > retrieving revision 1.64 > diff -u -r1.64 defs.h > --- defs.h 2001/10/17 20:35:31 1.64 > +++ defs.h 2001/11/07 04:53:33 > @@ -579,6 +579,8 @@ > extern CORE_ADDR host_pointer_to_address (void *ptr); > extern void *address_to_host_pointer (CORE_ADDR addr); > > +extern char *gdb_realpath (const char *); > + > /* From demangle.c */ > > extern void set_demangling_style (char *); > Index: source.c > =================================================================== > RCS file: /cvs/src/src/gdb/source.c,v > retrieving revision 1.20 > diff -u -r1.20 source.c > --- source.c 2001/07/17 06:41:47 1.20 > +++ source.c 2001/11/07 04:53:35 > @@ -234,6 +234,7 @@ > { > register struct symtab *s; > register struct objfile *objfile; > + struct partial_symtab *pst; > > for (objfile = object_files; objfile != NULL; objfile = objfile->next) > { > @@ -250,6 +251,15 @@ > s->fullname = NULL; > } > } > + > + ALL_OBJFILE_PSYMTABS (objfile, pst) > + { > + if (pst->fullname != NULL) > + { > + xfree (pst->fullname); > + pst->fullname = NULL; > + } > + } > } > } > > @@ -603,15 +613,17 @@ > if (fd < 0) > *filename_opened = NULL; > else if (IS_ABSOLUTE_PATH (filename)) > - *filename_opened = savestring (filename, strlen (filename)); > + *filename_opened = gdb_realpath (filename); > else > { > /* Beware the // my son, the Emacs barfs, the botch that catch... */ > > - *filename_opened = concat (current_directory, > + char *f = concat (current_directory, > IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1]) > ? "" : SLASH_STRING, > filename, NULL); > + *filename_opened = gdb_realpath (f); > + xfree (f); > } > } > /* OBSOLETE #ifdef MPW */ > Index: symtab.c > =================================================================== > RCS file: /cvs/src/src/gdb/symtab.c,v > retrieving revision 1.47 > diff -u -r1.47 symtab.c > --- symtab.c 2001/11/05 23:27:31 1.47 > +++ symtab.c 2001/11/07 04:53:38 > @@ -141,14 +141,36 @@ > register struct symtab *s; > register struct partial_symtab *ps; > register struct objfile *objfile; > + char *real_path = NULL; > > + if (IS_ABSOLUTE_PATH (name)) > + real_path = gdb_realpath (name); > + > got_symtab: > > /* First, search for an exact match */ > > ALL_SYMTABS (objfile, s) > + { > if (FILENAME_CMP (name, s->filename) == 0) > - return s; > + { > + xfree (real_path); > + return s; > + } > + /* If the user gave us an absolute path, try to find the file in > + this symtab and use its absolute path. */ > + if (real_path != NULL) > + { > + char *rp = symtab_to_filename (s); > + if (FILENAME_CMP (real_path, rp) == 0) > + { > + xfree (real_path); > + return s; > + } > + } > + } > + > + xfree (real_path); > > /* Now, search for a matching tail (only if name doesn't have any dirs) */ > > @@ -195,14 +217,34 @@ > { > register struct partial_symtab *pst; > register struct objfile *objfile; > + char *real_path = NULL; > + > + if (IS_ABSOLUTE_PATH (name)) > + real_path = gdb_realpath (name); > > ALL_PSYMTABS (objfile, pst) > { > if (FILENAME_CMP (name, pst->filename) == 0) > { > + xfree (real_path); > return (pst); > } > + /* If the user gave us an absolute path, try to find the file in > + this symtab and use its absolute path. */ > + if (real_path != NULL) > + { > + if (pst->fullname == NULL) > + source_full_path_of (pst->filename, &pst->fullname); > + if (pst->fullname != NULL > + && FILENAME_CMP (real_path, pst->fullname) == 0) > + { > + xfree (real_path); > + return pst; > + } > + } > } > + > + xfree (real_path); > > /* Now, search for a matching tail (only if name doesn't have any dirs) */ > > Index: symtab.h > =================================================================== > RCS file: /cvs/src/src/gdb/symtab.h,v > retrieving revision 1.25 > diff -u -r1.25 symtab.h > --- symtab.h 2001/10/12 23:51:29 1.25 > +++ symtab.h 2001/11/07 04:53:39 > @@ -967,6 +967,10 @@ > > char *filename; > > + /* Full path of the source file. NULL if not known. */ > + > + char *fullname; > + > /* Information about the object file from which symbols should be read. */ > > struct objfile *objfile; > Index: utils.c > =================================================================== > RCS file: /cvs/src/src/gdb/utils.c,v > retrieving revision 1.49 > diff -u -r1.49 utils.c > --- utils.c 2001/11/02 21:46:52 1.49 > +++ utils.c 2001/11/07 04:53:41 > @@ -2534,3 +2534,15 @@ > } > return addr; > } > + > +char * > +gdb_realpath (const char *filename) > +{ > +#ifdef HAVE_REALPATH > + char buf[PATH_MAX]; > + char *rp = realpath (filename, buf); > + return xstrdup (rp ? rp : filename); > +#else > + return xstrdup (filename); > +#endif > +} > Index: gdbtk/ChangeLog > from Tom Tromey <tromey@redhat.com> > > * generic/gdbtk-cmds.h (full_lookup_symtab): Don't declare. > * generic/gdbtk-cmds.c (gdb_find_file_command): Use > lookup_symtab. > (gdb_listfuncs): Likewise. > (gdb_loadfile): Likewise. > (full_lookup_symtab): Removed. > * generic/gdbtk-bp.c (gdb_find_bp_at_line): Use lookup_symtab. > (gdb_set_bp): Likewise. > > Index: gdbtk/generic/gdbtk-bp.c > =================================================================== > RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-bp.c,v > retrieving revision 1.13 > diff -u -r1.13 gdbtk-bp.c > --- gdbtk/generic/gdbtk-bp.c 2001/11/05 19:42:48 1.13 > +++ gdbtk/generic/gdbtk-bp.c 2001/11/07 04:53:44 > @@ -252,7 +252,7 @@ > return TCL_ERROR; > } > > - s = full_lookup_symtab (Tcl_GetStringFromObj (objv[1], NULL)); > + s = lookup_symtab (Tcl_GetStringFromObj (objv[1], NULL)); > if (s == NULL) > return TCL_ERROR; > > @@ -493,7 +493,7 @@ > return TCL_ERROR; > } > > - sal.symtab = full_lookup_symtab (Tcl_GetStringFromObj (objv[1], NULL)); > + sal.symtab = lookup_symtab (Tcl_GetStringFromObj (objv[1], NULL)); > if (sal.symtab == NULL) > return TCL_ERROR; > > Index: gdbtk/generic/gdbtk-cmds.c > =================================================================== > RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v > retrieving revision 1.43 > diff -u -r1.43 gdbtk-cmds.c > --- gdbtk/generic/gdbtk-cmds.c 2001/11/05 19:42:48 1.43 > +++ gdbtk/generic/gdbtk-cmds.c 2001/11/07 04:53:46 > @@ -1102,7 +1102,7 @@ > } > > filename = Tcl_GetStringFromObj (objv[1], NULL); > - st = full_lookup_symtab (filename); > + st = lookup_symtab (filename); > > /* We should always get a symtab. */ > if (!st) > @@ -1470,7 +1470,7 @@ > return TCL_ERROR; > } > > - symtab = full_lookup_symtab (Tcl_GetStringFromObj (objv[1], NULL)); > + symtab = lookup_symtab (Tcl_GetStringFromObj (objv[1], NULL)); > if (!symtab) > { > gdbtk_set_result (interp, "No such file (%s)", > @@ -2769,7 +2769,7 @@ > file = Tcl_GetStringFromObj (objv[2], NULL); > Tcl_GetBooleanFromObj (interp, objv[3], &linenumbers); > > - symtab = full_lookup_symtab (file); > + symtab = lookup_symtab (file); > if (!symtab) > { > gdbtk_set_result (interp, "File not found in symtab"); > @@ -2995,68 +2995,6 @@ > { > perror_with_name (args); > return 1; > -} > - > -/* The lookup_symtab() in symtab.c doesn't work correctly */ > -/* It will not work will full pathnames and if multiple */ > -/* source files have the same basename, it will return */ > -/* the first one instead of the correct one. */ > -/* symtab->fullname will be NULL if the file is not available. */ > - > -struct symtab * > -full_lookup_symtab (file) > - char *file; > -{ > - struct symtab *st; > - struct objfile *objfile; > - char *bfile, *fullname; > - struct partial_symtab *pt; > - > - if (!file) > - return NULL; > - > - /* first try a direct lookup */ > - st = lookup_symtab (file); > - if (st) > - { > - if (!st->fullname) > - symtab_to_filename (st); > - return st; > - } > - > - /* if the direct approach failed, try */ > - /* looking up the basename and checking */ > - /* all matches with the fullname */ > - bfile = basename (file); > - ALL_SYMTABS (objfile, st) > - { > - if (!strcmp (bfile, basename (st->filename))) > - { > - if (!st->fullname) > - fullname = symtab_to_filename (st); > - else > - fullname = st->fullname; > - > - if (!strcmp (file, fullname)) > - return st; > - } > - } > - > - /* still no luck? look at psymtabs */ > - ALL_PSYMTABS (objfile, pt) > - { > - if (!strcmp (bfile, basename (pt->filename))) > - { > - st = PSYMTAB_TO_SYMTAB (pt); > - if (st) > - { > - fullname = symtab_to_filename (st); > - if (!strcmp (file, fullname)) > - return st; > - } > - } > - } > - return NULL; > } > > /* Look for the function that contains PC and return the source > Index: gdbtk/generic/gdbtk-cmds.h > =================================================================== > RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.h,v > retrieving revision 1.2 > diff -u -r1.2 gdbtk-cmds.h > --- gdbtk/generic/gdbtk-cmds.h 2001/11/05 19:42:48 1.2 > +++ gdbtk/generic/gdbtk-cmds.h 2001/11/07 04:53:46 > @@ -38,10 +38,6 @@ > tcl. ALL tcl commands should be wrapped in this call. */ > extern int gdbtk_call_wrapper (ClientData, Tcl_Interp *, int, Tcl_Obj * CONST[]); > > -/* Like lookup_symtab but this deals with full pathnames and multiple > - source files with the same basename. FIXME: why doesn't gdb use this? */ > -extern struct symtab *full_lookup_symtab (char *file); > - > /* Returns the source (demangled) name for a function at PC. Returns empty string > if not found. Memory is owned by gdb. Do not free it. */ > extern char *pc_function_name (CORE_ADDR pc); ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: PATCH: operate-and-get-next 2001-11-08 16:01 ` Elena Zannoni @ 2001-11-08 18:22 ` Tom Tromey 2001-11-09 13:16 ` Eli Zaretskii 0 siblings, 1 reply; 17+ messages in thread From: Tom Tromey @ 2001-11-08 18:22 UTC (permalink / raw) To: Elena Zannoni; +Cc: gdb-patches >>>>> "Elena" == Elena Zannoni <ezannoni@cygnus.com> writes: Elena> Tom, you appended the wrong patch... :-) Sorry. I must have inserted the wrong file into the buffer. Elena> Can you resend? I've appended the correct patch. The comments in my previous message apply. Tom Index: ChangeLog from Tom Tromey <tromey@redhat.com> * 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. Index: event-loop.c =================================================================== RCS file: /cvs/src/src/gdb/event-loop.c,v retrieving revision 1.16 diff -u -r1.16 event-loop.c --- event-loop.c 2001/03/27 20:36:23 1.16 +++ event-loop.c 2001/11/07 18:39:50 @@ -402,6 +402,14 @@ interface specific, because interfaces can display the prompt in their own way. */ 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 whether display the prompt or not. */ } Index: event-top.c =================================================================== RCS file: /cvs/src/src/gdb/event-top.c,v retrieving revision 1.16 diff -u -r1.16 event-top.c --- event-top.c 2001/08/27 22:39:55 1.16 +++ event-top.c 2001/11/07 18:39:51 @@ -153,6 +153,10 @@ char *linebuffer_ptr; } readline_input_state; + +/* This hook is called by rl_callback_read_char_wrapper after each + character is processed. */ +void (*after_char_processing_hook) (); \f /* Wrapper function for calling into the readline library. The event @@ -162,6 +166,8 @@ rl_callback_read_char_wrapper (gdb_client_data client_data) { rl_callback_read_char (); + if (after_char_processing_hook) + (*after_char_processing_hook) (); } /* Initialize all the necessary variables, start the event loop, Index: event-top.h =================================================================== RCS file: /cvs/src/src/gdb/event-top.h,v retrieving revision 1.3 diff -u -r1.3 event-top.h --- event-top.h 2001/04/20 14:25:59 1.3 +++ event-top.h 2001/11/07 18:39:51 @@ -108,3 +108,4 @@ extern void (*call_readline) (void *); extern void (*input_handler) (char *); extern int input_fd; +extern void (*after_char_processing_hook) (void); Index: top.c =================================================================== RCS file: /cvs/src/src/gdb/top.c,v retrieving revision 1.47 diff -u -r1.47 top.c --- top.c 2001/10/21 19:43:41 1.47 +++ top.c 2001/11/07 18:39:53 @@ -1032,6 +1032,52 @@ #endif } \f +/* 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); +} +\f /* Read one line from the command input stream `instream' into the local static buffer `linebuffer' (whose current length is `linelength'). @@ -1876,6 +1922,10 @@ get_gdb_completer_word_break_characters (); rl_completer_quote_characters = get_gdb_completer_quote_characters (); 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 async version is run. NOTE: this difference is going to Index: doc/ChangeLog from Tom Tromey <tromey@redhat.com> * gdb.texinfo (Command Syntax): Document C-o binding. Index: doc/gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.54 diff -u -r1.54 gdb.texinfo --- doc/gdb.texinfo 2001/11/05 23:26:09 1.54 +++ doc/gdb.texinfo 2001/11/07 18:40:11 @@ -1190,6 +1190,13 @@ nothing. This is useful mainly in command files (@pxref{Command Files,,Command files}). +@cindex repeating command sequences +@kindex C-o @r{(operate-and-get-next)} +The @kbd{C-o} binding is useful for repeating a complex sequence of +commands. This command accepts the current line, like @kbd{RET}, and +then fetches the next line relative to the current line from the history +for editing. + @node Completion @section Command completion ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: PATCH: operate-and-get-next 2001-11-08 18:22 ` Tom Tromey @ 2001-11-09 13:16 ` Eli Zaretskii 0 siblings, 0 replies; 17+ messages in thread From: Eli Zaretskii @ 2001-11-09 13:16 UTC (permalink / raw) To: Tom Tromey; +Cc: Elena Zannoni, gdb-patches On 21 Nov 2001, Tom Tromey wrote: > Elena> Can you resend? > > I've appended the correct patch. I think I already approved the patch to gdb.texinfo, but in case you need it again, you have it. Thanks. > * gdb.texinfo (Command Syntax): Document C-o binding. > > Index: doc/gdb.texinfo > =================================================================== > RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v > retrieving revision 1.54 > diff -u -r1.54 gdb.texinfo > --- doc/gdb.texinfo 2001/11/05 23:26:09 1.54 > +++ doc/gdb.texinfo 2001/11/07 18:40:11 > @@ -1190,6 +1190,13 @@ > nothing. This is useful mainly in command files (@pxref{Command > Files,,Command files}). > > +@cindex repeating command sequences > +@kindex C-o @r{(operate-and-get-next)} > +The @kbd{C-o} binding is useful for repeating a complex sequence of > +commands. This command accepts the current line, like @kbd{RET}, and > +then fetches the next line relative to the current line from the history > +for editing. > + > @node Completion > @section Command completion > > ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <15362.64511.39505.586347@krustylu.cygnus.com>]
* Re: PATCH: operate-and-get-next [not found] <15362.64511.39505.586347@krustylu.cygnus.com> @ 2001-11-13 9:48 ` Elena Zannoni 2001-11-13 10:55 ` Tom Tromey 2001-11-26 18:36 ` Elena Zannoni 0 siblings, 2 replies; 17+ messages in thread From: Elena Zannoni @ 2001-11-13 9:48 UTC (permalink / raw) To: tromey; +Cc: gdb-patches Tom Tromey writes: > > > > >>>>> "Elena" == Elena Zannoni <ezannoni@cygnus.com> writes: > > Elena> Tom, you appended the wrong patch... :-) > > Sorry. I must have inserted the wrong file into the buffer. > > Elena> Can you resend? > > I've appended the correct patch. > The comments in my previous message apply. > > Tom Thanks Tom, yes, please commit it. Elena > > Index: ChangeLog > from Tom Tromey <tromey@redhat.com> > > * 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. > > Index: event-loop.c > =================================================================== > RCS file: /cvs/src/src/gdb/event-loop.c,v > retrieving revision 1.16 > diff -u -r1.16 event-loop.c > --- event-loop.c 2001/03/27 20:36:23 1.16 > +++ event-loop.c 2001/11/07 18:39:50 > @@ -402,6 +402,14 @@ > interface specific, because interfaces can display the > prompt in their own way. */ > 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 > whether display the prompt or not. */ > } > Index: event-top.c > =================================================================== > RCS file: /cvs/src/src/gdb/event-top.c,v > retrieving revision 1.16 > diff -u -r1.16 event-top.c > --- event-top.c 2001/08/27 22:39:55 1.16 > +++ event-top.c 2001/11/07 18:39:51 > @@ -153,6 +153,10 @@ > char *linebuffer_ptr; > } > 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 > @@ -162,6 +166,8 @@ > rl_callback_read_char_wrapper (gdb_client_data client_data) > { > rl_callback_read_char (); > + if (after_char_processing_hook) > + (*after_char_processing_hook) (); > } > > /* Initialize all the necessary variables, start the event loop, > Index: event-top.h > =================================================================== > RCS file: /cvs/src/src/gdb/event-top.h,v > retrieving revision 1.3 > diff -u -r1.3 event-top.h > --- event-top.h 2001/04/20 14:25:59 1.3 > +++ event-top.h 2001/11/07 18:39:51 > @@ -108,3 +108,4 @@ > extern void (*call_readline) (void *); > extern void (*input_handler) (char *); > extern int input_fd; > +extern void (*after_char_processing_hook) (void); > Index: top.c > =================================================================== > RCS file: /cvs/src/src/gdb/top.c,v > retrieving revision 1.47 > diff -u -r1.47 top.c > --- top.c 2001/10/21 19:43:41 1.47 > +++ top.c 2001/11/07 18:39:53 > @@ -1032,6 +1032,52 @@ > #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' > into the local static buffer `linebuffer' (whose current length > is `linelength'). > @@ -1876,6 +1922,10 @@ > get_gdb_completer_word_break_characters (); > rl_completer_quote_characters = get_gdb_completer_quote_characters (); > 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 > async version is run. NOTE: this difference is going to > Index: doc/ChangeLog > from Tom Tromey <tromey@redhat.com> > > * gdb.texinfo (Command Syntax): Document C-o binding. > > Index: doc/gdb.texinfo > =================================================================== > RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v > retrieving revision 1.54 > diff -u -r1.54 gdb.texinfo > --- doc/gdb.texinfo 2001/11/05 23:26:09 1.54 > +++ doc/gdb.texinfo 2001/11/07 18:40:11 > @@ -1190,6 +1190,13 @@ > nothing. This is useful mainly in command files (@pxref{Command > Files,,Command files}). > > +@cindex repeating command sequences > +@kindex C-o @r{(operate-and-get-next)} > +The @kbd{C-o} binding is useful for repeating a complex sequence of > +commands. This command accepts the current line, like @kbd{RET}, and > +then fetches the next line relative to the current line from the history > +for editing. > + > @node Completion > @section Command completion > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: PATCH: operate-and-get-next 2001-11-13 9:48 ` Elena Zannoni @ 2001-11-13 10:55 ` Tom Tromey 2001-11-26 19:26 ` Tom Tromey 2001-11-26 23:43 ` Eli Zaretskii 2001-11-26 18:36 ` Elena Zannoni 1 sibling, 2 replies; 17+ messages in thread From: Tom Tromey @ 2001-11-13 10:55 UTC (permalink / raw) To: Elena Zannoni; +Cc: gdb-patches >>>>> "Elena" == Elena Zannoni <ezannoni@cygnus.com> writes: Tom> [ operate-and-get-next ] Elena> Thanks Tom, yes, please commit it. Thanks, will do. I took the opportunity to sneak in a NEWS update, appended. If this was wrong or if you want me to change the text, please tell me and I'll do so. Tom Index: NEWS =================================================================== RCS file: /cvs/src/src/gdb/NEWS,v retrieving revision 1.37 diff -u -r1.37 NEWS --- NEWS 2001/11/27 03:09:44 1.37 +++ NEWS 2001/11/27 03:25:53 @@ -12,6 +12,10 @@ The new `--args' feature can be used to specify command-line arguments 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: * New native configurations ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: PATCH: operate-and-get-next 2001-11-13 10:55 ` Tom Tromey @ 2001-11-26 19:26 ` Tom Tromey 2001-11-26 23:43 ` Eli Zaretskii 1 sibling, 0 replies; 17+ messages in thread From: Tom Tromey @ 2001-11-26 19:26 UTC (permalink / raw) To: Elena Zannoni; +Cc: gdb-patches >>>>> "Elena" == Elena Zannoni <ezannoni@cygnus.com> writes: Tom> [ operate-and-get-next ] Elena> Thanks Tom, yes, please commit it. Thanks, will do. I took the opportunity to sneak in a NEWS update, appended. If this was wrong or if you want me to change the text, please tell me and I'll do so. Tom Index: NEWS =================================================================== RCS file: /cvs/src/src/gdb/NEWS,v retrieving revision 1.37 diff -u -r1.37 NEWS --- NEWS 2001/11/27 03:09:44 1.37 +++ NEWS 2001/11/27 03:25:53 @@ -12,6 +12,10 @@ The new `--args' feature can be used to specify command-line arguments 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: * New native configurations ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: PATCH: operate-and-get-next 2001-11-13 10:55 ` Tom Tromey 2001-11-26 19:26 ` Tom Tromey @ 2001-11-26 23:43 ` Eli Zaretskii 2001-11-14 11:56 ` Eli Zaretskii 1 sibling, 1 reply; 17+ messages in thread From: Eli Zaretskii @ 2001-11-26 23:43 UTC (permalink / raw) To: tromey; +Cc: ezannoni, gdb-patches > From: Tom Tromey <tromey@redhat.com> > Date: 26 Nov 2001 20:28:33 -0700 > > I took the opportunity to sneak in a NEWS update, Thanks! The text looks fine to me. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: PATCH: operate-and-get-next 2001-11-26 23:43 ` Eli Zaretskii @ 2001-11-14 11:56 ` Eli Zaretskii 0 siblings, 0 replies; 17+ messages in thread From: Eli Zaretskii @ 2001-11-14 11:56 UTC (permalink / raw) To: tromey; +Cc: ezannoni, gdb-patches > From: Tom Tromey <tromey@redhat.com> > Date: 26 Nov 2001 20:28:33 -0700 > > I took the opportunity to sneak in a NEWS update, Thanks! The text looks fine to me. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: PATCH: operate-and-get-next 2001-11-13 9:48 ` Elena Zannoni 2001-11-13 10:55 ` Tom Tromey @ 2001-11-26 18:36 ` Elena Zannoni 1 sibling, 0 replies; 17+ messages in thread From: Elena Zannoni @ 2001-11-26 18:36 UTC (permalink / raw) To: tromey; +Cc: gdb-patches Tom Tromey writes: > > > > >>>>> "Elena" == Elena Zannoni <ezannoni@cygnus.com> writes: > > Elena> Tom, you appended the wrong patch... :-) > > Sorry. I must have inserted the wrong file into the buffer. > > Elena> Can you resend? > > I've appended the correct patch. > The comments in my previous message apply. > > Tom Thanks Tom, yes, please commit it. Elena > > Index: ChangeLog > from Tom Tromey <tromey@redhat.com> > > * 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. > > Index: event-loop.c > =================================================================== > RCS file: /cvs/src/src/gdb/event-loop.c,v > retrieving revision 1.16 > diff -u -r1.16 event-loop.c > --- event-loop.c 2001/03/27 20:36:23 1.16 > +++ event-loop.c 2001/11/07 18:39:50 > @@ -402,6 +402,14 @@ > interface specific, because interfaces can display the > prompt in their own way. */ > 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 > whether display the prompt or not. */ > } > Index: event-top.c > =================================================================== > RCS file: /cvs/src/src/gdb/event-top.c,v > retrieving revision 1.16 > diff -u -r1.16 event-top.c > --- event-top.c 2001/08/27 22:39:55 1.16 > +++ event-top.c 2001/11/07 18:39:51 > @@ -153,6 +153,10 @@ > char *linebuffer_ptr; > } > 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 > @@ -162,6 +166,8 @@ > rl_callback_read_char_wrapper (gdb_client_data client_data) > { > rl_callback_read_char (); > + if (after_char_processing_hook) > + (*after_char_processing_hook) (); > } > > /* Initialize all the necessary variables, start the event loop, > Index: event-top.h > =================================================================== > RCS file: /cvs/src/src/gdb/event-top.h,v > retrieving revision 1.3 > diff -u -r1.3 event-top.h > --- event-top.h 2001/04/20 14:25:59 1.3 > +++ event-top.h 2001/11/07 18:39:51 > @@ -108,3 +108,4 @@ > extern void (*call_readline) (void *); > extern void (*input_handler) (char *); > extern int input_fd; > +extern void (*after_char_processing_hook) (void); > Index: top.c > =================================================================== > RCS file: /cvs/src/src/gdb/top.c,v > retrieving revision 1.47 > diff -u -r1.47 top.c > --- top.c 2001/10/21 19:43:41 1.47 > +++ top.c 2001/11/07 18:39:53 > @@ -1032,6 +1032,52 @@ > #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' > into the local static buffer `linebuffer' (whose current length > is `linelength'). > @@ -1876,6 +1922,10 @@ > get_gdb_completer_word_break_characters (); > rl_completer_quote_characters = get_gdb_completer_quote_characters (); > 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 > async version is run. NOTE: this difference is going to > Index: doc/ChangeLog > from Tom Tromey <tromey@redhat.com> > > * gdb.texinfo (Command Syntax): Document C-o binding. > > Index: doc/gdb.texinfo > =================================================================== > RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v > retrieving revision 1.54 > diff -u -r1.54 gdb.texinfo > --- doc/gdb.texinfo 2001/11/05 23:26:09 1.54 > +++ doc/gdb.texinfo 2001/11/07 18:40:11 > @@ -1190,6 +1190,13 @@ > nothing. This is useful mainly in command files (@pxref{Command > Files,,Command files}). > > +@cindex repeating command sequences > +@kindex C-o @r{(operate-and-get-next)} > +The @kbd{C-o} binding is useful for repeating a complex sequence of > +commands. This command accepts the current line, like @kbd{RET}, and > +then fetches the next line relative to the current line from the history > +for editing. > + > @node Completion > @section Command completion > ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2001-11-27 7:43 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-03 16:05 PATCH: operate-and-get-next Tom Tromey
2001-10-04 0:00 ` Eli Zaretskii
2001-10-04 18:16 ` Tom Tromey
2001-10-09 12:06 ` Eli Zaretskii
2001-10-09 12:48 ` Tom Tromey
2001-10-10 17:53 ` Elena Zannoni
2001-10-13 10:24 ` Tom Tromey
2001-10-15 9:13 ` Elena Zannoni
[not found] ` <878zdibdxb.fsf@creche.redhat.com>
2001-11-08 16:01 ` Elena Zannoni
2001-11-08 18:22 ` Tom Tromey
2001-11-09 13:16 ` Eli Zaretskii
[not found] <15362.64511.39505.586347@krustylu.cygnus.com>
2001-11-13 9:48 ` Elena Zannoni
2001-11-13 10:55 ` Tom Tromey
2001-11-26 19:26 ` Tom Tromey
2001-11-26 23:43 ` Eli Zaretskii
2001-11-14 11:56 ` Eli Zaretskii
2001-11-26 18:36 ` Elena Zannoni
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox