Next: gmake: A Tool for
Up: Using the gdb Debugger
Previous: Debugging Programs with Dynamic
Contents
Debugging Fortran programs that have been built with g77 can be rather confusing
as behinds the scenes g77 has converted the program into C and compiled that!
The following points should help and to illustrate them consider the following
(rather odd) function.
SUBROUTINE MY_SUB(IFILL)
COMMON /MY_COMMON/ MY_ARRAY(2,3)
INTEGER IFILL
INTEGER IROW, ICOL
DO IROW = 1, 3
DO ICOL = 1, 2
MY_ARRAY(ICOL,IROW) = IFILL
ENDDO
ENDDO
RETURN
END
- Use g77 version 3.0 or later; earlier versions did not provide
debug information for COMMON blocks so you could not examine COMMON
block variables!
- All variable, function and subroutine names are converted to lower case.
Example: To examine IROW:-
print irow
- All global names (i.e. function and subroutine) names have a trailing
underscore added. Any name that already contains an underscore may have another
trailing underscore added.
Example: To set a breakpoint on MY_SUB:-
break my_sub__
- Arguments are passed by address so to examine an argument you
must add an asterisk before to show that it is a pointer to be
followed.
Example: To examine IFILL:-
print *ifill
- In C, multi-dimensional arrays are ordered in the inverse way
compared to FORTRAN. Using any reasonably up to date version of
gcc/gdb should work fine and allow you to use standard Fortran array syntax
to examine them.
Next: gmake: A Tool for
Up: Using the gdb Debugger
Previous: Debugging Programs with Dynamic
Contents
P.D. Gronbech (IT Staff)
2015-10-02