Your message dated Sun, 03 Aug 2025 17:03:26 -0400
with message-id <[email protected]>
and subject line Closing bug
has caused the Debian Bug report #428761,
regarding gdb: cannot print global variables while debugging fortran 90 programs
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
428761: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=428761
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
I can't reproduce this with GDB 16.1:
--8<---------------cut here---------------start------------->8---
(gdb) r
Starting program: /root/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, using_modules () at 1.f90:10
10 write(*,*) 'm = ', m
(gdb) p m
$1 = 3
(gdb) p alpha
$2 = 0.300000012
--8<---------------cut here---------------end--------------->8---
This bug is almost 20 years old; GDB has been almost completely
rewritten since then, and I don't recall seeing a similar problem
recently.
I'm taking the liberty to close this bug. Feel free reopen if it's
still applicable.
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
https://sergiodj.net/
signature.asc
Description: PGP signature
--- End Message ---