- return catch_exceptions_with_msg (uiout, func, func_args, NULL, mask);
-}
-
-int
-catch_exceptions_with_msg (struct ui_out *func_uiout,
- catch_exceptions_ftype *func,
- void *func_args,
- char **gdberrmsg,
- return_mask mask)
-{
- volatile struct gdb_exception exception;
- volatile int val = 0;
- struct ui_out *saved_uiout;
-
- /* Save and override the global ``struct ui_out'' builder. */
- saved_uiout = current_uiout;
- current_uiout = func_uiout;
-
- TRY_CATCH (exception, RETURN_MASK_ALL)
- {
- val = (*func) (current_uiout, func_args);
- }
-
- /* Restore the global builder. */
- current_uiout = saved_uiout;
-
- if (exception.reason < 0 && (mask & RETURN_MASK (exception.reason)) == 0)
- {
- /* The caller didn't request that the event be caught.
- Rethrow. */
- throw_exception (exception);
- }
-
- exception_print (gdb_stderr, exception);
- gdb_assert (val >= 0);
- gdb_assert (exception.reason <= 0);
- if (exception.reason < 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 != NULL)
- {
- if (exception.message != NULL)
- *gdberrmsg = xstrdup (exception.message);
- else
- *gdberrmsg = NULL;
- }
- return exception.reason;
- }
- return val;
-}
-
-/* This function is superseded by catch_exceptions(). */
-
-int
-catch_errors (catch_errors_ftype *func, void *func_args, char *errstring,
- return_mask mask)
-{
- volatile int val = 0;
- volatile struct gdb_exception exception;
- struct ui_out *saved_uiout;
-
- /* Save the global ``struct ui_out'' builder. */
- saved_uiout = current_uiout;
-
- TRY_CATCH (exception, RETURN_MASK_ALL)
- {
- val = func (func_args);
- }
-
- /* Restore the global builder. */
- current_uiout = saved_uiout;
-
- if (exception.reason < 0 && (mask & RETURN_MASK (exception.reason)) == 0)
- {
- /* The caller didn't request that the event be caught.
- Rethrow. */
- throw_exception (exception);
- }