set a breakpoint in a procedure at a specified statement number
clear a breakpoint in a procedure at a specified statement number
stopat(procName, statNum, condition)
stopat(fileName, lineNum, condition)
name of the procedure in which to set a breakpoint
(optional) statement number or list of statement numbers at which to set or clear breakpoints
string; name of a Maple language source file containing a procedure in which to set a breakpoint
line number of a statement in a procedure in a source file
(optional) Boolean condition
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).
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:
f := proc(x)
1* if x < 3 then
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.
Interactive Maple Debugger
Download Help Document