public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/9] Eliminate exceptions.c:print_any_exception.
Date: Thu, 03 Jul 2014 15:19:00 -0000	[thread overview]
Message-ID: <1404400736-17307-3-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1404400736-17307-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  <palves@redhat.com>

	* 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;
-- 
1.9.3

  reply	other threads:[~2014-07-03 15:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-03 15:19 [RESEND/PROPER PATCH 0/9] pagination/readline/async issues Pedro Alves
2014-07-03 15:19 ` Pedro Alves [this message]
2014-07-03 20:38   ` [PATCH 2/9] Eliminate exceptions.c:print_any_exception Tom Tromey
2014-07-03 15:19 ` [PATCH 5/9] Canceling pagination caused by execution command from command line aborts readline/gdb Pedro Alves
2014-07-04  6:11   ` Yao Qi
2014-07-09 16:45     ` Pedro Alves
2014-07-10  9:26       ` Yao Qi
2014-07-03 15:19 ` [PATCH 8/9] Fix double prompt Pedro Alves
2014-07-03 15:19 ` [PATCH 1/9] Put the inferior's terminal settings in effect while running (fg) infcalls Pedro Alves
2014-07-03 15:19 ` [PATCH 9/9] Put GDB's terminal settings into effect when paginating Pedro Alves
2014-07-03 15:19 ` [PATCH 6/9] Background execution + pagination aborts readline/gdb Pedro Alves
2014-09-13  0:05   ` Sergio Durigan Junior
2014-07-03 15:19 ` [PATCH 3/9] Move catch_command_errors and catch_command_errors_const to main.c Pedro Alves
2014-07-03 15:27 ` [PATCH 4/9] testsuite: Introduce gdb_assert Pedro Alves
2014-07-03 20:41   ` Tom Tromey
2014-07-03 15:31 ` [RESEND/PROPER PATCH 0/9] pagination/readline/async issues Pedro Alves
2014-07-14 22:38   ` Pedro Alves
2014-07-03 15:40 ` [PATCH 7/9] Remove the target from the event loop while in secondary prompts Pedro Alves
  -- strict thread matches above, loose matches on Subject: below --
2014-07-03 15:13 [PATCH 0/9] pagination/readline/async issues Pedro Alves
2014-07-03 15:13 ` [PATCH 2/9] Eliminate exceptions.c:print_any_exception Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404400736-17307-3-git-send-email-palves@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).