- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
Firstly, I am 'semi-new' to Fortran so I can't describe my problem clearly and provide enough information, just let me know. I can explain it later again.
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'.
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
Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First of all, there are no "global variables" in Fortran. Subprograms may share variables through COMMON blocks or modules, and a compiler may provide methods to access external variables declared as global in C/C++ programs linked to Fortran subprograms.
Secondly, if you want to be able to view in the debugger all variables in the source code, you have to prevent the optimizer from eliminating superfluous variables and allocating variables to registers, by choosing suitable compiler options.
It would help if you were to provide a short example source code that illustrates what you are trying to accomplish.
Secondly, if you want to be able to view in the debugger all variables in the source code, you have to prevent the optimizer from eliminating superfluous variables and allocating variables to registers, by choosing suitable compiler options.
It would help if you were to provide a short example source code that illustrates what you are trying to accomplish.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As mecej4 said, a short example is always useful.
Meanwhile, if you are referring to module variables, see if the following works:
ModuleName:: ModuleVariableName
The debugger should be able to show it. Of course, once again as mecej4 said, you also need to have correct compiler options enabled. For example, in this case of "parameters" you will need to enable the corresponding option -- /debug:parameters
Abhi
Meanwhile, if you are referring to module variables, see if the following works:
ModuleName:: ModuleVariableName
The debugger should be able to show it. Of course, once again as mecej4 said, you also need to have correct compiler options enabled. For example, in this case of "parameters" you will need to enable the corresponding option -- /debug:parameters
Abhi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply.
Ok, there is one module where I defined all the variables to be shared with all subroutines.
I can make up the one simple example.
say:
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.
My guess is I did not choose the suitable complier options.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Ian0907
Is " A::x" also failing to show it? Are you building the project in a debug mode?
Abhi
Is " A::x" also failing to show it? Are you building the project in a debug mode?
Abhi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am sure that I used debug mode.
A is defined as module, just todeclareall the variables. I tried to set a breakpoint in A, but it never stop at that part.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ian0907
If the module has only variables, you can't set any breakpoints there. Please see the attached screenshot fiel ModuleVar.png. At the breakpoint, in the watch window, variables j and k can be seen as OM:: J, OM:: K.
That the variable J is accessible directly is, I think, because the main program is using it.
The snapshot is created with IVF 11.1.065 with VS2005 on WinXP64. I used the default debug setting.
Abhi
If the module has only variables, you can't set any breakpoints there. Please see the attached screenshot fiel ModuleVar.png. At the breakpoint, in the watch window, variables j and k can be seen as OM:: J, OM:: K.
That the variable J is accessible directly is, I think, because the main program is using it.
The snapshot is created with IVF 11.1.065 with VS2005 on WinXP64. I used the default debug setting.
Abhi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Abhi,
Thanks for help. However, I can't open your attached files.
To make my problem clear, 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.
--
Lan

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page