summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-09-21 16:25:25 +0100
committerPedro Alves <palves@redhat.com>2016-09-23 17:58:41 +0100
commit30aa2fe9142b0b8adac71096ed2d8f751fcd61e9 (patch)
treef4910cbbbacda19c2306561f787616f2c30332b7
parentb366739fd4ad21a76b7f39bf28243a315124d885 (diff)
downloadbinutils-gdb-users/palves/cxx-gdb_exceptions.tar.gz
gdb: Avoid exception copying in exception printing routinesusers/palves/cxx-gdb_exceptions
-rw-r--r--gdb/exceptions.c6
-rw-r--r--gdb/exceptions.h9
2 files changed, 8 insertions, 7 deletions
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index ff7e1b4c966..c8cc610581e 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -71,7 +71,7 @@ print_flush (void)
}
static void
-print_exception (struct ui_file *file, struct gdb_exception e)
+print_exception (struct ui_file *file, const gdb_exception &e)
{
/* KLUGE: cagney/2005-01-13: Write the string out one line at a time
as that way the MI's behavior is preserved. */
@@ -107,7 +107,7 @@ print_exception (struct ui_file *file, struct gdb_exception e)
}
void
-exception_print (struct ui_file *file, struct gdb_exception e)
+exception_print (struct ui_file *file, const gdb_exception &e)
{
if (e.reason < 0 && e.message != NULL)
{
@@ -117,7 +117,7 @@ exception_print (struct ui_file *file, struct gdb_exception e)
}
void
-exception_fprintf (struct ui_file *file, struct gdb_exception e,
+exception_fprintf (struct ui_file *file, const gdb_exception &e,
const char *prefix, ...)
{
if (e.reason < 0 && e.message != NULL)
diff --git a/gdb/exceptions.h b/gdb/exceptions.h
index 5711c1a35e1..87fec545eef 100644
--- a/gdb/exceptions.h
+++ b/gdb/exceptions.h
@@ -24,10 +24,11 @@
/* If E is an exception, print it's error message on the specified
stream. For _fprintf, prefix the message with PREFIX... */
-extern void exception_print (struct ui_file *file, struct gdb_exception e);
-extern void exception_fprintf (struct ui_file *file, struct gdb_exception e,
- const char *prefix,
- ...) ATTRIBUTE_PRINTF (3, 4);
+extern void exception_print (struct ui_file *file, const gdb_exception &e);
+
+extern void exception_fprintf (struct ui_file *file, const gdb_exception &e,
+ const char *prefix, ...)
+ ATTRIBUTE_PRINTF (3, 4);
/* Call FUNC(UIOUT, FUNC_ARGS) but wrapped within an exception
handler. If an exception (enum return_reason) is thrown using