[v2,09/12] Implement event-loop glue for gdbserver

Message ID 20200314185158.7816-10-tom@tromey.com
State New
Headers show
Series
  • Merge event loop implementations
Related show

Commit Message

Tom Tromey March 14, 2020, 6:51 p.m.
event-loop.c requires the client to provide some functions.  This
patch implements these functions for gdbserver.

gdbserver/ChangeLog
2020-03-14  Tom Tromey  <tom@tromey.com>

	* server.c (invoke_async_signal_handlers)
	(check_async_event_handlers, flush_streams, gdb_select): New
	functions.
---
 gdbserver/ChangeLog |  6 ++++++
 gdbserver/server.cc | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

-- 
2.17.2

Patch

diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index 43962adc86c..ac7a7fd75aa 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -47,6 +47,7 @@ 
 
 #include "gdbsupport/selftest.h"
 #include "gdbsupport/scope-exit.h"
+#include "gdbsupport/gdb_select.h"
 
 #define require_running_or_return(BUF)		\
   if (!target_running ())			\
@@ -4477,6 +4478,40 @@  handle_target_event (int err, gdb_client_data client_data)
   return 0;
 }
 
+/* See gdbsupport/event-loop.h.  */
+
+int
+invoke_async_signal_handlers ()
+{
+  return 0;
+}
+
+/* See gdbsupport/event-loop.h.  */
+
+int
+check_async_event_handlers ()
+{
+  return 0;
+}
+
+/* See gdbsupport/errors.h  */
+
+void
+flush_streams ()
+{
+  fflush (stdout);
+  fflush (stderr);
+}
+
+/* See gdbsupport/gdb_select.h.  */
+
+int
+gdb_select (int n, fd_set *readfds, fd_set *writefds,
+	    fd_set *exceptfds, struct timeval *timeout)
+{
+  return select (n, readfds, writefds, exceptfds, timeout);
+}
+
 #if GDB_SELF_TEST
 namespace selftests
 {