TotalView User Guide : Part II: Debugging Tools and Tasks : Examining and Editing Data and Program Elements : Displaying Fortran Types : Displaying Fortran Parameters
Displaying Fortran Parameters
A Fortran PARAMETER defines a named constant. If your compiler generates debug information for parameters, they are displayed in the same way as any other variable. However, some compilers do not generate information that TotalView can use to determine the value of a PARAMETER. This means that you must make a few changes to your program if you want to see this type of information.
If you’re using Fortran 90, you can define variables in a module that you initialize to the value of these PARAMETER constants; for example:
INCLUDE ‘PARAMS.INC’
MODULE CONSTS
SAVE
INTEGER PI_C = PI
...
END MODULE CONSTS
The PARAMS.INC file contains your parameter definitions. You then use these parameters to initialize variables in a module. After you compile and link this module into your program, the values of these parameter variables are visible.
If you’re using FORTRAN 77, you can achieve the same results if you make the assignments in a common block and then include the block in main(). You can also use a block data subroutine to access this information.