Setting/Using Data breakpoints in Visual Studio with Fortran?

Setting/Using Data breakpoints in Visual Studio with Fortran?

I am trying to find any information about if/how I can use data break points with the Inter compiler through Visual Studio. At my office, we still use the old Compaq 6.6 Fortran + Visual Studio 6 because data break points "just work" and are simple to use. I'd like to migrate to newer versions of software, but cannot find any good information on how to implement data break points successfully.

I have access to Intel Visual Fortran 9, 10, 11, and 11.1 as well as any version of Visual Studio from 2005 onwards. Is there anyway any combination of these products can support data break points in a manner analagous to what the old stuff did so easily?

All I have found through some Googling is the following page: Using Breakpoints in the Debugger

And it has not proven successfull. Any help or a point in the right direction would be appreciated, thanks.

20 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

May be the attached snaptshots will help.

The data breakpoint appears in the breakpoint window's "New" dropdown menu. It will be ungreyed only after debugging has been started.

For Fortran variables, use LOC() function.



Downloadimage/png DataBreak1.png79.09 KB
Downloadimage/png DataBreak2.png11.07 KB

Thanks, I had tried using the LOC function in other ways, but never in that dialog. I tried it, it says that a data break point has been set on the memory location holding my variable, but that variable changes and it never breaks. This is using Intel Visual Fortran 10.0.027 and Visual Studio 2005. I attached a screen shot showing the simple driver program and the supposedly set break point that never triggers.


Downloadimage/png dataBreakPoint1.png79.32 KB


It has always worked for me. Just to be sure, I have attached two snapshots: first shows how I set up the data break-point while the second shows it getting hit.

I am using VS2005 on WinXP64 PRO with IVF composer XE update 1. But the databreakpoint has also worked for me in IVF 11.1 and, I think also in IVF version 10. Unfortunately, I don't have v10 anymore and I am surprised that it does not work there.



Downloadimage/png DataBreak3.png69.24 KB
Downloadimage/png DataBreak4.png70.04 KB

The documentation spells out how to do data breakpoints and I have excerpted this below. This isfrom the current version of the documenation (i.e. 12.0 compiler). Note the 10.1 compiler is no longer supported but expect it worked in a similar manner. If you have access to a newer compiler I would suggest using it.



Attaching or including files in a post

Working with Data Breakpoints

Use a data breakpoint to interrupt program execution when the value of a certain variable changes. A data breakpoint displays a message box when the value of a variable changes, or, if a condition has been defined, when a condition is met. Unlike a file breakpoint, data breakpoints are not associated with a specific source location.

Using Visual C++ Data Breakpoint Support

The Visual Studio IDE does not provide data breakpoint support specifically for Fortran. Nevertheless, you can still use data breakpoints in a Fortran program; they are handled using the existing mechanism provided by Microsoft Visual C++. This means that you must use Visual C++ syntax; yo u cannot enter the variable name or condition using Fortran syntax. The following guidelines apply:

  • For scalar variables, enter the variable name in upper case. This allows Visual C++ to find the variable in the debug information and apply the correct breakpoint.

  • For arrays and types, use the Fortran LOC intrinsic function in a Watch window or the Immediate window to obtain the address of the variable. Use this address in the variable name edit box.

For example, to prepare to set a data breakpoint at an array element a(5), do the following:

  1. Select Debug>Windows>Immediate.

  2. Enter loc(a(5)) in the immediate window and press Enter.

    The result displayed is the address of the array element. The address may be displayed as a decimal number or a hexadecimal number, depending upon your current display mode. For a decimal number, you will enter it in the Address: field (Visual Studio 2005 and Visual Studio 2008). For a hexadecimal number, you will use the Visual C++ hexadecimal syntax (0xnnnnnnnn) rather than the Fortran syntax (#nnnnnnnn) in the fields.

The following procedure applies to debugging the current routine (current scope).

To set a data breakpoint (Visual Studio 2005 and Visual Studio 2008):

  1. Start debugging.

  2. In the Debug menu, select New Breakpoint, then New Data Breakpoint...

  3. Enter the desired address. Also enter the Byte Count and Language (be sure to specify C++).

If you want to associate a condition with this breakpoint, right-click on the breakpoint in the Breakpoints window and choose Condition....

To disable, enable, or remove a data breakpoint:

  1. In the Debug menu, select Windows>Breakpoints.

  2. To disable or enable the data breakpoint, use the check box to the left of the data breakpoint (check indicates enabled).

  3. To remove a data breakpoint, click (select) the data breakpoint and click the Delete button.

Under certain conditions, the debugger may disable a data breakpoint. In this case, you should either try to enable it or remove and set it again.

To remove all breakpoints (including file breakpoints):

In the Debug menu, select Delete All Breakpoints (Visual Studio 2005 and 2008).

Wendy, yes, that was the page I found and linked in the original post to this thread and I am following those directions to the letter. Per your suggestion, I have downloaded the evaluation version of IVF Composer XE 2011, and am running it at my office with Visual Studio 2010 and am still not getting data breakpoints to actually break when memory at a certain location changes.

Is there some setting that must be turned on in order for this to work? I have attached another screen shot that shows:
A.) The code
B.) The file break point which works fine
C.) The breakpoints display that shows to break when 0x002EF8E8 changes
D.) The memory region highlighting the 4 bytes starting at 0x002EF8E8
E.) The result of each changing, yet no break occured.

If I am missing something obvious, please let me know. I will try this again with VS2005 + IVF Composer XE as mentioned above (and shown to be working) to see if it is some odd compatibility thing.

EDIT: I have added a second image that shows the count on each break point and it is clear that the second one, the data breakpoint, was never hit.


I have reproduced what you are seeing and the databreakpoint is not hit unless you set a breakpoint at the end of the program too (then the data breakpoint is hit). Is this a workaround for you?

Meanwhile I have reported the data breakpoint not being hit as a bug, engineering bug database #DPD200165615

and you will be notified in this thread when it is fixed.

Thanks for reporting it.



Attaching or including files in a post

Quoting Wendy Doerner (Intel)

I have reproduced what you are seeing and the databreakpoint is not hit unless you set a breakpoint at the end of the program too (then the data breakpoint is hit).

Wendy, thanks for the suggestion. I added a file (line?) breakpoint on the line the contains the "end program ...." statement, but still did not get the data breakpoint to break properly. I wonder if I am misunderstanding what you are saying when you suggest adding a break point to the end of the program. Could you tell me if I am not implementing your suggestion properly? I have attached another screenshot showing what I am doing.

Thank you for your continued help with this matter.


Downloadimage/png dataBreakPointQuestion.png122.1 KB

Yes that is where I set a breakpoint and it hit the data breakpoint when that breakpoint was present.

Here are the steps I took:

1. Set two breakpoints as you noted.
2. Ran and hit the first line breakpoint.
3. "Continue"
4. Hit databreakpoint
5. Continue
6. Hit 2nd line breakpoint

Since you are setting the data breakpoint on an address (as was I) I wonder if you might setting it on the variable name in case your memory is being layed out differently.

Also check you have /Zi for debug information.



Attaching or including files in a post

Wendy, here are the command compile/link options I am running with:

/nologo /debug:full /Od /warn:interfaces /module:"Debug\" /object:"Debug\" /Fd"Debug\vc100.pdb" /traceback /check:all /libs:static /threads /dbglibs /c /Zi

I added the /Zi manually. I have tried entering the data break point using both the address and the LOC(J) statement. Neither has broken on the data breakpoint. Is there something I am missing, because I am at a loss as to why this works for you, but not for me. Thanks for your continued help.

I am checking with engineering, perhaps the lack of reproducability is related to the original bug. Also Iasked for another workaround. Meanwhile I am posting my whole solution which has the same options as yours (/Zi is a duplicate of the debug switch). It is a VS 2010 project. Is this the version of Visual Studio you have? If so can you try this to see if you hit the data breakpoint. If not, which version do you have and I will try to reproduce on that version.

If you can, you can post your zipped up directories with project and solution and I can see if I can reproduce from that.




Attaching or including files in a post


Downloadapplication/zip Console8.zip812.06 KB

Yes, I am using Visual Studio 2010 Professional (if that makes any difference) Version 10.0.30319.1 RTMRel

I loaded your project and got the same results, namely no break when the variable 'j' changes (I changed the details of the data break point so that it would match my compilation). I have zipped up my project (Console1), and have attached it to this post. Hopefully it will aid in debugging.


Downloadapplication/zip Console1.zip6.38 KB

Thanks for your project. I don't break at all in your project after setting the data breakpoing using &j, but engineering can get it to work. I am checking with them on exact steps and will post here.



Attaching or including files in a post

Ok I got it work with captializing the "j". So for the data breakpoint give the value &J

It states in the documenation you have to use C format for the data breakpoints and capitalize the variable names.

Can you try this?



Attaching or including files in a post

Wendy, thanks for the continued help. I have two problems with the latest steps you presented.

First, if I set a data breakpoint on &J (DataBreakPointStep1.png) using my Console1 project, I get told in this instance that the program will break when 0x002DFA34 changes (DataBreakPointStep2.png). According to Visual Studio's Memory analyzer (top left), this is holding what appears to be garbage not equal to what the local variable watch (lower left) says J is currently set to. Now, if I set another data breakpoint on LOC(J) (DataBreakPointStep3.png) I am informed that the data breakpoint is set to trigger when 0x002DF964 changes (DataBreakPointStep4.png)! Looking at the memory at 0x002DF964 (top center/right) shows that it is the same as what the debugger is telling me exists in the variable j. This leads to the obvious conclusion that something is awry with using the &var syntax on my combination of VS and IFORT.

Secondly, stepping through the project (or hitting continue and letting it run) shows that the memory at 0x002DF964 (the LOC(J) memory address) does indeed change when the variable J changes, but the memory at 0x002DFA34 (the &J memory address) does not change when J does. The change in j, however, does not trigger either data break point (DataBreakPointStep5.png). When we reach the end of the program, the Hit Count clearly shows that the line breakpoints were each hit once (as expected), but both data breakpoints were hit 0 times (DataBreakPointStep6.png).

I have tried this both with setting the "Language" option in the Data Breakpoint screen to C (as implied in your previous post) and to C++ (as the documentation states) and have gotten the same results; namely two different memory addresses between &J and LOC(J) and no data breakpoint being hit.

Again, thank you for working with me on this issue, and please let me know if I can provide any other information that could be of use to you and the engineering team.


Thanks for the detailed analysis. Does the same thing happen on my project or does my project work for you?



Attaching or including files in a post

Quoting Wendy Doerner (Intel)

Thanks for the detailed analysis. Does the same thing happen on my project or does my project work for you?

If I attempt to set a breakpoint using &J in your project (Console 8), it returns a breakpoint "When 0x00000000 changes (4 bytes)" which I can pretty much assume is incorrect without further investigation. Again, using LOC(J) returns a location that appears (through the memory view) to match what is actually stored in J.


Any news on a fix?

I have been relying on this functionality for a long time (and many years ago with SGI's dbg). I recently switched to IVF 11.1.3470.2005 (VS 8.0.50727.762) and this stopped working reliably.

I am checking with engineering and will update you on status.



Attaching or including files in a post

Some possible causes of your inability to set the breakpoint on J:

1) Engineering suggests you may not have the Fortran Expression Evaluator installed correctly after looking at your screen shots.

To check to see if that is the problem please post the results of Help=> About in Microsoft Visual Studio ( I have copied mine and notice I have entries for Fortran).

Microsoft Visual Studio 2010

Version 10.0.30319.1 RTMRel

Microsoft .NET Framework

Version 4.0.30319 RTMRel

Installed Version: Professional

Microsoft Office Developer Tools 01018-532-2002102-70285

Microsoft Office Developer Tools

Microsoft Visual Basic 2010 01018-532-2002102-70285

Microsoft Visual Basic 2010

Microsoft Visual C# 2010 01018-532-2002102-70285

Microsoft Visual C# 2010

Microsoft Visual C++ 2010 01018-532-2002102-70285

Microsoft Visual C++ 2010

Microsoft Visual F# 2010 01018-532-2002102-70285

Microsoft Visual F# 2010

Microsoft Visual Studio 2010 Team Explorer 01018-532-2002102-70285

Microsoft Visual Studio 2010 Team Explorer

Microsoft Visual Web Developer 2010 01018-532-2002102-70285

Microsoft Visual Web Developer 2010

Intel Visual Fortran

Intel Visual Fortran Composer XE 2011 Integration for Microsoft Visual Studio* 2010, 12.0.3470.2010, Copyright (C) 2002-2011 Intel Corporation

* Other names and brands may be claimed as the property of others.

2) Also we are testing on the 12.0 version of the compiler and I think you are using 11.1 (Both engineering and I can set the breakpoint on LOC(J) correctly and have it finish even without the breakpoint at the last statement). Would it be possible for you to try 12.0? 11.1 is actually not supported in VS2010 so that may also be a source of the problem.



Attaching or including files in a post

Leave a Comment

Please sign in to add a comment. Not a member? Join today