From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78825 invoked by alias); 6 May 2016 12:35:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 78631 invoked by uid 89); 6 May 2016 12:35:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=registering X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 06 May 2016 12:35:22 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 029AF3B75A for ; Fri, 6 May 2016 12:35:21 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u46CZ5ID017259 for ; Fri, 6 May 2016 08:35:20 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v3 16/34] Make target_terminal_inferior/ours almost nops on non-main UIs Date: Fri, 06 May 2016 12:35:00 -0000 Message-Id: <1462538104-19109-17-git-send-email-palves@redhat.com> In-Reply-To: <1462538104-19109-1-git-send-email-palves@redhat.com> References: <1462538104-19109-1-git-send-email-palves@redhat.com> X-SW-Source: 2016-05/txt/msg00101.txt.bz2 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: yyyy-mm-dd Pedro Alves * 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. --- gdb/target.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gdb/target.c b/gdb/target.c index 2d16c96..12d5de2 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) (¤t_target); -- 2.5.5