[petsc-users] PETSC with-debugging and petsc errors

Satish Balay balay at mcs.anl.gov
Mon Aug 2 15:58:22 CDT 2010


On Mon, 2 Aug 2010, John-Michael Fischer wrote:

> I was wondering if when PETSC is compiled with-debugging=1 (or any other configure flag for that matter) I can get it to report the line and filename that errors occur on in my source.
> 
> It's dutifully reporting the file and line # of the PETSC source, but I know the error is mine and not a problem with petsc (the error is [0]PETSC ERROR: Argument out of range! ).
> 

For some errrors - it can give a bit more info if you have the
__FUNCT__ macro defined for each of your functions.  For eg: check
src/ksp/ksp/examples/tutorials/ex2.c, src/mat/interface/matrix.c.
[This is not possible from fortran sources]

> Since PETSC catches it, even when I run the program in GDB it doesn't segfault or anything so execution just keeps on going.
> 

You can place a breakpoint in PetscError() - and then work thorugh the function stack.
[using a debugger should be prefered over the relaince of messages printed by petsc error handlers]

Satish


More information about the petsc-users mailing list