Actual source code: errabort.c

petsc-3.7.3 2016-08-01
Report Typos and Errors
  2: /*
  3:        The default error handlers and code that allows one to change
  4:    error handlers.
  5: */
  6: #include <petscsys.h>           /*I "petscsys.h" I*/

 10: /*@C
 11:    PetscAbortErrorHandler - Error handler that calls abort on error.
 12:    This routine is very useful when running in the debugger, because the
 13:    user can look directly at the stack frames and the variables.

 15:    Not Collective

 17:    Input Parameters:
 18: +  comm - communicator over which error occurred
 19: .  line - the line number of the error (indicated by __LINE__)
 20: .  func - function where error occured (indicated by __FUNCT__)
 21: .  file - the file in which the error was detected (indicated by __FILE__)
 22: .  mess - an error text string, usually just printed to the screen
 23: .  n - the generic error number
 24: .  p - specific error number
 25: -  ctx - error handler context

 27:    Options Database Keys:
 28: +  -on_error_abort - Activates aborting when an error is encountered
 29: -  -start_in_debugger [noxterm,dbx,xxgdb]  [-display name] - Starts all
 30:     processes in the debugger and uses PetscAbortErrorHandler().  By default the
 31:     debugger is gdb; alternatives are dbx and xxgdb.

 33:    Level: developer

 35:    Notes:
 36:    Most users need not directly employ this routine and the other error
 37:    handlers, but can instead use the simplified interface SETERRQ, which
 38:    has the calling sequence
 39: $     SETERRQ(comm,number,mess)
 40:    or its variants, SETERRQ1(number,formatstring,arg1), SETERRQ2(), ... that
 41:    allow including arguments in the message.

 43:    Notes for experienced users:
 44:    Use PetscPushErrorHandler() to set the desired error handler.  The
 45:    currently available PETSc error handlers include PetscTraceBackErrorHandler(),
 46:    PetscAttachDebuggerErrorHandler(), and PetscAbortErrorHandler().

 48:    Concepts: error handler^aborting
 49:    Concepts: aborting on error

 51: .seealso: PetscPushErrorHandler(), PetscTraceBackErrorHandler(),
 52:           PetscAttachDebuggerErrorHandler()
 53: @*/
 54: PetscErrorCode  PetscAbortErrorHandler(MPI_Comm comm,int line,const char *fun,const char *file,PetscErrorCode n,PetscErrorType p,const char *mess,void *ctx)
 55: {
 57:   (*PetscErrorPrintf)("%s() line %d in %s %s\n",fun,line,file,mess);
 58:   abort();
 59:   return(0);
 60: }