I have the following data structure in a Fortran90 program:
TYPE derivedType
CHARACTER(100) :: name = ' '
INTEGER :: type = 0
REAL(KIND(1.0D0)) :: property = 0.0
END TYPE derivedType
TYPE (derivedType), ALLOCATABLE, DIMENSION(:) :: arrayOfDerivedTypes
When I try to debug and print values in GDB like:
(gdb) p arrayOfDerivedTypes(1)%name
I get non-sensical values (often strings of zeros, forward slashes and letters), or completely wrong values (like arrayOfDerivedTypes(1)%name = 9, when I know that it is = 2). How can I get GDB to print the correct values?
Background
I am aware of:
- this bug: http://sourceware.org/bugzilla/show_bug.cgi?id=9395
- this branch of GDB: http://sourceware.org/gdb/wiki/ProjectArcher
- and this blog post on printing allocatable arrays: http://numericalnoob.blogspot.be/2012/08/fortran-allocatable-arrays-and-pointers.html
I don't want to go through the trouble of compiling a separate branch of GDB to test if it solves this problem if someone already knows that it won't or if there is a better solution available.
I have a hard time imagining that there is not a solution to this yet. Does the fortran community not have a better solution for a free debugger yet?