Actual source code: errabort.c

  1: /*$Id: errabort.c,v 1.12 2001/03/23 23:20:26 balay Exp $*/
  2: /*
  3:        The default error handlers and code that allows one to change
  4:    error handlers.
  5: */
 6:  #include petsc.h
  7: #if defined(PETSC_HAVE_STDLIB_H)
  8: #include <stdlib.h>
  9: #endif
 10: #include "petscfix.h"

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

 17:    Not Collective

 19:    Input Parameters:
 20: +  line - the line number of the error (indicated by __LINE__)
 21: .  file - the file in which the error was detected (indicated by __FILE__)
 22: .  dir - the directory of the file (indicated by __SDIR__)
 23: .  mess - an error text string, usually just printed to the screen
 24: .  n - the generic error number
 25: .  p - specific error number
 26: -  ctx - error handler context

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

 34:    Level: developer

 36:    Notes:
 37:    Most users need not directly employ this routine and the other error 
 38:    handlers, but can instead use the simplified interface SETERRQ, which
 39:    has the calling sequence
 40: $     SETERRQ(number,p,mess)

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

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

 50: .seealso: PetscPushErrorHandler(), PetscTraceBackErrorHandler(), 
 51:           PetscAttachDebuggerErrorHandler()
 52: @*/
 53: int PetscAbortErrorHandler(int line,char *func,char *file,char* dir,int n,int p,char *mess,void *ctx)
 54: {

 57:   abort();
 58:   return(0);
 59: }