mathias
08-20-2010, 05:38 AM
Hello,
I am (as maybe many others) struggling with diving into module variables. A simple example is the following:
module myvar
integer :: bla
end module myvar
!-------------------------
program test
use myvar
implicit none
bla = 5
write(*,*) bla
end program test
I am compiling with the options -g -O0.
Using Totalview (Linux x86 TotalView 8.7.0-5) I have set a breakpoint onto the write statement and would like to retrieve the value of the variable bla with the following observations:
ifort (Intel(R) Fortran Compiler Professional for applications running on IA-32, Version 11.0 Build 20081105 Package ID: l_cprof_p_11.0.074):
The correct value for bla is shown.
xlf90 (IBM XL Fortran Advanced Edition for Blue Gene/P, V11.1)
The correct value for bla is shown.
gfortran (gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux) ):
The expression window says <Bad address: 0xffffffff>.
I tried the following suggestions that are given elsewhere in this forum:
Tools->FortranModules window --> the window is empty in my case
modifying the expression to myvar`bla --> Bad address The only solution that worked for me was to switch to assembler mode and inspect the variable therein. Obviously, there it is called __myvar_MOD_bla. Hence changing the expression in the expression window to __myvar_MOD_bla somehow solved the issue: The correct value is shown then.
While this can be considered a solution, it is very unhandy to modify any variable name by hand in the expression window. Additionally, this demands knowledge about the correct module, the variable comes from, which is very nasty in large codes that were written by somebody else.
I already tried a lot of compilation flags that modify the debug code generation of gfortran/gcc, but unfortunately, I couldn't find a working solution.
Do you know any simpler way to inspect module variables in gfortran-compiled code, or even to generate debug information, that just works correctly with Totalview?
Thank you in advance,
Mathias
I am (as maybe many others) struggling with diving into module variables. A simple example is the following:
module myvar
integer :: bla
end module myvar
!-------------------------
program test
use myvar
implicit none
bla = 5
write(*,*) bla
end program test
I am compiling with the options -g -O0.
Using Totalview (Linux x86 TotalView 8.7.0-5) I have set a breakpoint onto the write statement and would like to retrieve the value of the variable bla with the following observations:
ifort (Intel(R) Fortran Compiler Professional for applications running on IA-32, Version 11.0 Build 20081105 Package ID: l_cprof_p_11.0.074):
The correct value for bla is shown.
xlf90 (IBM XL Fortran Advanced Edition for Blue Gene/P, V11.1)
The correct value for bla is shown.
gfortran (gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux) ):
The expression window says <Bad address: 0xffffffff>.
I tried the following suggestions that are given elsewhere in this forum:
Tools->FortranModules window --> the window is empty in my case
modifying the expression to myvar`bla --> Bad address The only solution that worked for me was to switch to assembler mode and inspect the variable therein. Obviously, there it is called __myvar_MOD_bla. Hence changing the expression in the expression window to __myvar_MOD_bla somehow solved the issue: The correct value is shown then.
While this can be considered a solution, it is very unhandy to modify any variable name by hand in the expression window. Additionally, this demands knowledge about the correct module, the variable comes from, which is very nasty in large codes that were written by somebody else.
I already tried a lot of compilation flags that modify the debug code generation of gfortran/gcc, but unfortunately, I couldn't find a working solution.
Do you know any simpler way to inspect module variables in gfortran-compiled code, or even to generate debug information, that just works correctly with Totalview?
Thank you in advance,
Mathias