set a watchpoint on a specified variable
set a conditional watchpoint on a specified variable
clear a watchpoint on a specified variable
specification of the variable to watch
specification of the value to watch for
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
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:
a := 3
2 b := x;
b := 3
a := 4
Interactive Maple Debugger
Download Help Document