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 | 4fcef00ad0f7de5a38ce1431e9db564aa3508871 (patch) | |
tree | c6c24f8ed847db8e72d197e8dbaaab60bc0e84c3 /gdb/top.c | |
parent | 53a83a21c7ab484d1e5c3dec1ccb976cbeb50924 (diff) | |
download | gdb-4fcef00ad0f7de5a38ce1431e9db564aa3508871.zip gdb-4fcef00ad0f7de5a38ce1431e9db564aa3508871.tar.gz gdb-4fcef00ad0f7de5a38ce1431e9db564aa3508871.tar.bz2 |
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
@@ -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; |