A "watchpoint" is a special breakpoint that stops your program when the value of an expression changes. You must use a different command to set watchpoints, but aside from that, you can manage a watchpoint like any other breakpoint: you enable, disable, and delete it. You can use a watchpoint to stop execution whenever the value if an expression changes, without having to predict a particular place where this may happen. Just like breakpoint a watchpoint may have its conditional expression and its "ignore count". Watchpoint condition must meet the same requirements as breakpoint condition. Watchpoint can be set for all processes of a parallel program or for a group of processors only (see also Breakpoints overview). You can add a watchpoint either at design time or when your program is stopped at breakpoint (in break mode).
Setting a watchpoint you specify an expression to be evaluated. The watchpoint expression can be any syntactically correct mpC expression. The expression is evaluated, and subsequently, each time the value of the expression changes, the program stops, and the new value is displayed in the Watch window. If the watched expression contains local variables you should set the watchpoint within the scope of these variables, i.e. for example within the function in which the local variables are defined. Otherwise the watchpoint will be ignored. Note that if you want you want value of a variable defined within some block to be evaluated and there is a variable with the same identifier defined in a block containing this block then the value of the latter variable will be evaluated independently of the location where you set the watchpoint. That is if an mpC program contains the following code
/*1*/int [*]f ()
/*3*/ int i;
/*5*/ int i;
/*6*/ i ++;
and you set a watchpoint evaluating the value of i at the line 6, the value of the variable i defined within the function f will be evaluated.
This chapter explains how to manage watchpoints. The following topics are discussed: