From patchwork Wed Aug 6 10:12:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Benson X-Patchwork-Id: 2316 Received: (qmail 17950 invoked by alias); 6 Aug 2014 10:12:40 -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 17643 invoked by uid 89); 6 Aug 2014 10:12:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 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; Wed, 06 Aug 2014 10:12:37 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s76ACat5023984 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 6 Aug 2014 06:12:36 -0400 Received: from blade.nx (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s76ACZ7q016055 for ; Wed, 6 Aug 2014 06:12:35 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id E051E2640DF for ; Wed, 6 Aug 2014 11:12:34 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Subject: [PATCH 2/8] Make error usable earlier Date: Wed, 6 Aug 2014 11:12:22 +0100 Message-Id: <1407319948-2264-3-git-send-email-gbenson@redhat.com> In-Reply-To: <1407319948-2264-1-git-send-email-gbenson@redhat.com> References: <1407319948-2264-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes error (and other exception-throwing functions) are callable from the first line of captured_main, but the exception printing code will crash if called before the first call to set_width. This commit makes the exception printing code usable from the moment gdb_stderr is set up. gdb/ 2014-08-05 Gary Benson * exceptions.c (print_flush): Protect calls to target_terminal_ours and wrap_here. --- gdb/ChangeLog | 5 +++++ gdb/exceptions.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gdb/exceptions.c b/gdb/exceptions.c index ddaf250..377d073 100644 --- a/gdb/exceptions.c +++ b/gdb/exceptions.c @@ -241,7 +241,9 @@ print_flush (void) if (deprecated_error_begin_hook) deprecated_error_begin_hook (); - target_terminal_ours (); + + if (target_supports_terminal_ours ()) + target_terminal_ours (); /* 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 @@ -249,7 +251,8 @@ print_flush (void) too): */ /* 1. The _filtered buffer. */ - wrap_here (""); + if (filtered_printing_initialized ()) + wrap_here (""); /* 2. The stdio buffer. */ gdb_flush (gdb_stdout);