<html lang="en"> <head> <title>Debug Mode - GNU Octave</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="GNU Octave"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Debugging.html#Debugging" title="Debugging"> <link rel="prev" href="Breakpoints.html#Breakpoints" title="Breakpoints"> <link rel="next" href="Call-Stack.html#Call-Stack" title="Call Stack"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Debug-Mode"></a> <p> Next: <a rel="next" accesskey="n" href="Call-Stack.html#Call-Stack">Call Stack</a>, Previous: <a rel="previous" accesskey="p" href="Breakpoints.html#Breakpoints">Breakpoints</a>, Up: <a rel="up" accesskey="u" href="Debugging.html#Debugging">Debugging</a> <hr> </div> <h3 class="section">13.4 Debug Mode</h3> <p>There are two additional support functions that allow the user to interrogate where in the execution of a script Octave entered the debug mode and to print the code in the script surrounding the point where Octave entered debug mode. <!-- dbwhere src/debug.cc --> <p><a name="doc_002ddbwhere"></a> <div class="defun"> — Loadable Function: <b>dbwhere</b> ()<var><a name="index-dbwhere-850"></a></var><br> <blockquote><p>In debugging mode, report the current file and line number where execution is stopped. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002ddbstatus.html#doc_002ddbstatus">dbstatus</a>, <a href="doc_002ddbcont.html#doc_002ddbcont">dbcont</a>, <a href="doc_002ddbstep.html#doc_002ddbstep">dbstep</a>, <a href="doc_002ddbup.html#doc_002ddbup">dbup</a>. </p></blockquote></div> <!-- dbtype src/debug.cc --> <p><a name="doc_002ddbtype"></a> <div class="defun"> — Loadable Function: <b>dbtype</b> ()<var><a name="index-dbtype-851"></a></var><br> — Loadable Function: <b>dbtype</b> (<var>"startl:endl"</var>)<var><a name="index-dbtype-852"></a></var><br> — Loadable Function: <b>dbtype</b> (<var>"func"</var>)<var><a name="index-dbtype-853"></a></var><br> — Loadable Function: <b>dbtype</b> (<var>"func", "startl:endl"</var>)<var><a name="index-dbtype-854"></a></var><br> <blockquote><p>When in debugging mode and called with no arguments, list the script file being debugged with line numbers. An optional range specification, specified as a string, can be used to list only a portion of the file. <p>When called with the name of a function, list that script file with line numbers. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002ddbstatus.html#doc_002ddbstatus">dbstatus</a>, <a href="doc_002ddbstop.html#doc_002ddbstop">dbstop</a>. </p></blockquote></div> <p>You may also use <code>isdebugmode</code> to determine whether the debugger is currently active. <!-- isdebugmode src/debug.cc --> <p><a name="doc_002disdebugmode"></a> <div class="defun"> — Loadable Function: <b>isdebugmode</b> ()<var><a name="index-isdebugmode-855"></a></var><br> <blockquote><p>Return true if in debugging mode, otherwise false. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002ddbwhere.html#doc_002ddbwhere">dbwhere</a>, <a href="doc_002ddbstack.html#doc_002ddbstack">dbstack</a>, <a href="doc_002ddbstatus.html#doc_002ddbstatus">dbstatus</a>. </p></blockquote></div> <p>Debug mode also allows single line stepping through a function using the commands <code>dbstep</code>. <!-- dbstep src/debug.cc --> <p><a name="doc_002ddbstep"></a> <div class="defun"> — Command: <b>dbstep</b><var><a name="index-dbstep-856"></a></var><br> — Command: <b>dbstep</b><var> n<a name="index-dbstep-857"></a></var><br> — Command: <b>dbstep</b><var> in<a name="index-dbstep-858"></a></var><br> — Command: <b>dbstep</b><var> out<a name="index-dbstep-859"></a></var><br> — Command: <b>dbnext</b><var> <small class="dots">...</small><a name="index-dbnext-860"></a></var><br> <blockquote><p>In debugging mode, execute the next <var>n</var> lines of code. If <var>n</var> is omitted, execute the next single line of code. If the next line of code is itself defined in terms of an m-file remain in the existing function. <p>Using <code>dbstep in</code> will cause execution of the next line to step into any m-files defined on the next line. Using <code>dbstep out</code> will cause execution to continue until the current function returns. <p><code>dbnext</code> is an alias for <code>dbstep</code>. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002ddbcont.html#doc_002ddbcont">dbcont</a>, <a href="doc_002ddbquit.html#doc_002ddbquit">dbquit</a>. </p></blockquote></div> </body></html>