This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC 11/17] Implement event-loop glue for gdbserver
- From: Tom Tromey <tom at tromey dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tom at tromey dot com>
- Date: Sun, 24 Feb 2019 09:51:47 -0700
- Subject: [RFC 11/17] Implement event-loop glue for gdbserver
- References: <20190224165153.5062-1-tom@tromey.com>
event-loop.c requires the client to provide some functions. This
patch implements these functions for gdbserver.
gdb/gdbserver/ChangeLog
2019-02-24 Tom Tromey <tom@tromey.com>
* server.c (handle_event_loop_exception)
(invoke_async_signal_handlers, check_async_event_handlers)
(flush_streams, gdb_select): New functions.
---
gdb/gdbserver/ChangeLog | 6 ++++++
gdb/gdbserver/server.c | 44 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+)
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index e960c10d402..1b2b86813fb 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -4503,6 +4503,50 @@ handle_target_event (int err, gdb_client_data client_data)
return 0;
}
+/* See common/event-loop.h. */
+
+void
+handle_event_loop_exception (const gdb_exception &ex)
+{
+ /* gdbserver relies on any exception in getpkt escaping from the
+ event loop, to be caught in captured_main. */
+ throw_exception (ex);
+}
+
+/* See common/event-loop.h. */
+
+int
+invoke_async_signal_handlers ()
+{
+ return 0;
+}
+
+/* See common/event-loop.h. */
+
+int
+check_async_event_handlers ()
+{
+ return 0;
+}
+
+/* See common/errors.h */
+
+void
+flush_streams ()
+{
+ fflush (stdout);
+ fflush (stderr);
+}
+
+/* See common/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
{
--
2.17.2