From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32097 invoked by alias); 18 Mar 2016 19:24:06 -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 32052 invoked by uid 89); 18 Mar 2016 19:24:05 -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:1630, 7097 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:24:04 +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 95AC1686 for ; Fri, 18 Mar 2016 19:18:54 +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 u2IJIYkL028091 for ; Fri, 18 Mar 2016 15:18:54 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 23/30] Use target_terminal_ours_for_output in warning/internal_error Date: Fri, 18 Mar 2016 19:24:00 -0000 Message-Id: <1458328714-4938-24-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> X-SW-Source: 2016-03/txt/msg00359.txt.bz2 We're only doing output here, so leave raw/cooked mode alone, as well as the SIGINT handler. And restore terminal settings, while at it. gdb/ChangeLog: YYYY-MM-DD Pedro Alves * utils.c (vwarning, internal_vproblem): Use make_cleanup_restore_target_terminal and target_terminal_ours_for_output. --- gdb/utils.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gdb/utils.c b/gdb/utils.c index a909b38..4d81c23 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -503,8 +503,13 @@ vwarning (const char *string, va_list args) (*deprecated_warning_hook) (string, args); else { + struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); + if (target_supports_terminal_ours ()) - target_terminal_ours (); + { + make_cleanup_restore_target_terminal (); + target_terminal_ours_for_output (); + } if (filtered_printing_initialized ()) wrap_here (""); /* Force out any buffered output. */ gdb_flush (gdb_stdout); @@ -512,6 +517,8 @@ vwarning (const char *string, va_list args) fputs_unfiltered (warning_pre_print, gdb_stderr); vfprintf_unfiltered (gdb_stderr, string, args); fprintf_unfiltered (gdb_stderr, "\n"); + + do_cleanups (old_chain); } } @@ -709,7 +716,10 @@ internal_vproblem (struct internal_problem *problem, /* Try to get the message out and at the start of a new line. */ if (target_supports_terminal_ours ()) - target_terminal_ours (); + { + make_cleanup_restore_target_terminal (); + target_terminal_ours_for_output (); + } if (filtered_printing_initialized ()) begin_line (); -- 2.5.0