m1tag00@fed.FRB.GOV (Tim A. Grunwald) (10/21/88)
I am trying GDB for the first time and it works very well with compiled C code. When I try to debug a large Fortran program with GDB it seems to work fine until I try to print out variable values. All variables print out the same value, -1. Is GDB supposed to be able to debug Fortran programs? If so, what am I doing wrong? Any help on this problem or any useful hints using GDB's attach command would be appreciated. Tim Grunwald Federal Reserve Board 21st & C st N.W. DC 20551 uunet!fed!m1tag00
m1tag00@fed.FRB.GOV (Tim A. Grunwald) (10/26/88)
GDB works very well with compiled C code. My problem is that when I try to debug a large Fortran program with GDB it seems to work fine until I try to print out variable values. All variables print out the same value, -1. Is GDB supposed to be able to debug Fortran programs? If so, what am I doing wrong? Any help on this problem would be appreciated. Tim Grunwald Federal Reserve Board 21st & C st N.W. DC 20551 uunet!fed!m1tag00
csmith@mozart.uucp (Chris Smith) (10/26/88)
I've modified GDB so it's able to deal with C-like Fortran -- REAL A(10) turns into float a[10], with subscripts 0..9, and like that. I'll be glad to mail the diffs if you want to patch them in. They teach GDB how to deal with reference arguments and common blocks. If the variables that type as -1 are not arguments or in common, then what I've got won't help. csmith@convex.COM
rms@WHEATIES.AI.MIT.EDU (Richard Stallman) (11/15/88)
Return-Path: <fed!mqws1!m1tag00@uunet.uu.net> To: uunet!wheaties.ai.mit.edu!rms@uunet.uu.net (Richard Stallman) Subject: Re: GDB and Fortran In-Reply-To: Your message of Sun, 13 Nov 88 21:18:47 -0500. <8811140218.AA01305@sugar-bombs.ai.mit.edu> Date: Mon, 14 Nov 88 10:44:26 -0500 From: Timothy A. Grunwald <fed!mqws1!m1tag00@uunet.uu.net> >> When I try to debug a large Fortran program >> with GDB it seems to work fine until I try to print out variable values. >> All variables print out the same value, -1. Is GDB supposed to be able >> to debug Fortran programs? >> >> As far as I know, it should. If you report a specific test case that >> fails, we can debug it. Send the bug report to bug-gdb. >> Should I post or mail to bug-gdb? Anyway the large Fortran program is to large to send. I cooked up a simple example that displays a different behavior. The following was run on a Sun 3/60, Sun OS 3.5, GNU Emacs 18.52, GDB program testit real*4 a,b,c(10) i=5 j=6 a=5.5 b=a*a c(1) = 10. c(2) = 20. c(3) = 30. c(4) = 40. stop end Reading symbol data from /mq/m1tag00/testit...done. (gdb) break 5 Breakpoint 4 at 0x20d0: file testit.f, line 5. (gdb) run Starting program: /mq/m1tag00/testit Bpt 4, MAIN () (testit.f line 5) (gdb) s (gdb) s (gdb) s (gdb) s (gdb) s (gdb) s (gdb) print b $1 = 30.25 (gdb) print c[1] Argument to arithmetic operation not a number. (gdb) print c[2] Argument to arithmetic operation not a number. (gdb) print c[3] Argument to arithmetic operation not a number. (gdb) where c Value not integer or pointer. (gdb) whatis c type = struct unknown (gdb) I didn't get the -1 behavior, but as you can see arrays seem to have problems. Tim Grunwald Federal Reserve Board 21st & C st N.W. DC 20551 uunet!fed!m1tag00