X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fexceptions.c;h=f9a80a0b3fabff4faf5078c2d0eeb1385964bdf0;hb=873c08142c4c377d2d3ed0b1b1b9e262ddc06c61;hp=0e600504c1af599c3891db4a7a25914008013a4c;hpb=2afc13ff80492278154c0f2156a9d32dd5ba675a;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/exceptions.c b/gdb/exceptions.c index 0e600504c1..f9a80a0b3f 100644 --- a/gdb/exceptions.c +++ b/gdb/exceptions.c @@ -1,6 +1,6 @@ /* Exception (throw catch) mechanism, for GDB, the GNU debugger. - Copyright (C) 1986-2016 Free Software Foundation, Inc. + Copyright (C) 1986-2017 Free Software Foundation, Inc. This file is part of GDB. @@ -26,10 +26,12 @@ #include "ui-out.h" #include "serial.h" #include "gdbthread.h" +#include "top.h" static void print_flush (void) { + struct ui *ui = current_ui; struct serial *gdb_stdout_serial; struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); @@ -56,7 +58,7 @@ print_flush (void) gdb_flush (gdb_stderr); /* 3. The system-level buffer. */ - gdb_stdout_serial = serial_fdopen (1); + gdb_stdout_serial = serial_fdopen (fileno (ui->outstream)); if (gdb_stdout_serial) { serial_drain_output (gdb_stdout_serial); @@ -219,8 +221,8 @@ catch_exceptions_with_msg (struct ui_out *func_uiout, /* This function is superseded by catch_exceptions(). */ int -catch_errors (catch_errors_ftype *func, void *func_args, char *errstring, - return_mask mask) +catch_errors (catch_errors_ftype *func, void *func_args, + const char *errstring, return_mask mask) { struct gdb_exception exception = exception_none; volatile int val = 0; @@ -254,3 +256,21 @@ catch_errors (catch_errors_ftype *func, void *func_args, char *errstring, return 0; return val; } + +/* See exceptions.h. */ + +int +exception_print_same (struct gdb_exception e1, struct gdb_exception e2) +{ + const char *msg1 = e1.message; + const char *msg2 = e2.message; + + if (msg1 == NULL) + msg1 = ""; + if (msg2 == NULL) + msg2 = ""; + + return (e1.reason == e2.reason + && e1.error == e2.error + && strcmp (msg1, msg2) == 0); +}