Remove a breakpoint.
dbclear fun dbclear fun line dbclear('fun', line) dbclear
dbclear fun removes all breakpoints in function fun. dbclear fun line or dbclear('fun',line) removes the breakpoint in function fun at line number line.
Without argument, dbclear removes all breakpoints.
Resume execution.
dbcont
When execution has been suspended by a breakpoint or dbhalt, it can be resumed from the command-line interface with dbcont.
dbstop, dbhalt, dbstep, dbquit
Suspend execution.
dbhalt
In a function, dbhalt suspends normal execution as if a breakpoint had been reached. Commands dbstep, dbcont and dbquit can then be used from the command line to resume or abort execution.
Abort suspended execution.
dbquit
When execution has been suspended by a breakpoint or dbhalt, it can be aborted completely from the command-line interface with dbquit.
Chain of function calls.
dbstack s = dbstack dbstack all s = dbstack('all')
dbstack displays the chain of function calls which lead to the current execution point, with the line number where the call to the subfunction is made. It can be executed in a function or from the command-line interface when execution is suspended with a breakpoint or dbhalt.
dbstack all (or dbstack('all')) displays the whole stack of function calls. For instance, if two executions are successively suspended at breakpoints, dbstack displays only the second chain of function calls, while dbstack all displays all functions.
With an output argument, dbstack returns the result in a list of structures. Each structure contains the function name (or class and method names) in field name and the line number in field line. Note that you cannot assign the result of dbstack to a new variable in suspended mode.
use stdlib dbstop primes isprime(113) <primes:164> p = ones(1, n); dbstack stdlib/primes;164 stdlib/isprime;157 dumpvar('stack', dbstack) stack = {struct('name','stdlib/primes', ... 'line',164), ... struct('name','stdlib/isprime', ... 'line',157)};
Display list of breakpoints.
dbstatus dbstatus fun
dbstatus displays the list of all breakpoints. dbstatus fun displays the list of breakpoints in function fun.
Execute a line of instructions.
dbstep dbstep in dbstep out
When normal execution is suspended after a breakpoint set with dbstop or the execution of function dbhalt, dbstep, issued from the command line, executes the next line of the suspended function. If the line is the last one of the function, execution resumes in the calling function.
dbstep in has the same effect as dbstep, except if a subfunction is called. In this case, execution is suspended at the beginning of the subfunction.
dbstep out resumes execution in the current function and suspends it in the calling function.
Load library stdlib and put a breakpoint at the beginning of function linspace:
use stdlib dbstop linspace
Start execution of function linspace until the breakpoint is reached (the next line to be executed is displayed):
v = linspace(1,2,5) <linspace:8> if nargin < 3
When the execution is suspended, any function can be called. Local variables of the function can be accessed and changed; but no new variable can be created. Here, the list of variables and the value of x2 are displayed:
info v r (not defined) x1 (1x1) x2 (1x1) n (1x1) x2 x2 = 2
Display the stack of function calls:
dbstack stdlib/linspace;8
Execute next line:
dbstep <linspace:11> r = x1 + (x2 - x1) * (0:n-1) / (n-1);
Execute last line; then normal execution is resumed:
dbstep v = 1 1.25 1.5 1.75 2
Display breakpoint and clear it:
dbstatus stdlib/linspace;0 dbclear
Set a breakpoint.
dbstop fun dbstop fun line dbstop('fun', line)
dbstop fun sets a breakpoint at the beginning of function fun. dbstop fun line or dbstop('fun',line) sets a breakpoint in function fun at line line.
When LME executes a line where a breakpoint has been set, it suspends execution and returns to the command-line interface. The user can inspect or change variables, executes expressions or other functions, continue execution with dbstep or dbcont, or abort execution with dbquit.
use stdlib dbstop linspace dbstatus stdlib/linspace;0 dbclear linspace
dbhalt, dbclear, dbstatus, dbstep, dbcont, dbquit
Display source code with line numbers, breakpoints, and current execution point.
dbtype fun
dbtype fun displays the source code of function fun with line numbers, breakpoints, and the position where execution is suspended (if it is in fun).
use stdlib dbstop linspace linspace(1,2,5); <linspace:8> if nargin < 3 dbstep <linspace:11> r = x1 + (x2 - x1) * (0:n-1) / (n-1); dbtype linspace # 6 function r = linspace(x1, x2, n) 7 8 if nargin < 3 9 n = 100; 10 end > 11 r = x1 + (x2 - x1) * (0:n-1) / (n-1);