- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

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