From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23036 invoked by alias); 21 Nov 2006 21:32:23 -0000 Received: (qmail 23021 invoked by uid 22791); 21 Nov 2006 21:32:22 -0000 X-Spam-Check-By: sourceware.org Received: from smtp108.sbc.mail.mud.yahoo.com (HELO smtp108.sbc.mail.mud.yahoo.com) (68.142.198.207) by sourceware.org (qpsmtpd/0.31) with SMTP; Tue, 21 Nov 2006 21:32:08 +0000 Received: (qmail 38883 invoked from network); 21 Nov 2006 21:32:07 -0000 Received: from unknown (HELO lucon.org) (hjjean@sbcglobal.net@71.146.103.173 with login) by smtp108.sbc.mail.mud.yahoo.com with SMTP; 21 Nov 2006 21:32:06 -0000 X-YMail-OSG: HLTB8kAVM1mKGRATnB.f.sRgjKVbjn3QgDJPM0dFwRiKFh6y6jEIbHLnplJX9UjaEn.IkuTX5eIOYPYm44g_eHN58mxoKLcvAX6GFkWWJZLv0u8f.ZKC6A-- Received: by lucon.org (Postfix, from userid 500) id AD95A9801D9; Tue, 21 Nov 2006 13:32:05 -0800 (PST) Date: Tue, 21 Nov 2006 21:32:00 -0000 From: "H. J. Lu" To: GDB Subject: PATCH: PR tui/2173: Arrow keys no longer works in breakpoint command list Message-ID: <20061121213205.GA13310@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i 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-11/txt/msg00234.txt.bz2 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. H.J. ---- 2006-11-21 H.J. Lu PR tui/2173 * top.c (gdb_readline_wrapper): Unset and reset RL_STATE_CALLBACK around readline if needed. --- gdb/top.c.arrow 2006-07-21 07:46:53.000000000 -0700 +++ gdb/top.c 2006-11-21 13:20:04.000000000 -0800 @@ -724,6 +724,9 @@ The filename in which to record the comm char * gdb_readline_wrapper (char *prompt) { + char *line; + int in_callback; + /* Set the hook that works in this case. */ if (after_char_processing_hook) { @@ -731,7 +734,19 @@ gdb_readline_wrapper (char *prompt) after_char_processing_hook = NULL; } - return readline (prompt); + /* When we call readline, we have to make sure that readline isn't in + the callback state. Otherwise, it will get really confused. + PR tui/2173. */ + in_callback = RL_ISSTATE (RL_STATE_CALLBACK); + if (in_callback) + RL_UNSETSTATE (RL_STATE_CALLBACK); + + line = readline (prompt); + + if (in_callback) + RL_SETSTATE (RL_STATE_CALLBACK); + + return line; }