File: Debug-Mode.html

package info (click to toggle)
octave 10.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 145,388 kB
  • sloc: cpp: 335,976; ansic: 82,241; fortran: 20,963; objc: 9,402; sh: 8,756; yacc: 4,392; lex: 4,333; perl: 1,544; java: 1,366; awk: 1,259; makefile: 659; xml: 192
file content (181 lines) | stat: -rw-r--r-- 12,449 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Debug Mode (GNU Octave (version 10.3.0))</title>

<meta name="description" content="Debug Mode (GNU Octave (version 10.3.0))">
<meta name="keywords" content="Debug Mode (GNU Octave (version 10.3.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Debugging.html" rel="up" title="Debugging">
<link href="Call-Stack.html" rel="next" title="Call Stack">
<link href="Breakpoints.html" rel="prev" title="Breakpoints">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
kbd.key {font-style: normal}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">


</head>

<body lang="en">
<div class="section-level-extent" id="Debug-Mode">
<div class="nav-panel">
<p>
Next: <a href="Call-Stack.html" accesskey="n" rel="next">Call Stack</a>, Previous: <a href="Breakpoints.html" accesskey="p" rel="prev">Breakpoints</a>, Up: <a href="Debugging.html" accesskey="u" rel="up">Debugging</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="Debug-Mode-1"><span>13.4 Debug Mode<a class="copiable-link" href="#Debug-Mode-1"> &para;</a></span></h3>

<p>There are three additional support functions that allow the user to
find out 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.
</p>
<a class="anchor" id="XREFdbwhere"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-dbwhere"><span><strong class="def-name">dbwhere</strong><a class="copiable-link" href="#index-dbwhere"> &para;</a></span></dt>
<dd><p>In debugging mode, report the current file and line number where execution
is stopped.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="Call-Stack.html#XREFdbstack">dbstack</a>, <a class="ref" href="#XREFdblist">dblist</a>, <a class="ref" href="Breakpoints.html#XREFdbstatus">dbstatus</a>, <a class="ref" href="Leaving-Debug-Mode.html#XREFdbcont">dbcont</a>, <a class="ref" href="#XREFdbstep">dbstep</a>, <a class="ref" href="Call-Stack.html#XREFdbup">dbup</a>, <a class="ref" href="Call-Stack.html#XREFdbdown">dbdown</a>.
</p></dd></dl>


<a class="anchor" id="XREFdbtype"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-dbtype"><span><strong class="def-name">dbtype</strong><a class="copiable-link" href="#index-dbtype"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-dbtype-1"><span><strong class="def-name">dbtype</strong> <code class="def-code-arguments"><var class="var">lineno</var></code><a class="copiable-link" href="#index-dbtype-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-dbtype-2"><span><strong class="def-name">dbtype</strong> <code class="def-code-arguments"><var class="var">startl:endl</var></code><a class="copiable-link" href="#index-dbtype-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-dbtype-3"><span><strong class="def-name">dbtype</strong> <code class="def-code-arguments"><var class="var">startl</var>:end</code><a class="copiable-link" href="#index-dbtype-3"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-dbtype-4"><span><strong class="def-name">dbtype</strong> <code class="def-code-arguments"><var class="var">fcn</var></code><a class="copiable-link" href="#index-dbtype-4"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-dbtype-5"><span><strong class="def-name">dbtype</strong> <code class="def-code-arguments"><var class="var">fcn</var> <var class="var">lineno</var></code><a class="copiable-link" href="#index-dbtype-5"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-dbtype-6"><span><strong class="def-name">dbtype</strong> <code class="def-code-arguments"><var class="var">fcn</var> <var class="var">startl:endl</var></code><a class="copiable-link" href="#index-dbtype-6"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-dbtype-7"><span><strong class="def-name">dbtype</strong> <code class="def-code-arguments"><var class="var">fcn</var> <var class="var">startl</var>:end</code><a class="copiable-link" href="#index-dbtype-7"> &para;</a></span></dt>
<dd><p>Display a script file with line numbers.
</p>
<p>When called with no arguments in debugging mode, display the script file
currently being debugged.
</p>
<p>An optional range specification can be used to list only a portion of the
file.  The special keyword <code class="code">&quot;end&quot;</code> is a valid line number specification
for the last line of the file.
</p>
<p>When called with the name of a function, list that script file with line
numbers.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFdblist">dblist</a>, <a class="ref" href="#XREFdbwhere">dbwhere</a>, <a class="ref" href="Breakpoints.html#XREFdbstatus">dbstatus</a>, <a class="ref" href="Breakpoints.html#XREFdbstop">dbstop</a>.
</p></dd></dl>


<a class="anchor" id="XREFdblist"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-dblist"><span><strong class="def-name">dblist</strong><a class="copiable-link" href="#index-dblist"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-dblist-1"><span><strong class="def-name">dblist</strong> <code class="def-code-arguments"><var class="var">n</var></code><a class="copiable-link" href="#index-dblist-1"> &para;</a></span></dt>
<dd><p>In debugging mode, list <var class="var">n</var> lines of the function being debugged
centered around the current line to be executed.
</p>
<p>If unspecified <var class="var">n</var> defaults to 10 (+/- 5 lines)
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFdbwhere">dbwhere</a>, <a class="ref" href="#XREFdbtype">dbtype</a>, <a class="ref" href="Call-Stack.html#XREFdbstack">dbstack</a>.
</p></dd></dl>


<p>You may also use <code class="code">isdebugmode</code> to determine whether the debugger is
currently active.
</p>
<a class="anchor" id="XREFisdebugmode"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-isdebugmode"><span><code class="def-type"><var class="var">tf</var> =</code> <strong class="def-name">isdebugmode</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-isdebugmode"> &para;</a></span></dt>
<dd><p>Return true if in debugging mode, otherwise false.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFdbwhere">dbwhere</a>, <a class="ref" href="Call-Stack.html#XREFdbstack">dbstack</a>, <a class="ref" href="Breakpoints.html#XREFdbstatus">dbstatus</a>.
</p></dd></dl>


<p>Debug mode also allows single line stepping through a function using
the command <code class="code">dbstep</code>.
</p>
<a class="anchor" id="XREFdbstep"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-dbstep"><span><strong class="def-name">dbstep</strong><a class="copiable-link" href="#index-dbstep"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-dbstep-1"><span><strong class="def-name">dbstep</strong> <code class="def-code-arguments"><var class="var">n</var></code><a class="copiable-link" href="#index-dbstep-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-dbstep-2"><span><strong class="def-name">dbstep</strong> <code class="def-code-arguments">in</code><a class="copiable-link" href="#index-dbstep-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-dbstep-3"><span><strong class="def-name">dbstep</strong> <code class="def-code-arguments">out</code><a class="copiable-link" href="#index-dbstep-3"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-dbnext"><span><strong class="def-name">dbnext</strong> <code class="def-code-arguments">&hellip;</code><a class="copiable-link" href="#index-dbnext"> &para;</a></span></dt>
<dd><p>In debugging mode, execute the next <var class="var">n</var> lines of code.
</p>
<p>If <var class="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>
<p>Using <code class="code">dbstep in</code> will cause execution of the next line to step into
any m-files defined on the next line.
</p>
<p>Using <code class="code">dbstep out</code> will cause execution to continue until the current
function returns.
</p>
<p>Programming Note: <code class="code">dbnext</code> is an alias for <code class="code">dbstep</code> and can be used
interchangeably.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="Leaving-Debug-Mode.html#XREFdbcont">dbcont</a>, <a class="ref" href="Leaving-Debug-Mode.html#XREFdbquit">dbquit</a>.
</p></dd></dl>


<p>When in debug mode the <kbd class="key">RETURN</kbd> key will execute the last entered command.
This is useful, for example, after hitting a breakpoint and entering
<code class="code">dbstep</code> once.  After that, one can advance line by line through the code
with only a single key stroke.  This feature may be disabled using the
<code class="code">auto_repeat_debug_command</code> function.
</p>
<a class="anchor" id="XREFauto_005frepeat_005fdebug_005fcommand"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-auto_005frepeat_005fdebug_005fcommand"><span><code class="def-type"><var class="var">val</var> =</code> <strong class="def-name">auto_repeat_debug_command</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-auto_005frepeat_005fdebug_005fcommand"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-auto_005frepeat_005fdebug_005fcommand-1"><span><code class="def-type"><var class="var">old_val</var> =</code> <strong class="def-name">auto_repeat_debug_command</strong> <code class="def-code-arguments">(<var class="var">new_val</var>)</code><a class="copiable-link" href="#index-auto_005frepeat_005fdebug_005fcommand-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-auto_005frepeat_005fdebug_005fcommand-2"><span><code class="def-type"><var class="var">old_val</var> =</code> <strong class="def-name">auto_repeat_debug_command</strong> <code class="def-code-arguments">(<var class="var">new_val</var>, &quot;local&quot;)</code><a class="copiable-link" href="#index-auto_005frepeat_005fdebug_005fcommand-2"> &para;</a></span></dt>
<dd><p>Query or set the internal variable that controls whether debugging
commands are automatically repeated when the input line is empty (typing
just <kbd class="key">RET</kbd>).
</p>
<p>When called from inside a function with the <code class="code">&quot;local&quot;</code> option, the
variable is changed locally for the function and any subroutines it calls.
The original variable value is restored when exiting the function.
</p></dd></dl>


</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Call-Stack.html">Call Stack</a>, Previous: <a href="Breakpoints.html">Breakpoints</a>, Up: <a href="Debugging.html">Debugging</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>