Debugging fortran codes
Tobias Burnus
burnus@net-b.de
Sat Aug 28 13:38:00 GMT 2010
Hello Salvatore,
Salvatore Filippone wrote:
> I have a general question: I often work in Linux under DDD/GDB to debug
> programs. However the two tools do not seem to understand Fortran
> derived types (let alone CLASS variables).
>
> So: is this something that requires more hooks on gfortran's side, or is
> it just the other packages not interfacing?
For CLASS, no idea, but otherwise, debugging TYPE should mostly work.
However, you should use the GDB which contains the patches of Jan
Kratochvil - that's the gdb's from Red Hat / Fedora, but also the ones
from (open)SUSE. Alternatively, you find them in git in the
archer-jankratochvil-fedora14 branch:
http://sourceware.org/gdb/wiki/ArcherBranchManagement
Example: For
type t
integer :: x
real :: y(5)
logical, allocatable :: z(:)
end type t
one gets:
(gdb) pt mt
type = Type t
integer(kind=4) :: x
real(kind=4) :: y(5)
logical(kind=4) :: z
End Type t
(gdb) pt mt%x
type = integer(kind=4)
(gdb) pt mt%y
type = real(kind=4) (5)
(Well, allocatable components it does not like:
(gdb) pt mt%z
type = Cannot resolve DW_OP_push_object_address for a missing object
Cf. https://bugzilla.redhat.com/show_bug.cgi?id=628175 )
Another possibility is to try Intel's IDB, which should also work with
GCC binaries - or also Totalview.
Tobias
PS: Jan's patches are mostly needed to support Fortran 90 style arrays
(allocatables, pointers, assumed-shape) - and C's VLA.
More information about the Fortran
mailing list