public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 03/10] gdb_readline2 -> gdb_readline_callback_no_editing
Date: Thu, 18 Feb 2016 17:40:00 -0000	[thread overview]
Message-ID: <1455817236-13642-4-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1455817236-13642-1-git-send-email-palves@redhat.com>

The "2" in "gdb_readline2" doesn't really convey much.  Rename for clarity.

gdb/ChangeLog:
2016-02-18  Pedro Alves  <palves@redhat.com>

	* event-top.c (gdb_readline2): Rename to ...
	(gdb_readline_callback_no_editing): ... this.
	(change_line_handler, stdin_event_handler)
	(gdb_setup_readline): Adjust.
	* event-top.h (gdb_readline2): Rename to ...
	(gdb_readline_callback_no_editing): ... this, and move closer to
	other readline-related declarations.
	* mi/mi-interp.c (mi_interpreter_resume): Adjust.
---
 gdb/event-top.c    | 36 ++++++++++++++++++------------------
 gdb/event-top.h    |  2 +-
 gdb/mi/mi-interp.c |  2 +-
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/gdb/event-top.c b/gdb/event-top.c
index 2309cce..35830119 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_callback_no_editing.  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_callback_no_editing.  */
       gdb_rl_callback_handler_remove ();
-      call_readline = gdb_readline2;
+      call_readline = gdb_readline_callback_no_editing;
 
       /* 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_callback_no_editing, 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_callback_no_editing (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_callback_no_editing 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_callback_no_editing;
     }
   
   /* 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..64c6fdf 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_callback_no_editing (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..80c8259 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_callback_no_editing;
   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
-- 
1.9.3

  parent reply	other threads:[~2016-02-18 17:40 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18 17:40 [PATCH 00/10] Command line input handling TLC Pedro Alves
2016-02-18 17:40 ` [PATCH 08/10] Use struct buffer in gdb_readline_callback_no_editing Pedro Alves
2016-02-18 22:18   ` Sergio Durigan Junior
2016-02-18 17:40 ` Pedro Alves [this message]
2016-02-18 21:59   ` [PATCH 03/10] gdb_readline2 -> gdb_readline_callback_no_editing Sergio Durigan Junior
2016-03-09 18:39     ` Pedro Alves
2016-02-18 17:40 ` [PATCH 09/10] Simplify saved_command_line handling Pedro Alves
2016-02-18 17:40 ` [PATCH 06/10] gdb_readline -> gdb_readline_no_editing Pedro Alves
2016-02-18 22:00   ` Sergio Durigan Junior
2016-02-18 17:40 ` [PATCH 07/10] Use struct buffer in gdb_readline_no_editing Pedro Alves
2016-02-18 22:16   ` Sergio Durigan Junior
2016-03-09 18:40     ` Pedro Alves
2016-02-19 15:25   ` Simon Marchi
2016-02-22 14:06   ` Yao Qi
2016-02-18 17:40 ` [PATCH 02/10] Garbage collect window_hook Pedro Alves
2016-02-18 21:55   ` Sergio Durigan Junior
2016-02-18 17:40 ` [PATCH 01/10] Test issuing a command split in multiple lines with continuation chars Pedro Alves
2016-02-18 21:53   ` Sergio Durigan Junior
2016-02-24 12:40   ` Luis Machado
2016-03-09 18:38     ` Pedro Alves
2016-02-18 17:46 ` [PATCH 05/10] Update prompt_for_continue comments Pedro Alves
2016-02-22 14:02   ` Yao Qi
2016-03-09 18:39     ` Pedro Alves
2016-02-18 17:49 ` [PATCH 04/10] Eliminate async_annotation_suffix Pedro Alves
2016-02-18 17:49 ` [PATCH 10/10] Command line input handling TLC Pedro Alves
2016-02-19 16:01   ` Simon Marchi
2016-03-09 18:41     ` Pedro Alves
2016-02-24 12:41   ` Luis Machado
2016-02-18 22:57 ` [PATCH 00/10] " Sergio Durigan Junior
2016-02-19 16:04   ` Simon Marchi
2016-02-23  8:51 ` Yao Qi
2016-03-09 18:43 ` Pedro Alves

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=1455817236-13642-4-git-send-email-palves@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).