[ale] debugging FORTRAN
Eric Z. Ayers
eric.ayers at mindspring.com
Sun Jun 20 11:32:23 EDT 1999
Just a quick perusal from the man pages show that g77 works the same
as gcc - you must add the -g flag to the command line when you compile
your programs if you want debugging symbols in your program. GDB
won't do much without them. Try recompiling your code with
g77 -g <sourcefile> -o <output file>
and then run GDB on your file:
$ gdb <output file>
(gdb) break main
(gdb) run <command-line arguments>
Use 'next' to step from one line to the next
'list' to look at the current line of source code.
If you have a core dump
$ gdb <output file> <core file>
$ gdb mytest core
(gdb) list # will show you the code around where you crashed
(gdb) where # will show a backtrace of all the subroutines
Hope that helped.
-Eric.
Lisa Chiang writes:
> ALE'rs:
>
> I have some questions about gdb and FORTRAN. Since g77 seems to be a FORTRAN
> to C converter (right?), how do you get gdb to debug FORTRAN natively? I
> downloaded the gdb manual and I must admit that I'm confused.
>
> For example, I tried "show symbols" on my FORTRAN executable and all I see are
> C symbols. I seems that I can't load a source FORTRAN file and debug it like
> you would a C program.
>
> At this point I'm porting a large VMS VAX FORTRAN code to g77 but if I can't get
> gdb to work with FORTRAN, I may just have to rewrite it in C which will take
> some time. Any suggestions? Thanks.
>
>
> --
> Lisa Chiang
> gt6492d at gatech.campuscwix.net
> Georgia Institute of Technology
More information about the Ale
mailing list