Actual source code: errabort.c
petsc-3.10.5 2019-03-28
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>

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

     13:    Not Collective

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

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

     30:    Level: developer

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

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

     45:    Concepts: error handler^aborting
     46:    Concepts: aborting on error

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