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.
This commit is contained in:
parent
3af1e0e300
commit
5a14cc1abc
|
@ -1,5 +1,9 @@
|
||||||
2005-01-15 Andrew Cagney <cagney@gnu.org>
|
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.
|
||||||
|
|
||||||
* exceptions.c (struct catcher): Delete field print_message.
|
* exceptions.c (struct catcher): Delete field print_message.
|
||||||
(catcher_init): Delete print_message parameter.
|
(catcher_init): Delete print_message parameter.
|
||||||
(catch_exception, catch_exceptions_with_msg, catch_errors): Update.
|
(catch_exception, catch_exceptions_with_msg, catch_errors): Update.
|
||||||
|
|
|
@ -515,36 +515,16 @@ catch_errors (catch_errors_ftype *func, void *func_args, char *errstring,
|
||||||
return val;
|
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
|
int
|
||||||
catch_command_errors (catch_command_errors_ftype * command,
|
catch_command_errors (catch_command_errors_ftype * command,
|
||||||
char *arg, int from_tty, return_mask mask)
|
char *arg, int from_tty, return_mask mask)
|
||||||
{
|
{
|
||||||
struct captured_command_args args;
|
volatile struct exception e;
|
||||||
args.command = command;
|
SIGJMP_BUF *catch = catcher_init (uiout, NULL, &e, mask);
|
||||||
args.arg = arg;
|
for (SIGSETJMP ((*catch)); catcher_state_machine (CATCH_ITER);)
|
||||||
args.from_tty = from_tty;
|
command (arg, from_tty);
|
||||||
return catch_errors (do_captured_command, &args, "", mask);
|
print_any_exception (gdb_stderr, NULL, e);
|
||||||
|
if (e.reason < 0)
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue