throw_it (enum return_reason reason, enum errors error, const char *fmt, va_list ap) { struct gdb_exception e; char *new_message; #if GDB_XCPT == GDB_XCPT_SJMP int depth = catcher_list_size (); #else int depth = try_scope_depth; #endif gdb_assert (depth > 0); /* Note: The new message may use an old message's text. */ new_message = xstrvprintf (fmt, ap); if (depth > exception_messages_size) { int old_size = exception_messages_size; exception_messages_size = depth + 10; exception_messages = XRESIZEVEC (char *, exception_messages, exception_messages_size); memset (exception_messages + old_size, 0, (exception_messages_size - old_size) * sizeof (char *)); }
throw_it (enum cexcept_return_reason reason, int error, const char *fmt, va_list ap) { struct cexception e; char *new_message; int depth = catcher_list_size (); assert (depth > 0); /* Note: The new message may use an old message's text. */ vasprintf (&new_message, fmt, ap); if (depth > exception_messages_size) { int old_size = exception_messages_size; exception_messages_size = depth + 10; exception_messages = (char **) realloc (exception_messages, exception_messages_size * sizeof (char *)); memset (exception_messages + old_size, 0, (exception_messages_size - old_size) * sizeof (char *)); } free (exception_messages[depth - 1]); exception_messages[depth - 1] = new_message; /* Create the exception. */ e.reason = reason; e.error = error; e.message = new_message; /* Throw the exception. */ cexcept_throw (e); }