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

Online Help

All Products    Maple    MapleSim


stopat

set a breakpoint in a procedure at a specified statement number

unstopat

clear a breakpoint in a procedure at a specified statement number

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

stopat(procName, statNum, condition)

stopat(fileName, lineNum, condition)

unstopat(procName, statNum)

Parameters

procName

-

name of the procedure in which to set a breakpoint

statNum

-

(optional) statement number or list of statement numbers at which to set or clear breakpoints

fileName

-

string; name of a Maple language source file containing a procedure in which to set a breakpoint

lineNum

-

line number of a statement in a procedure in a source file

condition

-

(optional) Boolean condition

Description

• 

The stopat function sets a breakpoint at each of the specified statement numbers of the specified procedure. If no statement numbers are specified, the breakpoint is set at the beginning of the procedure. When the breakpoint is reached, execution stops, and the debugger is invoked (subject to the optional condition).

• 

If source code information is available, stopat can be called with a source filename (specified as a string), and a line number in that source file.

  

When the specified source file is within nested directories, it is possible to specify just the filename, or a partial trailing directory specification and filename, which stopat can use to find the file. If more than one file with the same name is found, they are listed, and the first one assumed to be desired.

• 

The optional condition indicates a condition which must be met in order for execution to stop. The condition can be in one of three forms.

– 

A Boolean expression (that is, one whose top-level operator is one of <, <=, >=, >, =, <>, and, or, or not). Calling evalb is not necessary and is not allowed. The condition can refer to global variables, as well as local variables and parameters of the procedure in which the breakpoint is being set. The condition is re-evaluated every time the breakpoint is reached.

– 

An integer range, N..M, indicating that execution should stop only the Nth through Mth times that the breakpoint is reached. If N is omitted (i.e. ..M), execution will stop the first M times the breakpoint is reached. If M is omitted (i.e. N..), execution will stop the Nth and subsequent times the breakpoint is reached.

– 

A single integer, N, indicating that execution should stop only the Nth time that the breakpoint is reached. This is equivalent to specifying N..N.

  

For each of the latter two forms, the count of how many times a breakpoint is reached is reset every time execution is started from the top level (a command entered at the prompt or read from a file).

• 

Breakpoints in exported members of modules are set or cleared in a way analogous to those in globally defined procedures, except that the module name and :- must be specified.

  

Breakpoints in private (local) members of a module can be set or cleared using the syntax moduleName::memberName. This is the only case in which it is possible to refer to a private member of a module from outside that module (unless kernelopts(opaquemodules) is false).

• 

If a module, M, has a ModuleApply member function, then the command stopat(M) is equivalent to stopat(M:-ModuleApply) or stopat(M::ModuleApply).

• 

The stopat function returns a list of the names of procedures in which breakpoints have been set. If no arguments are passed to stopat, no breakpoints are set, but the list is still returned.

  

If breakpoints were specified using a source file, they may not yet appear in the list displayed by stopat until the specified source file has been loaded for execution.

• 

Breakpoints in exported members of a module will appear prefixed by their module name if and only if the module has a name. If the module has no name, only the member name will appear. Breakpoints in private members of a module will appear with just the member name.

  

Breakpoints in a module's ModuleApply function will appear as the module name, instead of the name ModuleApply.

• 

The unstopat function clears the breakpoints at each of the specified statement numbers of the specified procedure. If no statement numbers are specified, all breakpoints in the procedure are cleared.

• 

If no arguments are passed to unstopat, all breakpoints in all procedures are cleared.

• 

The unstopat function returns a list of the names of procedures in which breakpoints remain set.

• 

Breakpoints can be viewed using the showstat function or the showstat command in the debugger.

• 

When execution reaches a breakpoint, the debugger is invoked (before the statement at which the breakpoint has been set is executed).

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) if x < 3 then print(x); print(x^2) end if; print(-x); x^3 end proc:

stopatf

                         [f]

stopatf&comma;3

                         [f]

showstatf

 f := proc(x)

    1*   if x < 3 then

    2      print(x);

    3*     print(x^2)

         end if;

    4    print(-x);

    5    x^3

 end

f2

 f:

    1*   if x < 3 then

           ...

         end if;

 

 DBG> cont

                                 2

 f:

    3*   print(x^2)

 

 DBG> cont

                                 4

                                -2

8

(1)

Compatibility

• 

The fileName and lineNum parameters were introduced in Maple 2017.

• 

For more information on Maple 2017 changes, see Updates in Maple 2017.

• 

The stopat command was updated in Maple 2022.

See Also

debugger

Interactive Maple Debugger

Setting Breakpoints

showstat

showstop

stoperror

stoplast

stopwhen

stopwhenif

trace

tracelast