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

Conditional data break points

michaels
Beginner
715 Views

Hello,

I am trying to use data breakpoints that are conditional on the value of an array. To clarify - I can establish data breakpoints that are triggered when an array value changes, however I am specifically interested in establishing data breakpoints that are conditional on the value of an array.

Below is a sample program to illustrate my point:

****
program exception_test_speed

real*4 :: distance(1:3)
real*4 :: time(1:3)
real*4 :: speed(1:3)
integer*4 :: itrial

distance(1)=100
distance(3)=0
distance(5)=100

time(1,1)=10
time(1,2)=0
time(1,3)=6

speed(:,:)=0

do itrial = 1,5
speed(itrial)=distance(itrial)/time(itrial)
end do ! itrial

end program

****

How do I establish a data breakpoint that is conditional on any value of the array "speed" being equal to NaN (the result of 0/0)? I am specifically interested in the code that is written in the conditional break point dialogue box after the data breakpoint has been established.

0 Kudos
2 Replies
Steven_L_Intel1
Employee
715 Views
First, you can't break by testing for NaN, as far as I know. Second, data breakpoints are not available if you are using the bundled Visual Studio 2005 Premier Partner Edition. Third, data breakpoints are flaky in Visual Studio and don't always work. Fourth, the program you posted has numerous errors relating to array bounds. That said...

You can set a breakpoint to notify you when a value changes - at least in VS2005, you can't specify a value to compare against. (Funny, I recall doing this in the past - not sure what's changed...)

Set a breakpoint at the first executable statement in the program and begin execution. When the breakpoint is hit, select Debug > New Breakpoint > New Data Breakpoint. In the Address field, type in the name of the variable (can be an array element), such as speed(1). In the Byte Count field, enter 4 (assuming default integer or real). Leave the "Language" as "C". Click OK and then continue execution. You should get a breakpoint when the specified value changes.

By the way, please do not write:

speed(:,:) = 0

use this instead:

speed = 0


0 Kudos
jimdempseyatthecove
Honored Contributor III
715 Views

Michaels,

If you are generating NaNs and want to selectively test then insert the test into your fortran code

if(ISNAN(speed(itrial)) call DebugThis

Jim Dempsey

0 Kudos
Reply