/* Exception (throw catch) mechanism, for GDB, the GNU debugger.
- Copyright (C) 1986, 1988-2012 Free Software Foundation, Inc.
+ Copyright (C) 1986-2014 Free Software Foundation, Inc.
This file is part of GDB.
#include "annotate.h"
#include "ui-out.h"
#include "gdb_assert.h"
-#include "gdb_string.h"
+#include <string.h>
#include "serial.h"
#include "gdbthread.h"
exceptions_state_mc_init (volatile struct gdb_exception *exception,
return_mask mask)
{
- struct catcher *new_catcher = XZALLOC (struct catcher);
+ struct catcher *new_catcher = XCNEW (struct catcher);
/* Start with no exception, save it's address. */
exception->reason = 0;
void
throw_exception (struct gdb_exception exception)
{
- quit_flag = 0;
+ clear_quit_flag ();
immediate_quit = 0;
do_cleanups (all_cleanups ());
EXCEPTIONS_SIGLONGJMP (current_catcher->buf, exception.reason);
}
-void
-deprecated_throw_reason (enum return_reason reason)
-{
- struct gdb_exception exception;
-
- memset (&exception, 0, sizeof exception);
-
- exception.reason = reason;
- switch (reason)
- {
- case RETURN_QUIT:
- break;
- case RETURN_ERROR:
- exception.error = GENERIC_ERROR;
- break;
- default:
- internal_error (__FILE__, __LINE__, _("bad switch"));
- }
-
- throw_exception (exception);
-}
-
static void
print_flush (void)
{
}
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)
{
volatile struct gdb_exception e;
return 0;
return 1;
}
+
+int
+catch_command_errors_const (catch_command_errors_const_ftype *command,
+ const char *arg, int from_tty, return_mask mask)
+{
+ volatile struct gdb_exception e;
+
+ TRY_CATCH (e, mask)
+ {
+ command (arg, from_tty);
+ }
+ print_any_exception (gdb_stderr, NULL, e);
+ if (e.reason < 0)
+ return 0;
+ return 1;
+}