stopat - Maple Help

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 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 file name (specified as a string), and a line number in that source file.
 • 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.
 • 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:
 > $\mathrm{stopat}\left(f\right)$

 [f]

 > $\mathrm{stopat}\left(f,3\right)$

 [f]

 > $\mathrm{showstat}\left(f\right)$

 f := proc(x) 1*   if x < 3 then 2      print(x); 3*     print(x^2) end if; 4    print(-x); 5    x^3 end

 > $f\left(2\right)$

 f: 1*   if x < 3 then ... end if; DBG> cont 2 f: 3*   print(x^2) DBG> cont 4 -2

 ${8}$ (1)

Compatibility

 • The stopat command was updated in Maple 2017.
 • The fileName and lineNum parameters were introduced in Maple 2017.