Exemplo n.º 1
0
void
throw_exception (struct gdb_exception exception)
{
  prepare_to_throw_exception ();

  do_cleanups (all_cleanups ());

#if GDB_XCPT == GDB_XCPT_SJMP
  /* Jump to the containing catch_errors() call, communicating REASON
     to that call via setjmp's return value.  Note that REASON can't
     be zero, by definition in defs.h.  */
  exceptions_state_mc (CATCH_THROWING);
  current_catcher->exception = exception;
  SIGLONGJMP (current_catcher->buf, exception.reason);
#else
  if (exception.reason == RETURN_QUIT)
    {
      gdb_exception_RETURN_MASK_QUIT ex;

      gdb_exception_sliced_copy (&ex, &exception);
      throw ex;
    }
  else if (exception.reason == RETURN_ERROR)
    {
      gdb_exception_RETURN_MASK_ERROR ex;

      gdb_exception_sliced_copy (&ex, &exception);
      throw ex;
    }
  else
    gdb_assert_not_reached ("invalid return reason");
#endif
}
Exemplo n.º 2
0
static ATTRIBUTE_NORETURN void
throw_exception_cxx (struct gdb_exception exception)
{
  do_cleanups (all_cleanups ());

  if (exception.reason == RETURN_QUIT)
    {
      gdb_exception_RETURN_MASK_QUIT ex;

      gdb_exception_sliced_copy (&ex, &exception);
      throw ex;
    }
  else if (exception.reason == RETURN_ERROR)
    {
      gdb_exception_RETURN_MASK_ERROR ex;

      gdb_exception_sliced_copy (&ex, &exception);
      throw ex;
    }
  else
    gdb_assert_not_reached ("invalid return reason");
}