This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] fortran: add module names to the symbol table
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Sanimir Agovic <sanimir dot agovic at intel dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 26 Feb 2013 10:11:12 +0100
- Subject: Re: [RFC] fortran: add module names to the symbol table
- References: <1361808272-2164-1-git-send-email-sanimir.agovic@intel.com>
On Mon, 25 Feb 2013 17:04:32 +0100, Sanimir Agovic wrote:
> ptype/whatis is now recognizing fortran modules:
There is a problem with sharing the namespace.
When there is the module in scope gfortran produces this error:
Error: Symbol 'mod1' at (1) cannot have a type
But one can have variables with the name of modules not 'use'd at that place.
This is a regression by your patch. The patch would be OK as long as you
restrict the modules scope to only where they are used.
gfortran -o 20 20.f90 -Wall -g
../gdb -batch ./20 -ex 'set trace-commands' -ex 'b 13' -ex r -ex 'p mod1' -ex 'ptype mod1' -ex 'p mod2' -ex 'ptype mod2'
-FSF GDB HEAD:
+your patched GDB
(gdb) p mod1
-No symbol "mod1" in current context.
+Attempt to use a type name as an expression
(gdb) ptype mod1
-No symbol "mod1" in current context.
+type = module mod1
This part is OK.
(gdb) p mod2
-$1 = 50
+Attempt to use a type name as an expression
(gdb) ptype mod2
-type = integer(kind=4)
+type = module mod2
This part is a regression by your patch.
Thanks,
Jan
------------------------------------------------------------------------------
module mod1
integer :: var_i = 1
! integer :: mod1 = 40 ! Error: Symbol 'mod1' at (1) cannot have a type
integer :: mod2 = 50
end module mod1
module mod2
integer :: var_i = 2
end module mod2
subroutine sub1
use mod1
mod2 = 51
end
subroutine sub2
use mod2
var_i = var_i
end
program module
call sub1
call sub2
end