From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31814 invoked by alias); 2 Dec 2006 18:44:03 -0000 Received: (qmail 31784 invoked by uid 22791); 2 Dec 2006 18:44:00 -0000 X-Spam-Check-By: sourceware.org Received: from smtp104.sbc.mail.mud.yahoo.com (HELO smtp104.sbc.mail.mud.yahoo.com) (68.142.198.203) by sourceware.org (qpsmtpd/0.31) with SMTP; Sat, 02 Dec 2006 18:43:49 +0000 Received: (qmail 43615 invoked from network); 2 Dec 2006 18:43:45 -0000 Received: from unknown (HELO lucon.org) (hjjean@sbcglobal.net@71.146.122.56 with login) by smtp104.sbc.mail.mud.yahoo.com with SMTP; 2 Dec 2006 18:43:45 -0000 X-YMail-OSG: l.N1DHMVM1neRtUD33ISGnqrhxXahHXpLYOvmK1pdxM7Tb00yl.zh3PU8_jQqOyCHX28tGR3nMR9dMvulbPQ4d7wltd6Ob3_.IvD0YYtRoxg83KZpUdF4A-- Received: by lucon.org (Postfix, from userid 500) id 32E5346EEAA; Sat, 2 Dec 2006 10:43:44 -0800 (PST) Date: Sat, 02 Dec 2006 18:44:00 -0000 From: "H. J. Lu" To: GDB , 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 Message-ID: <20061202184344.GA2197@lucon.org> References: <20061121213205.GA13310@lucon.org> <20061128164658.GB20882@nevyn.them.org> <20061128165844.GA13667@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20061128165844.GA13667@lucon.org> User-Agent: Mutt/1.4.2.2i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-12/txt/msg00009.txt.bz2 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 > works with it. H.J. ---- 2006-12-02 H.J. Lu Jan Kratochvil 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); }