summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/event-top.c8
-rw-r--r--gdb/top.h3
2 files changed, 7 insertions, 4 deletions
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 02b3786320f..4547d614522 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
diff --git a/gdb/top.h b/gdb/top.h
index 5c1db84b2ce..9ea07262c39 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -118,7 +118,8 @@ struct ui
FILE *errstream;
/* The file descriptor for the input stream, so that we can register
- it with the event loop. */
+ it with the event loop. This can be set to -1 to prevent this
+ registration. */
int input_fd;
/* Whether ISATTY returns true on input_fd. Cached here because