Can't see common variables in gdb
Toon Moene
toon@moene.indiv.nluug.nl
Fri Dec 7 14:58:00 GMT 2001
Fred Krogh wrote:
>
> Hi --
> I'm using
>
> GNU gdb Red Hat Linux (5.1-1)
> This GDB was configured as "i386-redhat-linux".
>
> GNU Fortran 0.5.26 20011023 (release)
>
> on a Redhat 7.1 system with a 2.4.9-6 kernel.
It's hard to say what's wrong without more specific codes. We couldn't
test this feature on really big codes, but a simple one like:
toon@laptop:~/g77-bugs$ cat common2.f
subroutine sub
common /noot/teun,vuur,gijs,does
teun = 11.0
vuur = 12.0
gijs = 13.0
does = 14.0
end
program aap
common /noot/mies,wim,zus,jet
mies = 1
wim = 2.0
zus = 3.0
jet = 4
call sub
print *, mies,wim,zus,jet
end
toon@laptop:~/g77-bugs$ g77 -g -O2 common2.f
toon@laptop:~/g77-bugs$ gdb ./a.out
GNU gdb 19990928
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) break MAIN__
Breakpoint 1 at 0x8048ec0: file common2.f, line 8.
(gdb) run
Starting program: /home/toon/g77-bugs/./a.out
Breakpoint 1, MAIN__ () at common2.f:8
8 program aap
Current language: auto; currently fortran
(gdb) step
13 jet = 4
(gdb) step
10 mies = 1
(gdb) p jet
$1 = 0
(gdb) step
8 program aap
(gdb) p jet
$2 = 0
(gdb) step
MAIN__ () at common2.f:13
13 jet = 4
(gdb) step
10 mies = 1
(gdb) step
11 wim = 2.0
(gdb) p jet
$3 = 4
(gdb) quit
works, as you can see. However, one has to be sure the code that
actually sets the COMMON variable has been executed (note that only the
3rd print command in gdb showed the value of 4 for variable `jet').
Hope this helps,
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)
More information about the Gcc-bugs
mailing list