aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-06-21 01:11:49 +0100
committerPedro Alves <palves@redhat.com>2016-06-21 01:11:49 +0100
commit215d3118fe5f120c1deba66943329e30073ed780 (patch)
tree53add6d05139ae62143ebddf7386c76391ba59fe
parentc61db772bf5dc21bf8e0db9acfa8796804f945ab (diff)
downloadgdb-215d3118fe5f120c1deba66943329e30073ed780.zip
gdb-215d3118fe5f120c1deba66943329e30073ed780.tar.gz
gdb-215d3118fe5f120c1deba66943329e30073ed780.tar.bz2
Make target_terminal_inferior/ours almost nops on non-main UIs
Since we always run the inferior in the main console (unless "set inferior-tty" is in effect), when some UI other than the main one calls target_terminal_inferior/target_terminal_inferior, then we only register/unregister the UI's input from the event loop, but leave the main UI's terminal settings as is. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * target.c (target_terminal_inferior): Bail out after unregistering input_fd if not on the main UI. (target_terminal_ours): Bail out after registering input_fd if not on the main UI. (target_terminal_ours_for_output): Bail out if not on the main UI.
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/target.c18
2 files changed, 26 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d87a51b..4aa0b3c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2016-06-21 Pedro Alves <palves@redhat.com>
+ * target.c (target_terminal_inferior): Bail out after
+ unregistering input_fd if not on the main UI.
+ (target_terminal_ours): Bail out after registering input_fd if not
+ on the main UI.
+ (target_terminal_ours_for_output): Bail out if not on the main UI.
+
+2016-06-21 Pedro Alves <palves@redhat.com>
+
* event-top.c (restore_ui_cleanup): Make extern.
* infrun.c (fetch_inferior_event): Always switch to the main UI.
* top.h (restore_ui_cleanup): Declare.
diff --git a/gdb/target.c b/gdb/target.c
index b53074a..8a83fba 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -493,6 +493,14 @@ target_terminal_inferior (void)
UI. */
delete_file_handler (ui->input_fd);
+ /* Since we always run the inferior in the main console (unless "set
+ inferior-tty" is in effect), when some UI other than the main one
+ calls target_terminal_inferior/target_terminal_inferior, then we
+ only register/unregister the UI's input from the event loop, but
+ leave the main UI's terminal settings as is. */
+ if (ui != main_ui)
+ return;
+
if (terminal_state == terminal_is_inferior)
return;
@@ -519,6 +527,10 @@ target_terminal_ours (void)
UI. */
add_file_handler (ui->input_fd, stdin_event_handler, ui);
+ /* See target_terminal_inferior. */
+ if (ui != main_ui)
+ return;
+
if (terminal_state == terminal_is_ours)
return;
@@ -531,6 +543,12 @@ target_terminal_ours (void)
void
target_terminal_ours_for_output (void)
{
+ struct ui *ui = current_ui;
+
+ /* See target_terminal_inferior. */
+ if (ui != main_ui)
+ return;
+
if (terminal_state != terminal_is_inferior)
return;
(*current_target.to_terminal_ours_for_output) (&current_target);