Package: gdb
Version: 6.6.dfsg-1
Severity: normal

Consider the following Fortran 90 program.

$ cat using_modules.f90
module dummy
  implicit none
  integer :: m = 3
end module dummy

program using_modules
  use dummy
  implicit none
  real :: alpha = 0.3
  write(*,*) 'm = ', m
  write(*,*) 'alpha = ', alpha
end program using_modules

There are two variables in this program : m, alpha. The variable 'm' 
declared inside the module 'dummy' acts as a global variable inside the 
program 'using_modules'. However, the value of m cannot be printed when 
the program is run via gdb.

$ gfortran -g using_modules.f90
$ gdb -q ./a.out
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) b using_modules.f90:11
Breakpoint 1 at 0x80486c9: file using_modules.f90, line 11.
(gdb) r
Starting program: /home/rajuonu2/deleteafter/a.out
 m =            3

Breakpoint 1, MAIN__ () at using_modules.f90:11
11        write(*,*) 'alpha = ', alpha
Current language:  auto; currently fortran
(gdb) p m
No symbol "m" in current context.


As you can see, we can access the variable 'm' inside the program. But 
that variable cannot be accessed inside gdb.


However, the local variable 'alpha' can be accessed without any problem.

(gdb) p alpha
$1 = 0.300000012

The problem exists only with variables accessed via modules.

hth
raju


-- System Information:
Debian Release: testing/unstable
  APT prefers oldstable
  APT policy: (500, 'oldstable'), (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.17-2-686 (SMP w/1 CPU core)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages gdb depends on:
ii  libc6                         2.5-7      GNU C Library: Shared libraries
ii  libncurses5                   5.5-1      Shared libraries for terminal hand
ii  libreadline5                  5.2-2      GNU readline and history libraries

gdb recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to