- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is it possible to set a watch on a variable to see when and where in the program a variable is changed?
Best regards
Reidar
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What front end are you using? And do you want the program to break when the variable changes?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
in general you set watchpoints in Fortran just as you do in C/C++. This is true for the Linux* hosted Intel Debugger (IDB) as well s for Visual Studio as was just pointed out.
The problem with Fortran watchpoints is that the concept of global variables is not a Fortran concept. Thus you have to be more careful with the scope of the variable you set your watchpoint on than in C/C++.
Let's assume yo are using IDB on the command line. Thus you are basically following GDB syntax for watchpoints.
The question then becomes - What sort of variable are you trying to set your watchpoint on and how is it declared? (E.g. in a module, in a common block, locally, ...). Depending on circumstances, you may need to specify the module name, e.g.
(idb) watch module_name%%variable_name
Thanks, Rob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- yes, I want the program to breakwhen a specific varaiable has beenchanged.
(sometimes a variable is changed unexpected - the the debug/watchis helpful)
Best regards
Reidar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Rob,
I am not familiar with C/C++,nor the IDB command line....
The background for my question is of course that it happened again: Somewhere
in my program a variable has been changed, and I do not undrestand why.
When we used the VAX/VMS system (1983..)you could just write "WATCH
and then the program stopped and displayed the code segment where the variable was changed.
But I have never managed to do this in CVF or VS2005
The variable can be of any type, of course the most troublesome might be the global
variables, and I use modules rather than common blocks.
From what I understand from you I may achieve what I want by using the command line?
Best regards
Reidar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My coworker and I do this/use these ALL the time, so if something in there isn't clear let me know and I'll see if I can help you clear it up.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page