void run_self_tests (void) { int failed = 0; for (int i = 0; i < tests.size (); ++i) { QUIT; TRY { tests[i] (); } CATCH (ex, RETURN_MASK_ERROR) { ++failed; exception_fprintf (gdb_stderr, ex, _("Self test failed: ")); } END_CATCH }
int catch_errors (catch_errors_ftype *func, void *func_args, char *errstring, return_mask mask) { struct gdb_exception exception = exception_none; volatile int val = 0; struct ui_out *saved_uiout; /* Save the global ``struct ui_out'' builder. */ saved_uiout = current_uiout; TRY { val = func (func_args); } CATCH (ex, RETURN_MASK_ALL) { exception = ex; } END_CATCH /* 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_fprintf (gdb_stderr, exception, "%s", errstring); if (exception.reason != 0) return 0; return val; }