PDA

View Full Version : Module Variables again



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

PeterT-RogueWave
08-23-2010, 07:49 AM
Hi,

As you may expect the problem is in the gfortran debug info. You don't say which platform you are running on, but the version of gfortran you are using is a bit old at this point, and work has been done on the compiler to improve the debug info. I would highly recommend gfortran 4.4.+ at this point. I just tested that on my linux x86-64 machine and diving on bla works fine. I'd also recommend our latest TotalView 8.8.0-2.

Regards,

mathias
09-06-2010, 09:27 AM
Hi Peter,

thank you for your answer (and sorry for my late reply).

I updated to "GNU Fortran (GCC) 4.6.0 20100824 (experimental)" (just for the fun of compiling the compiler by myself [sly] and because I wanted to try out some other new features) and digging into module variables now works as expected. [:)]

Regards,
Mathias