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

Online Help

All Products    Maple    MapleSim


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

Parameters

Description

Examples

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:

stopwhena

a

(1)

stopwhenf,b

a,f,b

(2)

f3

 a := 3

 f:

    2    b := x;

 

 DBG> cont

 b := 3

 f:

    3    x^2

 

 DBG> cont

9

(3)

unstopwhenf,b

a

(4)

stopwhenifa,4

a

(5)

f2

4

(6)

f4

 a := 4

 f:

    2    b := x;

 

 DBG> cont

16

(7)

See Also

debugger

Interactive Maple Debugger

stopat

stoperror

stoplast