055d403fdace4d79e30f5cf628af2e88564f5108
[scilab.git] / scilab / modules / core / help / en_US / debugging / debug.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="debug">
3     <refnamediv>
4         <refname>debug</refname>
5         <refpurpose>Debugging environment in Scilab</refpurpose>
6     </refnamediv>
7     <refsynopsisdiv>
8         <title>Calling Sequence</title>
9         <synopsis>
10             debug()
11         </synopsis>
12     </refsynopsisdiv>
13     <refsection>
14         <title>Description</title>
15         <para>
16         Use to debug Scilab script.
17         After call of <literal>debug()</literal>, you enter in debug mode.
18         This mode allows you to manage <literal>breakpoints</literal>,
19         launch execution with stop en error, execute script step by step, ...
20
21         When debug mode is active, prompt change to <literal>debug> </literal>.
22         </para>
23         <term>Commands: </term>
24         <listitem>
25             <variablelist>
26                 <varlistentry>
27                     <term>(h)elp: </term>
28                     <para>Show help on console</para>
29                 </varlistentry>
30                 <varlistentry>
31                     <term>(q)uit: </term>
32                     <para>Leave debug mode to return to normal mode of Scilab.</para>
33                 </varlistentry>
34                 <varlistentry>
35                     <term>(w)here or bt: </term>
36                     <para>Display callstack.</para>
37                 </varlistentry>
38                 <varlistentry>
39                     <term>(e)xec: </term>
40                     <term>(r)un: </term>
41                     <para>Execute command.</para>
42                 </varlistentry>
43                 <varlistentry>
44                     <term>(c)ontinue: </term>
45                     <para>Continue execution.</para>
46                 </varlistentry>
47                 <varlistentry>
48                     <term>(a)bort: </term>
49                     <para>Abort execution.</para>
50                 </varlistentry>
51                 <varlistentry>
52                     <term>step(n)ext or (n)ext: </term>
53                     <para>Continue execution to next expression.</para>
54                 </varlistentry>
55                 <varlistentry>
56                     <term>step(i)n or (i)n: </term>
57                     <para>Continue execution to next expression in sub function.</para>
58                 </varlistentry>
59                 <varlistentry>
60                     <term>step(o)ut or (o)ut: </term>
61                     <para>Continue execution to next expression in previous function.</para>
62                 </varlistentry>
63                 <varlistentry>
64                     <term>(b)reakpoint or (b)reak: </term>
65                     <synopsis>breakpoint function [line [condition]]</synopsis>
66                     <para>Add a breakpoint in a function at line <literal>line</literal></para>
67                     <para>If a condition is specified, a breakpoint become enable only if condition is <literal>%t</literal></para>
68                 </varlistentry>
69                 <varlistentry>
70                     <term>(del)ete: </term>
71                     <synopsis>delete [n]</synopsis>
72                     <para>Remove all breakpoints.</para>
73                     <para>If n is specified, remove breakpoint #n</para>
74                 </varlistentry>
75                 <varlistentry>
76                     <term>enable: </term>
77                     <synopsis>enable [n]</synopsis>
78                     <para>Enable all breakpoints.</para>
79                     <para>If n is specified, enable breakpoint #n</para>
80                 </varlistentry>
81                 <varlistentry>
82                     <term>disable: </term>
83                     <synopsis>disable [n]</synopsis>
84                     <para>Disable all breakpoints.</para>
85                     <para>If n is specified, disable breakpoint #n</para>
86                 </varlistentry>
87                 <varlistentry>
88                     <term>(s)how: </term>
89                     <synopsis>show [n]</synopsis>
90                     <para>Show all breakpoints information.</para>
91                     <para>If n is specified, show breakpoint #n</para>
92                 </varlistentry>
93             </variablelist>
94         </listitem>
95     </refsection>
96     <refsection>
97         <title>Examples</title>
98         <programlisting role="example"><![CDATA[
99 //function to overload cosine on string
100 function v = %c_cos(val)
101     printf("val : %s\n", val);
102     v = cos(evstr(val));
103 endfunction
104
105 //caller
106 function a = test_debug()
107     b = cos("%pi");
108     a = b * 3;
109 endfunction
110
111 debug
112 break test_debug
113 exec test_debug
114 where
115 stepin
116 disp val
117 continue
118 quit
119  ]]></programlisting>
120         <programlisting role="example"><![CDATA[
121 function v = compute(val)
122     v = 1;
123     for i=1:val
124         v = v * i;
125     end
126 endfunction
127
128 debug
129 break compute 4 "i == 5"
130 exec compute(10)
131 disp val
132 disp i
133 disp v
134 continue
135 quit
136  ]]></programlisting>
137     </refsection>
138     
139     <refsection>
140         <title>History</title>
141         <revhistory>
142             <revision>
143                 <revnumber>6.0.0</revnumber>
144                 <revremark>New version: console interface to Scilab 6 debugger.</revremark>
145             </revision>
146         </revhistory>
147     </refsection>
148 </refentry>