[petsc-users] How to use PETSc in debug?

Matthew Knepley knepley at gmail.com
Thu Apr 16 13:55:42 CDT 2015


On Thu, Apr 16, 2015 at 1:35 PM, Song Gao <song.gao2 at mail.mcgill.ca> wrote:

> Dear PETSc users,
>
> I'm debugging my code but cannot see those line informations in gdb
>
> I compiled PETSc with
> --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-fblaslapack
> --download-mpich --with-debugging=yes
>
> I modified my code from KSP ex1f.F and use that makefile.
>
> Then compiled code
> make PETSC_DIR=/home/cfd/sgao/bin/petsc-3.5.3 PETSC_ARCH=FEM_project_DEBUG
> ex1f
> The log is attached, I see the -g flag there. But when I run code with
> gdb, I didn't see line information there.
>
>
> $gdb ./ex1f
> (gdb) b main
> Breakpoint 1 at 0x4080e0: file ../../../gcc-4.3.0/libgfortran/fmain.c,
> line 11.
>

main() is not the Fortran entry point. You might be better off working in C.

However, if you really want Fortran, try breaking at a line number in your
file. Also
make sure you did not delete the *.o file

   Matt


> (gdb) r
> Starting program: /home/cfd/sgao/FEM_in_CFD/code/ex1f
> [Thread debugging using libthread_db enabled]
>
> Breakpoint 1, main (argc=1, argv=0x7fffffffcc58) at
> ../../../gcc-4.3.0/libgfortran/fmain.c:11
> 11 ../../../gcc-4.3.0/libgfortran/fmain.c: No such file or directory.
> in ../../../gcc-4.3.0/libgfortran/fmain.c
> (gdb) l
> 6 in ../../../gcc-4.3.0/libgfortran/fmain.c
> (gdb)
>
>
> What did I miss here? Thank you in advance.
>
> Song
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150416/d2051c11/attachment.html>


More information about the petsc-users mailing list