[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-readline] Re: PATCH: PR tui/2173: Arrow keys no longer works in bre
H. J. Lu
[Bug-readline] Re: PATCH: PR tui/2173: Arrow keys no longer works in breakpoint command list
Sat, 2 Dec 2006 10:43:44 -0800
On Tue, Nov 28, 2006 at 08:58:44AM -0800, H. J. Lu wrote:
> On Tue, Nov 28, 2006 at 11:46:58AM -0500, Daniel Jacobowitz wrote:
> > On Tue, Nov 21, 2006 at 01:32:05PM -0800, H. J. Lu wrote:
> > > The problem is callback in readline 5.1 is changed. When gdb readline
> > > callback calls readline (), readline is really confused since although
> > > it is called from gdb callback, it isn't really in callback state. This
> > > kludge seems to work for me.
> > I'm pretty sure this isn't right. I got as far as figuring out that we
> > should be calling rl_callback_handler_install and
> > rl_callback_handler_remove at different times, always removing the
> > handler before calling readline recursively, but I couldn't quite work
> > out the right conditions.
> I assume by "this isn't right", you mean my patch may break something.
> Do you have a testcase? It may get into readline:
Here is the updated patch for readline.
(gdb) define foo
works with it.
2006-12-02 H.J. Lu <address@hidden>
Jan Kratochvil <address@hidden>
* readline.c (readline): Unset and reset RL_STATE_CALLBACK if
RCS file: /cvs/src/src/readline/readline.c,v
retrieving revision 1.10
diff -u -p -r1.10 readline.c
--- readline/readline.c 5 May 2006 18:26:12 -0000 1.10
+++ readline/readline.c 22 Nov 2006 19:40:17 -0000
@@ -295,6 +295,7 @@ readline (prompt)
const char *prompt;
+ int in_callback;
/* If we are at EOF return a NULL string. */
if (rl_pending_input == EOF)
@@ -303,6 +304,13 @@ readline (prompt)
return ((char *)NULL);
+ /* When we call readline, we have to make sure that readline isn't in
+ the callback state. Otherwise, it will get really confused.
+ PR gdb tui/2173. */
+ in_callback = RL_ISSTATE (RL_STATE_CALLBACK);
+ if (in_callback)
+ RL_UNSETSTATE (RL_STATE_CALLBACK);
@@ -321,6 +329,9 @@ readline (prompt)
+ if (in_callback)
+ RL_SETSTATE (RL_STATE_CALLBACK);
[Bug-readline] Re: PATCH: PR tui/2173: Arrow keys no longer works in breakpoint command list, Daniel Jacobowitz, 2006/12/04