Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28446 Discussions

Variables (defined in Module) cannot be viewed after clean solution and project

lan0907
Beginner
693 Views
Dear all,
Sorry for the second thread on similar problem as I posted yesterday. This morning I tried different solutions. Here I want to describe the problem in a better way.
So here is the problem:
I am now working on a huge Fortran project (code) which contains numerous variables and subroutines. I made a copy of the original project, and changed several lines in one subroutine. Then I started debugging. Everything runs correctly from beginning to the end. The only thing is now I cannot view the variables defined in the module file. However, in the original project (code), this does not happen.

When I tried to debug the my COPIED Fortran code using breakpoint in the one of the subroutine, I can only view the local variables for the global ones (defined in the module) the debugger gave me message as 'cannot view register variables'.
CAUSE:
I tried to use the original project file which can view the variables and change some lines. Up till this point, everything is fine. Project run correctly and I can view all the variables. Then I clicked the clean solution and clean project. After that, I tried to debug again. The problem appeared again?!
Who knows why and how can I solve this?
Example:
module A
integer:: x
end module
subroutine B
use A
integer:: y
.....
end subroutine B
So I set some breakpoints in subroutine B. I can view values for y, but for x the debugger gave me the error message.
Solutions Tried so far:
1. I compared 'project/property' for the original project and the copied one for everything. They are the SAME!
2. Then I tried to create a new project, and add all the source files into that. The code run correctly, but still I can't view the variables defined in the module?!
I am using Fortran Complier 10.0.027 and Visual Studio 2005.
Thank you in advance.
--
Lan
module Ainteger:: xend modulesubroutine Buse Ainteger:: y.....end subroutine BSo I set some breakpoints in subroutine B. I can view values for y, but for x the debugger gave me the error message.
0 Kudos
15 Replies
jimdempseyatthecove
Honored Contributor III
693 Views
>>'cannot view register variables'.

This means that you are not using the Debug build of the module (and project) or that you optimized the debug build.

The debugger, especially withthe older IVF version you have, has problems examining variables that have been registerized. Using any level of optimization will registerize some variables.

You can vary the optimization options on a per file basis. You would do this late in debugging when you wish to cut down on the run time for the source files already debugged. However, when you debug a source file that contains a USE yourModuleHere you must link with the debug version of the.MOD and .OBJ file for that mod file when present.

Jim Dempsey
0 Kudos
jimdempseyatthecove
Honored Contributor III
692 Views
Also, in the VS debugger, try scoping the module

A::x

Jim
0 Kudos
lan0907
Beginner
692 Views
Thanks for the reply. I am sure that I am using debug mode.
One question here is cone to link with the debug version of the .MOD and .OBJ files?
0 Kudos
abhimodak
New Contributor I
692 Views
Hi Lan

I believe that you will need .mod and .obj built with the debug options.

Abhi
0 Kudos
Steven_L_Intel1
Employee
692 Views
The .mod is an input to the compiler only and is not involved in debugging.
0 Kudos
lan0907
Beginner
692 Views
OK, I am confused about all the discussions on .mod and .obj now. Is there any direct instructions on how to set them before I start to debug?
Thanks
0 Kudos
Steven_L_Intel1
Employee
692 Views
I don't know what you want to "set". If you build the application in a Debug configuration, all the necessary settings are applied. I wonder if in your "copying" you are still using some pieces from the original project.

You are using an old version that does not provide for "simple" view of module variables. The modname::varname syntax Jim describes works if you type it in a Watch window.
0 Kudos
krishnabc
Beginner
692 Views
Hi Lan,

You try compiling the project (in debug mode) without any optimization (/Od). Youshould be able to view all the variables. You can set this at Project property pages>Fortran> Optimization.

Krishna
0 Kudos
lan0907
Beginner
692 Views
With the modname:: varname typed in the watch window, now I can view all the variables.
Still confusing why it happened. I am not using some pieces from the original project, but using 99% of the original project.
Anyway, thanks for all replies from everyone. I was in a little rush status when I read the solutions in the afternoon. Sorry for that.
0 Kudos
lan0907
Beginner
692 Views
I am back with the new maybe 'simple' question. By the way, I am sure optimization is disabled.
As some of you mentioned, the code is not linked with .MOD and .OBJ. I found that in the 'Project Properties\general', under 'extension to delete on clean', there is *.obj, *.mod, and a lot of other stuffs. Is that the cause for the problem?
The following up question is how to link them back?
0 Kudos
Steven_L_Intel1
Employee
692 Views
It is normal for those files to be there following a build. You don't have to do anything about it.
0 Kudos
jimdempseyatthecove
Honored Contributor III
692 Views
>>As some of you mentioned, the code is not linked with .MOD and .OBJ. I found that in the 'Project Properties\general', under 'extension to delete on clean', there is *.obj, *.mod, and a lot of other stuffs. Is that the cause for the problem?

"Clean" will delete the files that you build. It will not delete files that are in your include path nor lib path nor other additional paths or dependenciesthat can be set in the project.

In the project settings for the Linker, add option VERBOSE:LIB

Then perform "Rebuild all"

after build, Ctrl-Click on link to build log, examine log for what was linked in with respec to the module code in question. This should show you the path of what was loaded *** and missingwhat was not loaded.

I suspect that the currently built .obj file for the .mod file might not be loaded as the function code symbol had been resolved by something else loaded earlier (which has variable registerized).

Jim Dempsey
0 Kudos
lan0907
Beginner
692 Views
Hi Jim,
I added the option in Linker and checked the build log. It seems that all source files are linked. I found the module files.
But still the problem exists, I can't view them directly during debug.
What is the lines in the build log means:
/VERBOSE:LIB &quotx64\Debug/muc_mod_td.obj", ....etc. (There are many other information like this and sometimes it is the subroutine files'
muc_mod_td is my source file for the module where I defined all the variables.

Thanks
--
Lan


0 Kudos
jimdempseyatthecove
Honored Contributor III
692 Views
Lan,
[bash]module A
integer:: x
end module
subroutine B
use A
integer:: y
.....
end subroutine B
So I set some breakpoints in subroutine B. I can view values for y, but for x the debugger gave me the error message.
[/bash]


When at break point in subroutine B, did you try entering

A::x

As the variable name in the watch window?

"::" is a scoping directive to the Debugger symbol lookup function

You still should not have seen variable was registerized without scope operator.
If x not visible then the error message should have been "variable not found"

Jim
0 Kudos
lan0907
Beginner
692 Views
Hi Jim,
Yes, by typing A::x in the watch window I can view the value for x.
Previously, I can view the x directly in the code when I move the mouse pointing x. Just want to understand, why this is happening.
Thanks,
--
Lan
0 Kudos
Reply