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

Capture changes to a variable using data breakpoints



See also


Set a normal breakpoint in the code so you can choose a variable. Then run the debugger (F6).

Setting Code Breakpoints


When the program has hit the breakpoint, select the variable of interest and from its context menu, select the 'Break When Variable is Modified' option.

View the Local Variables


There are no breakpoint indicators in the code, but data breakpoints are easily recognizable in the Breakpoints & Events window, being a blue icon with a white diamond. Enterprise Architect displays the name of the variable and its address instead of a line number.

View Variables in Other Scopes


With the data breakpoint set, you can disable any other breakpoints you may have. The program will stop at any line of code that changes this variables value. Now run your program.


When this variable is modified, the debugger halts and displays the causing line of code in the editor, and logs the event to the debugger window

Now we know how and where this value (its State) has changed. For example, the statement at line 58 has just updated the number of Passengers:


Having discovered this and other places where this value is being changed, be sure to get rid of the notification before moving on. You can delete the data breakpoint quickly by selecting it in the Breakpoints window and pressing the Delete key.

You can also use the right-click context menu to do this.


  • 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