[PATCH v2 14/25] Make target_terminal_inferior/ours almost nops on non-main UIs

Pedro Alves
2016-03-21T15:39:36Z

Since we always run the inferior in the main console (unless set
inferior--tty), 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/target.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/gdb/target.c b/gdb/target.c
index 86e7074..81bcca1 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -490,6 +490,9 @@ target_terminal_inferior (void)

delete_file_handler (ui->input_fd);

+ if (ui != main_ui)
+ return;
+
if (terminal_state == terminal_is_inferior)
return;

@@ -508,6 +511,9 @@ target_terminal_ours (void)

add_file_handler (ui->input_fd, stdin_event_handler, ui);

+ if (ui != main_ui)
+ return;
+
if (terminal_state == terminal_is_ours)
return;

@@ -520,6 +526,11 @@ target_terminal_ours (void)
void
target_terminal_ours_for_output (void)
{
+ struct ui *ui = current_ui;
+
+ if (ui != main_ui)
+ return;
+
if (terminal_state != terminal_is_inferior)
return;
(*current_target.to_terminal_ours_for_output) (&current_target);
--
2.5.0