using gdb with pgi 17.4 fortran compiler

Does gdb work with the pgi fortran compiler?

Sometimes I see curious things, like a variable turning into a pointer… or a Boolean being some large number instead of .true. or .false.

And if I don’t use -g to compile, gdb still seems to think it can debug with source, even though it does not work.

Any comments?

Thanks

Does gdb work with the pgi fortran compiler?

It should. PGI uses the standard Dwarf debugging format (http://dwarfstd.org/) which gdb can read. Though you can try using PGI’s debugger, pgdbg, as well (https://www.pgroup.com/resources/docs/19.5/x86/pgdbg-user-guide/index.htm)

Sometimes I see curious things, like a variable turning into a pointer…

Are they being passed as an argument in a subroutine? Fortran defaults to passing by reference which gdb may show as a pointer.

or a Boolean being some large number instead of .true. or .false.

LOGICAL can be represented as an integer where 0 is false and non-zero is true. This might be what you’re seeing.

And if I don’t use -g to compile, gdb still seems to think it can debug with source, even though it does not work.

Yes, you can debug applications that are not compiled with -g. Granted, the dwarf symbols wont be there so it may not be too useful, but it’s possible. It can be useful when trying to get a traceback from a binary without needing to recompile with dwarf generation enabled.

Note that PGI will include a minimal amount of dwarf info in the binary, mostly used for profiling, so some symbols may be there, but just not as complete as if you were to add -g.

-Mat

OK, thank you. I did not consider the idea of a subroutine argument looking like a pointer in the gdb
I got thrown off a little with the .true. and .false. because at times I would see just that, and other times a non zero number, though I guess it was working as it should.

Thanks so much for the feedback.