> Hi everyone: I'm trying to do some debugging of FORTRAN encoded
> programs compiled with g77. The only debugger I'm aware of is
> gdb. It appears to have some shortcomings in terms of examining
> variables (esp. in common blocks). Can anyone tell me if
> there is anything more streamlined than gdb 4.17? Steve
Well, there are interesting issues with printing the contents of
common blocks -- you can have things in FORTRAN like
where the SINGLE x and the INTEGER i are both the same
chunk of memory. So which way should it be printed?
g77 writes common blocks in the symbol table as arrays of
characters of the appropriate length, you need to tell the
debugger how to dump the common block.
So for the above example, you can do
(gdb) x/1dw &fred_
0x80535dc <fred_>: 6
to examine 1 decimal word at fred_, or
(gdb) x/1fw &fred_
0x80535dc <fred_>: 8.40779079e-45
to examine it as a floating point value, etc.
You might want to define a user-defined command as shorthand for
displaying a particular common block. For example if you
have a common block "joe" with 15 integers and 3 double
values you could:
(gdb) define print_joe
Type commands for definition of "print_joe".
End with a line saying just "end".
> x/15dw &joe_
and then use print_joe whenever you need to. You can also put such
a definition in your $HOME/.gdbinit, or a .gdbinit file in the current
More details are available at: