dbstep
Execute next executable line during debugging.
📝Syntax
dbstep
dbstep in
dbstep out
dbstep nlines
📥Input Arguments
Parameter Description
nlines Positive integer specifying the number of executable lines to step. Execution pauses at breakpoints encountered along the way.
📄Description

dbstep executes the next executable line of the current file during debugging, skipping breakpoints in functions called by that line.

dbstep in steps into any function called on the current line, pausing at the first executable line of the called function.

dbstep out completes execution of the current function and pauses just after returning to the caller. Execution pauses at any breakpoint encountered along the way.

dbstep nlines executes the specified number of lines, pausing at any breakpoint encountered.

These commands can only be used from the command line while debugging.

Outside a debug session, dbstep raises Debug commands only allowed when stopped in debug mode. When the step is typed at the K>> prompt, the console prints the line about to run, as 4 r = r * 2;; a step driven from the editor moves the arrow without printing it. At a stop on an uncaught error, dbstep ends the session.

💡Examples
Step over a called function.
function n = myfile(x)
  n = myfunction(x-1);
end

function z = myfunction(y)
  z = 2/y;
end

dbstop in myfile
myfile(2);
dbstep
Step into a called function.
dbstop in myfile
myfile(2);
dbstep in
Step out of the current function.
dbstep out
Step multiple lines in one command.
dbstep 4
🔗See Also
dbstopdbcontdbquitdbstatusdbstack
🕔Version History
Version Description
1.16.0 initial version
2.0.0 uniform message outside a debug session, per-step echo of the line, ends the session at an error stop
Edit this page on GitHub