Switch gdbserver to gdbsupport event loop

This changes gdbserver to use the gdbserver event loop, removing the
ancient fork.

gdbserver/ChangeLog
2020-04-13  Tom Tromey  <tom@tromey.com>

	* server.h (handle_serial_event, handle_target_event): Update.
	* server.c: Don't call initialize_event_loop.
	(keep_processing_events): New global.
	(handle_serial_event): Return void.  Set keep_processing_events.
	(handle_target_event): Return void.
	(start_event_loop): Move from event-loop.c.  Rewrite.
	* remote-utils.c (handle_accept_event): Return void.
	(reset_readchar): Use delete_timer.
	(process_remaining): Return void.
	(reschedule): Use create_timer.
	* event-loop.h: Remove.
	* event-loop.cc: Remove.
	* Makefile.in (OBS): Use gdbsupport/event-loop.o, not event-loop.o.
This commit is contained in:
Tom Tromey
2020-04-13 12:42:59 -06:00
committed by Tom Tromey
parent e487f9949a
commit 55d7aec85e
7 changed files with 60 additions and 628 deletions

View File

@@ -144,7 +144,7 @@ enable_async_notification (int fd)
#endif
}
static int
static void
handle_accept_event (int err, gdb_client_data client_data)
{
struct sockaddr_storage sockaddr;
@@ -213,8 +213,6 @@ handle_accept_event (int err, gdb_client_data client_data)
until GDB as selected all-stop/non-stop, and has queried the
threads' status ('?'). */
target_async (0);
return 0;
}
/* Prepare for a later connection to a remote debugger.
@@ -930,27 +928,21 @@ reset_readchar (void)
readchar_bufcnt = 0;
if (readchar_callback != NOT_SCHEDULED)
{
delete_callback_event (readchar_callback);
delete_timer (readchar_callback);
readchar_callback = NOT_SCHEDULED;
}
}
/* Process remaining data in readchar_buf. */
static int
static void
process_remaining (void *context)
{
int res;
/* This is a one-shot event. */
readchar_callback = NOT_SCHEDULED;
if (readchar_bufcnt > 0)
res = handle_serial_event (0, NULL);
else
res = 0;
return res;
handle_serial_event (0, NULL);
}
/* If there is still data in the buffer, queue another event to process it,
@@ -960,7 +952,7 @@ static void
reschedule (void)
{
if (readchar_bufcnt > 0 && readchar_callback == NOT_SCHEDULED)
readchar_callback = append_callback_event (process_remaining, NULL);
readchar_callback = create_timer (0, process_remaining, NULL);
}
/* Read a packet from the remote machine, with error checking,