stopwhen - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

stopwhen

set a watchpoint on a specified variable

stopwhenif

set a conditional watchpoint on a specified variable

unstopwhen

clear a watchpoint on a specified variable

 Calling Sequence stopwhen(variable) stopwhenif(variable, value) unstopwhen(variable)

Parameters

 variable - specification of the variable to watch value - specification of the value to watch for

Description

 • The stopwhen function sets a watchpoint on the specified local or global variable, and returns the current list of watchpoints.  If no variable is specified, the current list of watchpoints is simply returned.
 • A global variable is specified simply by its name. A local variable is specified by a two element list, the first element of which is the name of the procedure, and the second element of which is the name of the variable within the procedure.
 • Watching a global variable can also be restricted to modifications made to it within a specific procedure by using the notation used for watching local variables.
 • The stopwhenif function sets a watchpoint for a specific value on the specified global variable, and returns the current list of watchpoints.
 • The unstopwhen function clears the watchpoints on the specified variable and returns the current list of watchpoints. If no variable is specified, all watchpoints are cleared.
 • When a variable that is being watched is modified during the execution of a procedure, the debugger is invoked, and the value of the variable and the statement following the one responsible for the modification is displayed (after the variable has been modified).
 • If the watchpoint was set using stopwhenif, execution stops only if the value assigned to the variable matches the value specified in the call to stopwhenif

Examples

Note: These examples illustrate the use of these debugger commands in Maple's command-line interface. In the standard (graphical) interface, the debugger runs in its own window, with controls for most of the common commands.  See Interactive Maple Debugger for details.

 > f := proc(x) global a; local b; a := x; b := x; x^2 end proc:
 > $\mathrm{stopwhen}\left(a\right)$
 $\left[{a}\right]$ (1)
 > $\mathrm{stopwhen}\left(\left[f,b\right]\right)$
 $\left[{a}{,}\left[{f}{,}{b}\right]\right]$ (2)
 > $f\left(3\right)$

 a := 3 f: 2    b := x; DBG> cont b := 3 f: 3    x^2 DBG> cont

 ${9}$ (3)
 > $\mathrm{unstopwhen}\left(\left[f,b\right]\right)$
 $\left[{a}\right]$ (4)
 > $\mathrm{stopwhenif}\left(a,4\right)$
 $\left[{a}\right]$ (5)
 > $f\left(2\right)$
 ${4}$ (6)
 > $f\left(4\right)$

 a := 4 f: 2    b := x; DBG> cont

 ${16}$ (7)