diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2004-01-20 02:04:19 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2004-01-20 02:04:19 +0000 |
commit | 63b18d14874a8148106a8700671b1d34d95768f7 (patch) | |
tree | 662ddf4e58111eabc5a17e61810682f92a0ef6a0 /gdb/top.c | |
parent | 640a2fd2f128740cee96f549794d92c0009ba1f7 (diff) | |
download | gdb-63b18d14874a8148106a8700671b1d34d95768f7.tar.gz |
2004-01-19 Jeff Johnston <jjohnstn@redhat.com>
* linespec.c (decode_variable, symtab_from_filename): Call
error_silent with error message instead of throwing an exception
directly.
* defs.h (error_silent, error_output_message): Add prototypes.
(catch_exceptions_with_msg): Ditto.
* utils.c (error_silent, error_output_message): New functions.
* top.c (catch_exceptions_with_msg): New function.
Diffstat (limited to 'gdb/top.c')
-rw-r--r-- | gdb/top.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/gdb/top.c b/gdb/top.c index 8dcf73a61f8..e11aad249e8 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -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; |