aboutsummaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/top.c')
-rw-r--r--gdb/top.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/gdb/top.c b/gdb/top.c
index c52c176..e11aad2 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1,7 +1,7 @@
/* Top level stuff for GDB, the GNU debugger.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
- 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of GDB.
@@ -383,6 +383,7 @@ catcher (catch_exceptions_ftype *func,
int *func_val,
enum return_reason *func_caught,
char *errstring,
+ char **gdberrmsg,
return_mask mask)
{
SIGJMP_BUF *saved_catch;
@@ -428,7 +429,14 @@ catcher (catch_exceptions_ftype *func,
if (!caught)
val = (*func) (func_uiout, func_args);
else
- val = 0;
+ {
+ val = 0;
+ /* If caller wants a copy of the low-level error message, make one.
+ This is used in the case of a silent error whereby the caller
+ may optionally want to issue the message. */
+ if (gdberrmsg)
+ *gdberrmsg = error_last_message ();
+ }
catch_return = saved_catch;
/* FIXME: cagney/1999-11-05: A correct FUNC implementation will
@@ -476,7 +484,25 @@ catch_exceptions (struct ui_out *uiout,
{
int val;
enum return_reason caught;
- catcher (func, uiout, func_args, &val, &caught, errstring, mask);
+ catcher (func, uiout, func_args, &val, &caught, errstring, NULL, mask);
+ gdb_assert (val >= 0);
+ gdb_assert (caught <= 0);
+ if (caught < 0)
+ return caught;
+ return val;
+}
+
+int
+catch_exceptions_with_msg (struct ui_out *uiout,
+ catch_exceptions_ftype *func,
+ void *func_args,
+ char *errstring,
+ char **gdberrmsg,
+ return_mask mask)
+{
+ int val;
+ enum return_reason caught;
+ catcher (func, uiout, func_args, &val, &caught, errstring, gdberrmsg, mask);
gdb_assert (val >= 0);
gdb_assert (caught <= 0);
if (caught < 0)
@@ -506,7 +532,8 @@ catch_errors (catch_errors_ftype *func, void *func_args, char *errstring,
struct catch_errors_args args;
args.func = func;
args.func_args = func_args;
- catcher (do_catch_errors, uiout, &args, &val, &caught, errstring, mask);
+ catcher (do_catch_errors, uiout, &args, &val, &caught, errstring,
+ NULL, mask);
if (caught != 0)
return 0;
return val;
@@ -1359,7 +1386,7 @@ print_gdb_version (struct ui_file *stream)
/* Second line is a copyright notice. */
- fprintf_filtered (stream, "Copyright 2003 Free Software Foundation, Inc.\n");
+ fprintf_filtered (stream, "Copyright 2004 Free Software Foundation, Inc.\n");
/* Following the copyright is a brief statement that the program is
free software, that users are free to copy and change it on