Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
7 Views

Q about debugger usage

I want to monitor one particular location in an array to see where in the code it is being "clobbered."

 

I tried many various IF statements, but so far nothing has isolated the problem.

 

wasn't there something called a WATCH command in the debugger?

Haven't used it in a long time, so not sure - is there an example somewhere ?

0 Kudos
1 Reply
Highlighted
Black Belt
7 Views

You can set a data breakpoint, that can trigger when an operation occurs on data at a certain address in memory.  To add a data breakpoint the program already needs to have started running - ideally it would be paused at a normal breakpoint ahead of where you expect the clobbering, but after the point where the storage for the relevant array has been created.  At this point you can use Debug > New Breakpoint > Data breakpoint,  For the address you may use a fortran-like expression, such as `LOC(array(5))` - i.e. the memory location of the fifth element of the variable named array.

(Details may vary slightly depending on Visual Studio version.)

 

0 Kudos