From patchwork Wed Mar 9 18:39:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 11288 Received: (qmail 9605 invoked by alias); 9 Mar 2016 18:39:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 9589 invoked by uid 89); 9 Mar 2016 18:39:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=cooked, pbs, pressed, clarity X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 09 Mar 2016 18:39:13 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 0D8B064D2A for ; Wed, 9 Mar 2016 18:39:12 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u29IdA3u001282; Wed, 9 Mar 2016 13:39:11 -0500 From: Pedro Alves Subject: Re: [PATCH 03/10] gdb_readline2 -> gdb_readline_callback_no_editing To: Sergio Durigan Junior References: <1455817236-13642-1-git-send-email-palves@redhat.com> <1455817236-13642-4-git-send-email-palves@redhat.com> <87h9h53cja.fsf@redhat.com> Cc: gdb-patches@sourceware.org Message-ID: <56E06DCE.60800@redhat.com> Date: Wed, 9 Mar 2016 18:39:10 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <87h9h53cja.fsf@redhat.com> On 02/18/2016 09:59 PM, Sergio Durigan Junior wrote: > On Thursday, February 18 2016, Pedro Alves wrote: > >> The "2" in "gdb_readline2" doesn't really convey much. Rename for clarity. > > Any reason to put the "callback" in the middle of the name? I usually > prefer to put it in the end. "gdb_readline_no_editing_callback" seems > better to me. No big reason, I've changed it. > Other than that, LGTM. Below's what I pushed. Thanks, Pedro Alves From c70061cf94691182484924c79cbbdd2203ef92d5 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 9 Mar 2016 18:24:59 +0000 Subject: [PATCH 03/10] gdb_readline2 -> gdb_readline_no_editing_callback The "2" in "gdb_readline2" doesn't really convey much. Rename for clarity. gdb/ChangeLog: 2016-03-09 Pedro Alves * event-top.c (gdb_readline2): Rename to ... (gdb_readline_no_editing_callback): ... this. (change_line_handler, stdin_event_handler) (gdb_setup_readline): Adjust. * event-top.h (gdb_readline2): Rename to ... (gdb_readline_no_editing_callback): ... this, and move closer to other readline-related declarations. * mi/mi-interp.c (mi_interpreter_resume): Adjust. --- gdb/ChangeLog | 11 +++++++++++ gdb/event-top.c | 36 ++++++++++++++++++------------------ gdb/event-top.h | 2 +- gdb/mi/mi-interp.c | 2 +- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d220a02..09b3826 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,16 @@ 2016-03-09 Pedro Alves + * event-top.c (gdb_readline2): Rename to ... + (gdb_readline_no_editing_callback): ... this. + (change_line_handler, stdin_event_handler) + (gdb_setup_readline): Adjust. + * event-top.h (gdb_readline2): Rename to ... + (gdb_readline_no_editing_callback): ... this, and move closer to + other readline-related declarations. + * mi/mi-interp.c (mi_interpreter_resume): Adjust. + +2016-03-09 Pedro Alves + * top.c (window_hook): Delete. (command_loop): Remove references to window_hook. diff --git a/gdb/event-top.c b/gdb/event-top.c index 2309cce..e3fa589 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -189,9 +189,9 @@ cli_command_loop (void *data) /* Change the function to be invoked every time there is a character ready on stdin. This is used when the user sets the editing off, therefore bypassing readline, and letting gdb handle the input - itself, via gdb_readline2. Also it is used in the opposite case in - which the user sets editing on again, by restoring readline - handling of the input. */ + itself, via gdb_readline_no_editing_callback. Also it is used in + the opposite case in which the user sets editing on again, by + restoring readline handling of the input. */ static void change_line_handler (void) { @@ -209,9 +209,9 @@ change_line_handler (void) } else { - /* Turn off editing by using gdb_readline2. */ + /* Turn off editing by using gdb_readline_no_editing_callback. */ gdb_rl_callback_handler_remove (); - call_readline = gdb_readline2; + call_readline = gdb_readline_no_editing_callback; /* Set up the command handler as well, in case we are called as first thing from .gdbinit. */ @@ -410,8 +410,9 @@ top_level_prompt (void) /* When there is an event ready on the stdin file desriptor, instead of calling readline directly throught the callback function, or - instead of calling gdb_readline2, give gdb a chance to detect - errors and do something. */ + instead of calling gdb_readline_no_editing_callback, give gdb a + chance to detect errors and do something. */ + void stdin_event_handler (int error, gdb_client_data client_data) { @@ -699,13 +700,11 @@ command_line_handler (char *rl) } /* Does reading of input from terminal w/o the editing features - provided by the readline library. */ + provided by the readline library. Calls the line input handler + once we have a whole input line. */ -/* NOTE: 1999-04-30 Asynchronous version of gdb_readline; gdb_readline - will become obsolete when the event loop is made the default - execution for gdb. */ void -gdb_readline2 (gdb_client_data client_data) +gdb_readline_no_editing_callback (gdb_client_data client_data) { int c; char *result; @@ -728,11 +727,12 @@ gdb_readline2 (gdb_client_data client_data) result = (char *) xmalloc (result_size); /* We still need the while loop here, even though it would seem - obvious to invoke gdb_readline2 at every character entered. If - not using the readline library, the terminal is in cooked mode, - which sends the characters all at once. Poll will notice that the - input fd has changed state only after enter is pressed. At this - point we still need to fetch all the chars entered. */ + obvious to invoke gdb_readline_no_editing_callback at every + character entered. If not using the readline library, the + terminal is in cooked mode, which sends the characters all at + once. Poll will notice that the input fd has changed state only + after enter is pressed. At this point we still need to fetch all + the chars entered. */ while (1) { @@ -1055,7 +1055,7 @@ gdb_setup_readline (void) else { async_command_editing_p = 0; - call_readline = gdb_readline2; + call_readline = gdb_readline_no_editing_callback; } /* When readline has read an end-of-line character, it passes the diff --git a/gdb/event-top.h b/gdb/event-top.h index 4f20770..f9bd7b9 100644 --- a/gdb/event-top.h +++ b/gdb/event-top.h @@ -44,7 +44,6 @@ extern void handle_stop_sig (int sig); #endif extern void handle_sigint (int sig); extern void handle_sigterm (int sig); -extern void gdb_readline2 (void *client_data); extern void async_request_quit (void *arg); extern void stdin_event_handler (int error, void *client_data); extern void async_disable_stdin (void); @@ -62,6 +61,7 @@ extern void (*input_handler) (char *); extern int input_fd; extern void (*after_char_processing_hook) (void); extern int call_stdin_event_handler_again_p; +extern void gdb_readline_no_editing_callback (void *client_data); /* Wrappers for rl_callback_handler_remove and rl_callback_handler_install that keep track of whether the callback diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 7f42367..d02012c 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -181,7 +181,7 @@ mi_interpreter_resume (void *data) /* These overwrite some of the initialization done in _intialize_event_loop. */ - call_readline = gdb_readline2; + call_readline = gdb_readline_no_editing_callback; input_handler = mi_execute_command_input_handler; async_command_editing_p = 0; /* FIXME: This is a total hack for now. PB's use of the MI