Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: GDB <gdb-patches@sources.redhat.com>, jkratoch@redhat.com
Cc: bug-readline@gnu.org, chet.ramey@case.edu
Subject: Re: PATCH: PR tui/2173: Arrow keys no longer works in breakpoint command list
Date: Sat, 02 Dec 2006 18:44:00 -0000	[thread overview]
Message-ID: <20061202184344.GA2197@lucon.org> (raw)
In-Reply-To: <20061128165844.GA13667@lucon.org>

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:
> 
> http://lists.gnu.org/archive/html/bug-readline/2006-11/msg00011.html
> 
> 

Here is the updated patch for readline.

(gdb) define foo
> <Control-C>

works with it.


H.J.
----
2006-12-02  H.J. Lu  <hongjiu.lu@intel.com>
	    Jan Kratochvil <jkratoch@redhat.com>

	PR tui/2173
	* readline.c (readline): Unset and reset RL_STATE_CALLBACK if
	needed.

Index: readline/readline.c
===================================================================
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;
 {
   char *value;
+  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);
+
   rl_set_prompt (prompt);
 
   rl_initialize ();
@@ -321,6 +329,9 @@ readline (prompt)
   rl_clear_signals ();
 #endif
 
+  if (in_callback)
+    RL_SETSTATE (RL_STATE_CALLBACK);
+
   return (value);
 }
 


  parent reply	other threads:[~2006-12-02 18:44 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-21 21:32 H. J. Lu
2006-11-28 16:53 ` Daniel Jacobowitz
2006-11-28 17:09   ` H. J. Lu
2006-11-28 17:15     ` Daniel Jacobowitz
2006-12-02 18:44     ` H. J. Lu [this message]
2006-12-02 18:55       ` Daniel Jacobowitz
2006-12-02 18:59         ` Joel Brobecker
2006-12-02 19:17         ` Chet Ramey
2006-12-02 19:09       ` Chet Ramey
2006-12-02 22:15         ` H. J. Lu
2006-12-02 23:06           ` Daniel Jacobowitz
2006-12-03  5:25           ` Chet Ramey
2006-12-17 23:46             ` Jan Kratochvil
2006-12-18 20:09               ` Chet Ramey
2006-12-19 23:20                 ` Jan Kratochvil
2006-12-26  6:00                   ` Jan Kratochvil
2007-01-03 21:46                     ` Daniel Jacobowitz
2007-01-03 21:47                       ` Daniel Jacobowitz
     [not found] <18019.18081.448928.93993@kahikatea.snap.net.nz>
     [not found] ` <20070604010633.GA927@caradoc.them.org>
2007-06-05 12:56   ` Nick Roberts
2007-06-05 13:27     ` Daniel Jacobowitz
2007-06-24 15:46       ` Daniel Jacobowitz
2007-06-24 21:55         ` Nick Roberts
2007-07-01 22:38           ` Daniel Jacobowitz
2007-07-03  1:28             ` Nick Roberts
2007-07-03  3:03               ` Daniel Jacobowitz
2007-07-03 15:39               ` Daniel Jacobowitz
2007-06-26 13:49   ` Jan Kratochvil
2007-06-26 14:33     ` Daniel Jacobowitz
2008-03-21 20:34     ` Jan Kratochvil
2008-03-21 21:22       ` Daniel Jacobowitz
2008-03-21 21:26         ` Jan Kratochvil
2008-03-21 21:41           ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061202184344.GA2197@lucon.org \
    --to=hjl@lucon.org \
    --cc=bug-readline@gnu.org \
    --cc=chet.ramey@case.edu \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jkratoch@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox