summaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gdb/target.c b/gdb/target.c
index c0ce46ddde8..b53074a41c8 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -43,6 +43,8 @@
#include "agent.h"
#include "auxv.h"
#include "target-debug.h"
+#include "top.h"
+#include "event-top.h"
static void target_info (char *, int);
@@ -477,6 +479,8 @@ target_terminal_is_ours (void)
void
target_terminal_inferior (void)
{
+ struct ui *ui = current_ui;
+
/* A background resume (``run&'') should leave GDB in control of the
terminal. Use target_can_async_p, not target_is_async_p, since at
this point the target is not async yet. However, if sync_execution
@@ -484,6 +488,11 @@ target_terminal_inferior (void)
if (target_can_async_p () && !sync_execution)
return;
+ /* Always delete the current UI's input file handler, regardless of
+ terminal_state, because terminal_state is only valid for the main
+ UI. */
+ delete_file_handler (ui->input_fd);
+
if (terminal_state == terminal_is_inferior)
return;
@@ -503,6 +512,13 @@ target_terminal_inferior (void)
void
target_terminal_ours (void)
{
+ struct ui *ui = current_ui;
+
+ /* Always add the current UI's input file handler, regardless of
+ terminal_state, because terminal_state is only valid for the main
+ UI. */
+ add_file_handler (ui->input_fd, stdin_event_handler, ui);
+
if (terminal_state == terminal_is_ours)
return;