~ubuntu-branches/ubuntu/wily/afnix/wily

« back to all changes in this revision

Viewing changes to src/clt/axd/doc/chapter-2.xml

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2011-03-16 21:31:18 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110316213118-gk4k3ez3e5d2huna
Tags: 2.0.0-1
* QA upload.
* New upstream release
* Debian source format is 3.0 (quilt)
* Fix debhelper-but-no-misc-depends
* Fix ancient-standards-version
* Fix package-contains-linda-override
* debhelper compatibility is 7
* Fix dh-clean-k-is-deprecated

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?xml version='1.0'?>
 
1
<?xml version="1.0" encoding="UTF-8"?>
2
2
 
3
3
<!-- ====================================================================== -->
4
4
<!-- = chapter-2.xml                                                      = -->
13
13
<!-- = incidental  or special  damages arising  in any way out of the use = -->
14
14
<!-- = of this software.                                                  = -->
15
15
<!-- ====================================================================== -->
16
 
<!-- = copyright (c) 1999-2007 - amaury darsch                            = -->
 
16
<!-- = copyright (c) 1999-2011 - amaury darsch                            = -->
17
17
<!-- ====================================================================== -->
18
18
 
19
19
<chapter client="axd" number="2">
20
20
  <title>Using the debugger</title>
21
21
 
22
22
  <p>
23
 
  This chapter describes in detail the usage of the <afnix/>
24
 
  cross debugger or <product>axc</product>. The debugger is a special
25
 
  application that is built on top of the <afnix/> interpreter. For
26
 
  this reason, the debugger provides the full execution environment
27
 
  with special commands bound into a dedicated nameset.
 
23
    This chapter describes in detail the usage of the cross debugger
 
24
    or <product>axc</product>. The debugger is a special  
 
25
    application that is built on top of the interpreter. For
 
26
    this reason, the debugger provides the full execution environment
 
27
    with special commands bound into a dedicated nameset.
28
28
  </p>
29
29
 
30
30
  <!-- invocation and termination -->
32
32
    <title>Invocation and termination</title>
33
33
 
34
34
    <p>
35
 
    The <product>axd</product> debugger is started by typing the
36
 
    command <command>axd</command>. Once started, the debugger reads
37
 
    the commands from the terminal. Since the debugger is built on top
38
 
    of the <afnix/> interpreter, any command is in fact a special form
39
 
    that is executed by the interpreter. The natural way to invoke the
40
 
    debugger is to pass the primary file to debug with eventually some
41
 
    arguments.
 
35
      The <product>axd</product> debugger is started by typing the
 
36
      command <command>axd</command>. Once started, the debugger reads
 
37
      the commands from the terminal. Since the debugger is built on top
 
38
      of the interpreter, any command is in fact a special form
 
39
      that is executed by the interpreter. The natural way to invoke the
 
40
      debugger is to pass the primary file to debug with eventually some
 
41
      arguments.
42
42
    </p>
43
43
 
44
44
    <example>
45
 
    zsh&gt; axd PROGRAM [arguments]
 
45
      zsh&gt; axd PROGRAM [arguments]
46
46
    </example>
47
47
 
48
48
    <p>
49
 
    When the debugger is started, a prompt <tt>'(axd)'</tt> indicates
50
 
    that the  session is running. The debugger session is terminated
51
 
    with the commands <code>axd:exit</code> or <code>axd:quit</code>.
 
49
      When the debugger is started, a prompt <tt>'(axd)'</tt> indicates
 
50
      that the  session is running. The debugger session is terminated
 
51
      with the commands <code>axd:exit</code> or <code>axd:quit</code>.
52
52
    </p>
53
53
 
54
54
    <example>
55
 
    zsh&gt; axd PROGRAM
56
 
    (axd) axd:quit
57
 
    zsh&gt;
 
55
      zsh&gt; axd PROGRAM
 
56
      (axd) axd:quit
 
57
      zsh&gt;
58
58
    </example>
59
59
 
60
60
    <!-- debugger options -->
62
62
      <title>Debugger options</title>
63
63
      
64
64
      <p>
65
 
      The available options can be seen with the <option>h</option>
66
 
      option and the current version with the <option>v</option>
67
 
      option. This mode of operations is similar to the one found with
68
 
      the <afnix/> interpreter.
 
65
        The available options can be seen with the <option>h</option>
 
66
        option and the current version with the <option>v</option>
 
67
        option. This mode of operations is similar to the one found with
 
68
        the interpreter.
69
69
      </p>
70
70
 
71
71
      <example>
72
 
      zsh&gt; axd [h]
73
 
      usage: axd [options] [file] [arguments]
74
 
                 [h]              print this help message
75
 
                 [v]              print version information
76
 
                 [i] path         add a path to the resolver
77
 
                 [e   mode]       force the encoding mode
78
 
                 [f runini]       run initial file
79
 
                 [f  emacs]       enable emacs mode
80
 
                 [f assert]       enable assertion checks
81
 
                 [f nopath]       do not set initial path
 
72
        zsh&gt; axd [h]
 
73
        usage: axd [options] [file] [arguments]
 
74
        [h]              print this help message
 
75
        [v]              print version information
 
76
        [i] path         add a path to the resolver
 
77
        [e   mode]       force the encoding mode
 
78
        [f runini]       run initial file
 
79
        [f  emacs]       enable emacs mode
 
80
        [f assert]       enable assertion checks
 
81
        [f nopath]       do not set initial path
82
82
      </example>
83
83
    </subsect>
84
84
 
87
87
      <title>Running the program</title>
88
88
 
89
89
      <p>
90
 
      When a program is run within the debugger, a primary file must
91
 
      be used to indicate where to start the program. The file name
92
 
      can be given either as an <command>axd</command> command
93
 
      argument or with the <code>axd:load</code> command. The first
94
 
      available form in the primary file is used as the program
95
 
      starting point.
 
90
        When a program is run within the debugger, a primary file must
 
91
        be used to indicate where to start the program. The file name
 
92
        can be given either as an <command>axd</command> command
 
93
        argument or with the <code>axd:load</code> command. The first
 
94
        available form in the primary file is used as the program
 
95
        starting point.
96
96
      </p>
97
97
    </subsect>
98
98
 
99
99
    <!-- program loading -->
100
 
        <!-- running the program -->
 
100
    <!-- running the program -->
101
101
    <subsect>
102
102
      <title>Loading the program</title>
103
103
 
104
104
      <p>
105
 
      The <code>axd:load</code> command loads the primary file and
106
 
      mark the first available form as the starting form for the
107
 
      program execution. The command takes a file name as its first
108
 
      argument. The <afnix/> resolver rule apply for the file name
109
 
      resolution.
 
105
        The <code>axd:load</code> command loads the primary file and
 
106
        mark the first available form as the starting form for the
 
107
        program execution. The command takes a file name as its first
 
108
        argument. The resolver rule apply for the file name
 
109
        resolution.
110
110
      </p>
111
111
 
112
112
      <list>
113
113
        <item>
114
 
        If the string name has the <extn>.als</extn> extension, the
115
 
        string is considered to be the file name.
 
114
          If the string name has the <extn>.als</extn> extension, the
 
115
          string is considered to be the file name.
116
116
        </item>
117
117
        <item>
118
 
        If the string name has the <extn>.axc</extn> extension or no
119
 
        extension, the string is used to search a file that has a
120
 
        <extn>.als</extn> extension or that belongs to a librarian.
 
118
          If the string name has the <extn>.axc</extn> extension or no
 
119
          extension, the string is used to search a file that has a
 
120
          <extn>.als</extn> extension or that belongs to a librarian.
121
121
        </item>
122
122
      </list>
123
123
 
124
124
      <p>
125
 
      Note that these operations are also dependent on the
126
 
      <option>i</option> option that adds a path or a librarian to
127
 
      the search-path.
 
125
        Note that these operations are also dependent on the
 
126
        <option>i</option> option that adds a path or a librarian to
 
127
        the search-path.
128
128
      </p>
129
129
    </subsect>
130
130
 
133
133
      <title>Starting the program</title>
134
134
 
135
135
      <p>
136
 
      The <code>axd:run</code> command starts the program at the first
137
 
      available form in the primary file. The program is executed
138
 
      until a breakpoint or any other halting condition is
139
 
      reached. Generally, when the program execution is suspended, an
140
 
      entry into the debugger is done and the prompt is shown at the
141
 
      command line.
 
136
        The <code>axd:run</code> command starts the program at the first
 
137
        available form in the primary file. The program is executed
 
138
        until a breakpoint or any other halting condition is
 
139
        reached. Generally, when the program execution is suspended, an
 
140
        entry into the debugger is done and the prompt is shown at the
 
141
        command line.
142
142
      </p>
143
143
 
144
144
      <example>
145
 
      (axd)axd:run
 
145
        (axd)axd:run
146
146
      </example>
147
147
 
148
148
      <p>
149
 
      The <code>axd:run</code> is the primary command to execute
150
 
      before the program can be debugged. Eventually, a file name can
151
 
      be used as the primary file to execute.
 
149
        The <code>axd:run</code> is the primary command to execute
 
150
        before the program can be debugged. Eventually, a file name can
 
151
        be used as the primary file to execute.
152
152
      </p>
153
153
 
154
154
      <example>
155
 
      (axd)axd:run "test.als"
 
155
        (axd)axd:run "test.als"
156
156
      </example>
157
157
    </subsect>
158
158
 
161
161
      <title>Setting program arguments</title>
162
162
 
163
163
      <p>
164
 
      Since the debugger is built on top of the <afnix/> interpreter,
165
 
      it is possible to set directly the argument vector. The argument
166
 
      vector is bound to the interpreter with the qualified name
167
 
      <code>interp:argv</code>. The standard vector can be used to
168
 
      manipulate the argument vector.
 
164
        Since the debugger is built on top of the interpreter,
 
165
        it is possible to set directly the argument vector. The argument
 
166
        vector is bound to the interpreter with the qualified name
 
167
        <code>interp:argv</code>. The standard vector can be used to
 
168
        manipulate the argument vector.
169
169
      </p>
170
170
 
171
171
      <example>
172
 
      (axd)interp:argv:reset
173
 
      (axd)interp:argv:append "hello"
 
172
        (axd)interp:argv:reset
 
173
        (axd)interp:argv:append "hello"
174
174
      </example>
175
175
 
176
176
      <p>
177
 
      In this example, the interpreter argument vector is reset and
178
 
      then a single argument string is added to the vector. If one
179
 
      wants to see the interpreter argument vector, a simple procedure
180
 
      can be used as shown below.
 
177
        In this example, the interpreter argument vector is reset and
 
178
        then a single argument string is added to the vector. If one
 
179
        wants to see the interpreter argument vector, a simple procedure
 
180
        can be used as shown below.
181
181
      </p>
182
182
 
183
183
      <example>
184
 
      const argc (interp:argv:length)
185
 
      loop (trans i 0) (&lt; i argc) (i:++) {
 
184
        const argc (interp:argv:length)
 
185
        loop (trans i 0) (&lt; i argc) (i:++) {
186
186
        trans arg (interp:argv:get i)
187
187
        println "argv[" i "] = " arg
188
 
      }
 
188
        }
189
189
      </example>
190
190
    </subsect>
191
191
  </section>
195
195
    <title>Breakpoints operations</title>
196
196
 
197
197
    <p>
198
 
    Breakpoints are set with the <code>axd:break</code> command. If a
199
 
    breakpoint is reached during the program execution, the program is
200
 
    suspended and the debugger session is resumed with a command
201
 
    prompt. At the command prompt, the full interpreter is
202
 
    available. It permits to examine symbols.
 
198
      Breakpoints are set with the <code>axd:break</code> command. If a
 
199
      breakpoint is reached during the program execution, the program is
 
200
      suspended and the debugger session is resumed with a command
 
201
      prompt. At the command prompt, the full interpreter is
 
202
      available. It permits to examine symbols.
203
203
    </p>
204
204
 
205
205
    <subsect>
206
206
      <title>Breakpoint command</title>
207
207
 
208
208
      <p>
209
 
      The <code>axd:break</code> command sets a breakpoint in a file
210
 
      at a specified line number. If the file is not specified, the
211
 
      primary file is used instead. If the line number is not
212
 
      specified, the first available form in the current file is
213
 
      used.
 
209
        The <code>axd:break</code> command sets a breakpoint in a file
 
210
        at a specified line number. If the file is not specified, the
 
211
        primary file is used instead. If the line number is not
 
212
        specified, the first available form in the current file is
 
213
        used.
214
214
      </p>
215
215
 
216
216
      <example>
217
 
      (axd) axd:break "demo.als" 12
218
 
      Setting breakpoint 0 in file demo.als at line 12
 
217
        (axd) axd:break "demo.als" 12
 
218
        Setting breakpoint 0 in file demo.als at line 12
219
219
      </example>
220
220
 
221
221
      <p>
222
 
      In this example, a breakpoint is set in the file
223
 
      <file>demo.als</file> at the line number 12. The file name does
224
 
      not have to be the primary file. If another file name is
225
 
      specified, the file is loaded, instrumented and the breakpoint
226
 
      is set.
 
222
        In this example, a breakpoint is set in the file
 
223
        <file>demo.als</file> at the line number 12. The file name does
 
224
        not have to be the primary file. If another file name is
 
225
        specified, the file is loaded, instrumented and the breakpoint
 
226
        is set.
227
227
      </p>
228
228
    </subsect>
229
229
 
232
232
      <title>Viewing breakpoints</title>
233
233
 
234
234
      <p>
235
 
      The <code>axd:break-info</code> command reports some information
236
 
      about the current breakpoint setting.
 
235
        The <code>axd:break-info</code> command reports some information
 
236
        about the current breakpoint setting.
237
237
      </p>
238
238
 
239
239
      <example>
240
 
      (axd) axd:break "demo.als" 12
241
 
      (axd) axd:break "test.als" 18
242
 
      (axd) axd:break-info
243
 
      Breakpoint 0 in file demo.als at line 12
244
 
      Breakpoint 1 in file test.als at line 18
 
240
        (axd) axd:break "demo.als" 12
 
241
        (axd) axd:break "test.als" 18
 
242
        (axd) axd:break-info
 
243
        Breakpoint 0 in file demo.als at line 12
 
244
        Breakpoint 1 in file test.als at line 18
245
245
      </example>
246
246
    </subsect>
247
247
 
250
250
      <title>Resuming execution</title>
251
251
      
252
252
      <p>
253
 
      The <code>axd:continue</code> command resumes the program
254
 
      execution after a breakpoint. The program execution continues
255
 
      until another breaking condition is reached or the program
256
 
      terminates.
 
253
        The <code>axd:continue</code> command resumes the program
 
254
        execution after a breakpoint. The program execution continues
 
255
        until another breaking condition is reached or the program
 
256
        terminates.
257
257
      </p>
258
258
 
259
259
      <example>
260
 
      (axd) axd:run
261
 
      Breakpoint 0 in file demo.als at line 12
262
 
      (axd) axd:continue
 
260
        (axd) axd:run
 
261
        Breakpoint 0 in file demo.als at line 12
 
262
        (axd) axd:continue
263
263
      </example>
264
264
 
265
265
      <p>
266
 
      In this example, the program is run and stopped at breakpoint
267
 
      0. The <code>axd:continue</code> command resumes the program
268
 
      execution.
 
266
        In this example, the program is run and stopped at breakpoint
 
267
        0. The <code>axd:continue</code> command resumes the program
 
268
        execution.
269
269
      </p>
270
270
    </subsect>
271
271
  </section>