aboutsummaryrefslogtreecommitdiff
path: root/gdb/event-top.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-08-30 11:30:13 -0600
committerTom Tromey <tromey@adacore.com>2022-08-31 10:42:51 -0600
commit51cacdb50fd2ac2240172a63140e56c0adb41742 (patch)
tree836cba445806d7e9b152d31615b0a79bc423476e /gdb/event-top.c
parent4749b84b51bcaa59acfb8bda5d9e134432528cf9 (diff)
downloadfsf-binutils-gdb-51cacdb50fd2ac2240172a63140e56c0adb41742.zip
fsf-binutils-gdb-51cacdb50fd2ac2240172a63140e56c0adb41742.tar.gz
fsf-binutils-gdb-51cacdb50fd2ac2240172a63140e56c0adb41742.tar.bz2
Let ui::input_fd be -1
This changes gdb so that, if ui::input_fd is set to -1, then it will not be registered with the event loop. This is useful for the DAP support code I wrote, but as it turns out to also be useful to Insight, it seems best to check it in separately.
Diffstat (limited to 'gdb/event-top.c')
-rw-r--r--gdb/event-top.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 02b3786..4547d61 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -533,8 +533,9 @@ stdin_event_handler (int error, gdb_client_data client_data)
void
ui::register_file_handler ()
{
- add_file_handler (input_fd, stdin_event_handler, this,
- string_printf ("ui-%d", num), true);
+ if (input_fd != -1)
+ add_file_handler (input_fd, stdin_event_handler, this,
+ string_printf ("ui-%d", num), true);
}
/* See top.h. */
@@ -542,7 +543,8 @@ ui::register_file_handler ()
void
ui::unregister_file_handler ()
{
- delete_file_handler (input_fd);
+ if (input_fd != -1)
+ delete_file_handler (input_fd);
}
/* Re-enable stdin after the end of an execution command in