diff options
author | Andrew Cagney <cagney@redhat.com> | 2005-01-15 18:59:43 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2005-01-15 18:59:43 +0000 |
commit | 2f91a0f11abc199402cf2e9f7443d1303711ad31 (patch) | |
tree | ce111df8c21f59a8aa03437a8d1715ea4a633016 /gdb/exceptions.c | |
parent | 2f5a87b56d502af2b0d20364ab15826961b78d5d (diff) | |
download | gdb-2f91a0f11abc199402cf2e9f7443d1303711ad31.tar.gz |
2005-01-15 Andrew Cagney <cagney@gnu.org>
* exceptions.c (do_captured_command)
(struct captured_command_args): Delete.
(catch_command_errors): Simplify by inlining call to catch_errors.
Diffstat (limited to 'gdb/exceptions.c')
-rw-r--r-- | gdb/exceptions.c | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/gdb/exceptions.c b/gdb/exceptions.c index 58337527910..bf438b88dd8 100644 --- a/gdb/exceptions.c +++ b/gdb/exceptions.c @@ -515,36 +515,16 @@ catch_errors (catch_errors_ftype *func, void *func_args, char *errstring, return val; } -struct captured_command_args - { - catch_command_errors_ftype *command; - char *arg; - int from_tty; - }; - -static int -do_captured_command (void *data) -{ - struct captured_command_args *context = data; - context->command (context->arg, context->from_tty); - /* FIXME: cagney/1999-11-07: Technically this do_cleanups() call - isn't needed. Instead an assertion check could be made that - simply confirmed that the called function correctly cleaned up - after itself. Unfortunately, old code (prior to 1999-11-04) in - main.c was calling SET_TOP_LEVEL(), calling the command function, - and then *always* calling do_cleanups(). For the moment we - remain ``bug compatible'' with that old code.. */ - do_cleanups (ALL_CLEANUPS); - return 1; -} - int catch_command_errors (catch_command_errors_ftype * command, char *arg, int from_tty, return_mask mask) { - struct captured_command_args args; - args.command = command; - args.arg = arg; - args.from_tty = from_tty; - return catch_errors (do_captured_command, &args, "", mask); + volatile struct exception e; + SIGJMP_BUF *catch = catcher_init (uiout, NULL, &e, mask); + for (SIGSETJMP ((*catch)); catcher_state_machine (CATCH_ITER);) + command (arg, from_tty); + print_any_exception (gdb_stderr, NULL, e); + if (e.reason < 0) + return 0; + return 1; } |