From patchwork Thu Jul 3 15:13:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 1879 Received: (qmail 11045 invoked by alias); 3 Jul 2014 15:13:42 -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 10829 invoked by uid 89); 3 Jul 2014 15:13:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD 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; Thu, 03 Jul 2014 15:13:34 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s63FDVLo016318 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 3 Jul 2014 11:13:32 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s63FDQOe021950 for ; Thu, 3 Jul 2014 11:13:31 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 2/9] Eliminate exceptions.c:print_any_exception. Date: Thu, 3 Jul 2014 16:13:11 +0100 Message-Id: <1404400406-16708-4-git-send-email-palves@redhat.com> In-Reply-To: <1404400406-16708-1-git-send-email-palves@redhat.com> References: <1404400406-16708-1-git-send-email-palves@redhat.com> exception_print and exception_fprintf call print_flush, which does all the same flushing and annotation things that print_any_exception does, and more. gdb/ 2014-07-03 Pedro Alves * exceptions.c (print_any_exception): Delete. (catch_exceptions_with_msg): Use exception_print instead of print_any_exception. (catch_errors): Use exception_fprintf instead of print_any_exception. (catch_command_errors, catch_command_errors_const): Use exception_print instead of print_any_exception. --- gdb/exceptions.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/gdb/exceptions.c b/gdb/exceptions.c index ca80893..8ee428d 100644 --- a/gdb/exceptions.c +++ b/gdb/exceptions.c @@ -331,24 +331,6 @@ exception_fprintf (struct ui_file *file, struct gdb_exception e, } } -static void -print_any_exception (struct ui_file *file, const char *prefix, - struct gdb_exception e) -{ - if (e.reason < 0 && e.message != NULL) - { - target_terminal_ours (); - wrap_here (""); /* Force out any buffered output. */ - gdb_flush (gdb_stdout); - annotate_error_begin (); - - /* Print the prefix. */ - if (prefix != NULL && prefix[0] != '\0') - fputs_filtered (prefix, file); - print_exception (file, e); - } -} - /* A stack of exception messages. This is needed to handle nested calls to throw_it: we don't want to xfree space for a message before it's used. @@ -486,7 +468,7 @@ catch_exceptions_with_msg (struct ui_out *func_uiout, throw_exception (exception); } - print_any_exception (gdb_stderr, NULL, exception); + exception_print (gdb_stderr, exception); gdb_assert (val >= 0); gdb_assert (exception.reason <= 0); if (exception.reason < 0) @@ -534,7 +516,7 @@ catch_errors (catch_errors_ftype *func, void *func_args, char *errstring, throw_exception (exception); } - print_any_exception (gdb_stderr, errstring, exception); + exception_fprintf (gdb_stderr, exception, "%s", errstring); if (exception.reason != 0) return 0; return val; @@ -550,7 +532,7 @@ catch_command_errors (catch_command_errors_ftype *command, { command (arg, from_tty); } - print_any_exception (gdb_stderr, NULL, e); + exception_print (gdb_stderr, e); if (e.reason < 0) return 0; return 1; @@ -566,7 +548,7 @@ catch_command_errors_const (catch_command_errors_const_ftype *command, { command (arg, from_tty); } - print_any_exception (gdb_stderr, NULL, e); + exception_print (gdb_stderr, e); if (e.reason < 0) return 0; return 1;