Break When a Variable Changes Value

Data breakpoints can be set on a pre-determined memory variable to cause the debugger to halt execution at the line of code that has just caused the value of the variable to change. This can be useful when trying to track down the point at which a variable is modified during program execution, especially if it is not clear how program execution is affecting a particular object state.

Access     Analyzer | Locals: right-click on variable | Break When Variable is Modified, or
Analyzer | Watches: right-click on variable | Break When Variable is Modified

Set a data breakpoint

Steps

Detail

See also

1

First set a normal breakpoint at a point in the code that presents the required scope of local variables to choose from.

 

Setting Code Breakpoints

2

Press F6 to execute the debugger; once the program has halted execution, right-click on the variable of interest and select the Break When Variable is Modified context menu option.

This example creates a notification on the Passengers integer member of the CTrain Class, in the Locals window.

 

VEA-VariableNotification

 

View the Local Variables

3

There is no breakpoint indicator in the code, but in the Breakpoints & Events window, the data breakpoint displays as a blue circle in the Enabled column.

Continue to execute the debugger; when the variable changes and the debugger halts, the line of code is highlighted in the Source Code Editor and the log in the Debug window prints a statement reporting the effect.

 

View Variables in Other Scopes

Notes

This feature is not presently supported by the Microsoft .NET platform
 

Learning Center topics

(Alt+F1) | Enterprise Architect | Build and Debug | Debug | Add Data Breakpoint