[PATCH] event-top.c

Elena Zannoni ezannoni@redhat.com
Wed Oct 2 18:21:00 GMT 2002


This patch reorganizes a bit the _initialize_event_loop function.  It
comes from Keith's branch. Hence the attribution to JimI.  It is
essentially a no-op, but the split is needed for the interpreters.

Elena

2002-10-02  Elena Zannoni  <ezannoni@redhat.com>

	From Jim Ingham  <jingham@apple.com>:	
	* event-top.c (gdb_setup_readline): New function. Code moved from
	_initialize_event_loop().
	(_initialize_event_loop): Call gdb_setup_readline().

Index: event-top.c
===================================================================
RCS file: /cvs/uberbaum/gdb/event-top.c,v
retrieving revision 1.22
diff -u -p -r1.22 event-top.c
--- event-top.c	3 Jul 2002 20:27:12 -0000	1.22
+++ event-top.c	3 Oct 2002 01:15:43 -0000
@@ -1117,8 +1117,12 @@ set_async_prompt (char *args, int from_t
    interface, i.e. via a callback function (rl_callback_read_char),
    and hook up instream to the event loop. */
 void
-_initialize_event_loop (void)
+gdb_setup_readline (void)
 {
+  /* This function is a noop for the sync case.  The assumption is that
+     the sync setup is ALL done in gdb_init, and we would only mess it up
+     here.  The sync stuff should really go away over time. */
+
   if (event_loop_p)
     {
       /* If the input stream is connected to a terminal, turn on
@@ -1153,9 +1157,6 @@ _initialize_event_loop (void)
          register it with the event loop. */
       input_fd = fileno (instream);
 
-      /* Tell gdb to use the cli_command_loop as the main loop. */
-      command_loop_hook = cli_command_loop;
-
       /* Now we need to create the event sources for the input file
          descriptor. */
       /* At this point in time, this is the only event source that we
@@ -1164,5 +1165,17 @@ _initialize_event_loop (void)
          only when it actually exists (I.e. after we say 'run' or
          after we connect to a remote target. */
       add_file_handler (input_fd, stdin_event_handler, 0);
+    }
+}
+
+void
+_initialize_event_loop (void)
+{
+  gdb_setup_readline ();
+
+  if (event_loop_p && command_loop_hook == NULL)
+    {
+      /* Tell gdb to use the cli_command_loop as the main loop. */
+      command_loop_hook = cli_command_loop;
     }
 }
       



More information about the Gdb-patches mailing list