From patchwork Fri Mar 18 19:18:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 11407 Received: (qmail 59909 invoked by alias); 18 Mar 2016 19:27:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 59893 invoked by uid 89); 18 Mar 2016 19:27:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1254, 66, 6, 3712 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, 18 Mar 2016 19:27:15 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 16C177FD45 for ; Fri, 18 Mar 2016 19:18:53 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2IJIYkJ028091 for ; Fri, 18 Mar 2016 15:18:52 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 21/30] Use target_terminal_ours_for_output in exceptions.c Date: Fri, 18 Mar 2016 19:18:25 +0000 Message-Id: <1458328714-4938-22-git-send-email-palves@redhat.com> In-Reply-To: <1458328714-4938-1-git-send-email-palves@redhat.com> References: <1458328714-4938-1-git-send-email-palves@redhat.com> We're only doing output here, so leave raw/cooked mode alone, as well as the SIGINT handler. Restore terminal settings after output, while at it. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * exceptions.c (print_flush): Use target_terminal_ours_for_output instead of target_terminal_ours, and restore target terminal with a cleanup. --- gdb/exceptions.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/exceptions.c b/gdb/exceptions.c index b457838..ffdd1f37 100644 --- a/gdb/exceptions.c +++ b/gdb/exceptions.c @@ -37,12 +37,16 @@ static void print_flush (void) { struct serial *gdb_stdout_serial; + struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); if (deprecated_error_begin_hook) deprecated_error_begin_hook (); if (target_supports_terminal_ours ()) - target_terminal_ours (); + { + make_cleanup_restore_target_terminal (); + target_terminal_ours_for_output (); + } /* We want all output to appear now, before we print the error. We have 3 levels of buffering we have to flush (it's possible that @@ -66,6 +70,8 @@ print_flush (void) } annotate_error_begin (); + + do_cleanups (old_chain); } static void