summaryrefslogtreecommitdiffstats
path: root/gdb/event-top.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-06-28 16:06:02 +0000
committerJason Molenda <jmolenda@apple.com>1999-06-28 16:06:02 +0000
commit085dd6e638eca9d348100c8f0e8cae04e20d58a1 (patch)
tree1e740197cdfedb994222a003ea531ec2febaf173 /gdb/event-top.c
parent303f629d619e7bf37b97c2af6f72aba488669044 (diff)
downloadppe42-binutils-085dd6e638eca9d348100c8f0e8cae04e20d58a1.tar.gz
ppe42-binutils-085dd6e638eca9d348100c8f0e8cae04e20d58a1.zip
import gdb-1999-06-28 snapshot
Diffstat (limited to 'gdb/event-top.c')
-rw-r--r--gdb/event-top.c54
1 files changed, 22 insertions, 32 deletions
diff --git a/gdb/event-top.c b/gdb/event-top.c
index f658b715d5..223e670c70 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -20,9 +20,6 @@
#include "defs.h"
#include "top.h"
-#ifdef HAVE_POLL
-#include <poll.h>
-#endif
#include "inferior.h"
#include "terminal.h" /* for job_control*/
#include <signal.h>
@@ -38,7 +35,7 @@
extern void _initialize_event_loop PARAMS ((void));
static void command_line_handler PARAMS ((char *));
-static void gdb_readline2 PARAMS ((void));
+void gdb_readline2 PARAMS ((void));
static void pop_prompt PARAMS ((void));
static void push_prompt PARAMS ((char *, char *, char *));
static void change_line_handler PARAMS ((void));
@@ -160,9 +157,9 @@ readline_input_state;
/* Initialize all the necessary variables, start the event loop,
- register readline, and stdin. */
+ register readline, and stdin, start the loop. */
void
-start_event_loop ()
+cli_command_loop ()
{
int length;
char *a_prompt;
@@ -185,16 +182,8 @@ start_event_loop ()
else
display_gdb_prompt (0);
- /* Loop until there is something to do. This is the entry point to
- the event loop engine. gdb_do_one_event will process one event
- for each invocation. It always returns 1, unless there are no
- more event sources registered. In this case it returns 0. */
- while (gdb_do_one_event () != 0)
- ;
-
- /* We are done with the event loop. There are no more event sources
- to listen to. So we exit GDB. */
- return;
+ /* Now it's time to start the event loop. */
+ start_event_loop ();
}
/* Change the function to be invoked every time there is a character
@@ -227,14 +216,13 @@ change_line_handler ()
input file descriptor, we need to create a new event source,
corresponding to the same fd, but with a new event handler
function. */
+ /* NOTE: this operates on input_fd, not instream. If we are reading
+ commands from a file, instream will point to the file. However in
+ async mode, we always read commands from a file with editing
+ off. This means that the 'set editing on/off' will have effect
+ only on the interactive session. */
delete_file_handler (input_fd);
-#ifdef HAVE_POLL
- create_file_handler (input_fd, POLLIN,
- (file_handler_func *) call_readline, 0);
-#else
- create_file_handler (input_fd, GDB_READABLE,
- (file_handler_func *) call_readline, 0);
-#endif
+ add_file_handler (input_fd, (file_handler_func *) call_readline, 0);
}
/* Displays the prompt. The prompt that is displayed is the current
@@ -682,7 +670,7 @@ command_line_handler (rl)
/* 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. */
-static void
+void
gdb_readline2 ()
{
int c;
@@ -1001,9 +989,12 @@ _initialize_event_loop ()
rl_instream = instream;
/* Get a file descriptor for the input stream, so that we can
- register it with the event loop. */
+ 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
@@ -1011,13 +1002,12 @@ _initialize_event_loop ()
the target program (inferior), but that must be registered
only when it actually exists (I.e. after we say 'run' or
after we connect to a remote target. */
-#ifdef HAVE_POLL
- create_file_handler (input_fd, POLLIN,
- (file_handler_func *) call_readline, 0);
-#else
- create_file_handler (input_fd, GDB_READABLE,
- (file_handler_func *) call_readline, 0);
-#endif
+ add_file_handler (input_fd, (file_handler_func *) call_readline, 0);
+
+ /* Tell gdb that we will be using the readline library. This
+ could be overwritten by a command in .gdbinit like 'set
+ editing on' or 'off'. */
+ async_command_editing_p = 1;
}
}
OpenPOWER on IntegriCloud