You can use a watchpoint to stop execution whenever the value of an expression changes, without having to predict a particular place where this may happen. The expression can be a variable, a function call, or any other valid mpC expression.
To set a watchpoint at design time or in break mode
In the Text Editor window, move the insertion point to the line of code where you want to set a watchpoint and right-click in the selection margin.
From the context menu choose:
Add watchpoint. The Watchpoint dialog appears.
In the Watchpoint dialog:
Enter a watchpoint expression in the Expression text box.
Select or enter a filename you want to set a watchpoint in.
Enter number of the line where you want to set a watchpoint. By default there will be number of the current line.
Enter conditional expression. Each time when value of a watchpoint expression changes the conditional expression is evaluated, and your program stops only if the condition is TRUE. (See also Changing watchpoint condition). By default the field is empty. In this context an empty condition expression is always TRUE.
Enter "ignore count" of a watchpoint. "ignore count" is number of times to skip a watchpoint before stopping. For example, if the ignore count value is N, the watchpoint does not stop the next N times the watchpoint expression changes. By default the ignore count value is 0. (See also Setting "ignore count" of a watchpoint)
- or –
Debug Object manager. The Debug Object manager dialog appears. In the Watchpoint tab click Add. The Watchpoint dialog appears. Follow the instruction from the previous item. Another way to display the Debug Object manager dialog is to click Edit -> Watchpoints.
When you set a watchpoint, an oval is displayed in the selection margin of the Text Editor window next to the line containing the watchpoint. The oval is cyan if the watchpoint is enabled and gray if disabled.