Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29300 Discussions

How to trigger a breakpoint when a particular variable goes negative?

Anthony_Richards
New Contributor I
1,235 Views

Is there a way to get the debugger to do this? How?

0 Kudos
6 Replies
LRaim
New Contributor I
1,235 Views

Insert a break point where the variable is used. Then by right-clicking on the red-ball you can select  insert condition and type e.g. XYZ .LT. 0.0

0 Kudos
Steven_L_Intel1
Employee
1,235 Views

You can also set a data breakpoint that will check the variable anywhere it is changed in a routine, but I like Luigi's suggestion better.

0 Kudos
FortranFan
Honored Contributor III
1,235 Views

See this other thread for some added discussion on breakpoints:

https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/508526

 

0 Kudos
Anthony_Richards
New Contributor I
1,235 Views

The variable is defined in multiple places in the subprogram, so I want to cover all those places at the same time without having to insert code everywhere.

So, Steve, how is that done?

0 Kudos
mecej4
Honored Contributor III
1,235 Views

There is hardware support (using the debug registers of the CPU) for watching the contents of four addresses and trapping accesses to those addresses. Watching all variables in the program without localization to a specific line of code (and, even worse, watching arbitrary expressions) would be prohibitively expensive -- after every CPU/FPU instruction, the specified expression would have to be evaluated.

If you want to enable  a program-wide watch on an expression, assign a variable to the expression at the beginning of a block of code that you suspect to contain a bug, be sure to update the new variable whenever any of the variables in the expression changes. You have only four arrows (DR0 to DR3) in your quiver to slay the beast.

0 Kudos
Steven_L_Intel1
Employee
1,235 Views

I wish I could tell you how to do this, but the VS debugger has broken data breakpoints for Fortran and I am not sure how to work around it. I need to ask our debugger developers if they know how to resolve it.

0 Kudos
Reply