Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Contents
Prev Next

Trace When Variable Changes Value

When your code executes, it might change the value of a variable. It is possible to capture such changes and the variable's new value, on the Debug window. You can then double-click on the change record to display the line of code that caused the change, in the Code Editor.

Access

Ribbon

Execute > Windows > Local Variables : Right-click on variable > Trace When Variable is Modified or

Execute > Windows > Watches : Right-click on variable > Trace When Variable is Modified

Other

In Code Editor | Right-click on variable | Trace When Variable Modified

Set up Trace

The variable you are tracing must be in scope, so to identify and select it, set a normal breakpoint on the line of code where you know that the variable will exist. When the debugger reaches this breakpoint, locate the variable and use its context menu to enable the trace.

To locate a variable:

  • If you see the variable in the source code, hover over it, right-click and select the 'Display variable' option; Enterprise Architect will locate it
  • If the variable is in scope (a local, or 'this' or a member of 'this'), look for it in the Locals Window ('Execute > Windows > Local Variables')
  • If the variable is global (C, C++), display the Watches window ('Execute > Windows > Watches') and search for it by name
  • If the variable is a Class static member, display the Watches window ('Execute > Windows > Watches') and enter its fully qualified name

Once trace is enabled, you can disable all other breakpoints and let the program run. Each time the variable changes value, it will be logged to the 'Output' tab of the debugger. Check the change in value and double-click on the line to display the code in the Code Editor.

Notes

  • The debugger does not halt when the change event occurs, it only logs the change
  • This facility is available on the Microsoft Native and Java platforms
  • Microsoft .NET does not support breakpoints on values

Learn more