-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathfile.debugger.html
More file actions
490 lines (342 loc) · 11.6 KB
/
file.debugger.html
File metadata and controls
490 lines (342 loc) · 11.6 KB
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
File: debugger
— Documentation by YARD 0.9.20
</title>
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="css/mruby.css" type="text/css" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
pathId = "debugger";
relpath = '';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
<script type="text/javascript" charset="utf-8" src="js/mruby.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="file_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="_index.html">Index</a> »
<span class="title">File: debugger</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><div id='filecontents'><h1 id="how-to-use-the-mruby-debugger">How to Use the mruby Debugger</h1>
<p>copyright (c) 2014 Specified Non-Profit Corporation mruby Forum</p>
<h2 id="summary">1. Summary</h2>
<p>This file documents the mruby debugger (‘mrdb’) methods.</p>
<h2 id="debugging-with-mrdb">2 Debugging with mrdb</h2>
<h2 id="building-mrdb">2.1 Building mrdb</h2>
<p>The trunk of the mruby source tree, with the most recent mrdb, can be checked out with the following command:</p>
<p><code>bash
$ git clone https://github.com/mruby/mruby.git
</code></p>
<p>To run the <code>make</code> command:</p>
<p><code>bash
$ cd mruby
$ make
</code></p>
<p>By default, the <code>make</code> command will install the debugger files into mruby/bin.</p>
<p>You can add the path for mrdb on your host environment with the following command:</p>
<p><code>bash
$ echo "export PATH=\$PATH:MRUBY_ROOT/bin" >> ~/.bashrc
$ source ~/.bashrc
</code></p>
<p><code>*MRUBY_ROOT</code> is the directory in which mruby source code will be installed.</p>
<p>To confirm mrdb was installed properly, run mrdb with the <code>--version</code> option:</p>
<p><code>bash
$ mrdb --version
mruby 2.1.0 (2019-11-19)
</code></p>
<h2 id="basic-operation">2.2 Basic Operation</h2>
<h3 id="debugging-mruby-script-files-rb-file-with-mrdb">2.2.1 Debugging mruby Script Files (rb file) with mrdb</h3>
<p>To invoke the mruby debugger, just type <code>mrdb</code>.</p>
<p>To specify the script file:</p>
<p><code>bash
$ mrdb [option] file name
</code></p>
<p>For example: Debugging sample.rb</p>
<p><code>bash
$ mrdb sample.rb
</code></p>
<p>You can execute the shell commands listed below:</p>
<table>
<thead>
<tr>
<th style="text-align: center">command</th>
<th style="text-align: left">description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center">run</td>
<td style="text-align: left">execute programs</td>
</tr>
<tr>
<td style="text-align: center">step</td>
<td style="text-align: left">execute stepping</td>
</tr>
<tr>
<td style="text-align: center">continue</td>
<td style="text-align: left">execute continuing program</td>
</tr>
<tr>
<td style="text-align: center">break</td>
<td style="text-align: left">configure the breaking point</td>
</tr>
<tr>
<td style="text-align: center">delete</td>
<td style="text-align: left">deleting the breaking points</td>
</tr>
<tr>
<td style="text-align: center">disable</td>
<td style="text-align: left">disabling the breaking points</td>
</tr>
<tr>
<td style="text-align: center">enable</td>
<td style="text-align: left">enabling the breaking points</td>
</tr>
<tr>
<td style="text-align: center">info breakpoints</td>
<td style="text-align: left">showing list of the breaking points</td>
</tr>
<tr>
<td style="text-align: center">print</td>
<td style="text-align: left">evaluating and printing the values of the mruby expressions in the script</td>
</tr>
<tr>
<td style="text-align: center">list</td>
<td style="text-align: left">displaying the source cords</td>
</tr>
<tr>
<td style="text-align: center">help</td>
<td style="text-align: left">showing help</td>
</tr>
<tr>
<td style="text-align: center">quit</td>
<td style="text-align: left">terminating the mruby debugger</td>
</tr>
</tbody>
</table>
<h3 id="debugging-mruby-binary-files-mrb-file-with-mrdb">2.2.2 Debugging mruby Binary Files (mrb file) with mrdb</h3>
<p>You can debug the mruby binary files.</p>
<h4 id="debugging-the-binary-files">2.2.2.1 Debugging the binary files</h4>
<ul>
<li>notice
To debug mruby binary files, you need to compile mruby files with option <code>-g</code>.</li>
</ul>
<p><code>bash
$ mrbc -g sample.rb
</code></p>
<p>You can debug the mruby binary files with following command and the option <code>-b</code>.</p>
<p><code>bash
$ mrdb -b sample.mrb
</code></p>
<p>Then you can execute all debugger shell commands.</p>
<h4 id="break-command">Break Command</h4>
<p>You can use any breakpoint to stop the program by specifying the line number and method name.
The breakpoint list will be displayed after you have set the breakpoint successfully.</p>
<p>Usage:</p>
<p><code>
break [file:]linenum
b [file:]linenum
break [class:]method
b [class:]method
</code></p>
<p>The breakpoint will be ordered in serial from 1.
The number, which was given to the deleted breakpoint, will never be given to another breakpoint again.</p>
<p>You can give multiple breakpoints to specified the line number and method.
Be ware that breakpoint command will not check the validity of the class name and method name.</p>
<p>You can get the current breakpoint information by the following options.</p>
<p>breakpoint breakpoint number : file name. line number</p>
<p>breakpoint breakpoint number : [class name,] method name</p>
<h4 id="continue-command">Continue Command</h4>
<p>Usage:</p>
<p><code>
continue [N]
c [N]
</code></p>
<p>N: the next breakpoint number</p>
<p>When resuming the program, it will stop at breakpoint N (N-1 breakpoint will be ignored).</p>
<p>When you run the <code>continue</code> command without specifying N, the program will be stopped at the next breakpoint.</p>
<p>Example:</p>
<p><code>
(foo.rb:1) continue 3
</code></p>
<p>This will resume the program and stop it at the third breakpoint.</p>
<h4 id="delete-command">Delete Command</h4>
<p>This will delete the specified breakpoint.</p>
<p>Usage:</p>
<p><code>
delete [breakpoint-no]
d [breakpoint-no]
</code></p>
<p>breakpoint-no: breakpoint number</p>
<p>Example:</p>
<p><code>
(foo.rb:1) delete
</code></p>
<p>This will delete all of the breakpoints.</p>
<p><code>
(foo.rb:1) delete 1 3
</code></p>
<p>This will delete the breakpoint at 1 and 3.</p>
<h4 id="disable-command">Disable Command</h4>
<p>This will disable the specified breakpoint.</p>
<p>Usage:</p>
<p><code>
disable [breakpoint-no]
dis [breakpoint-no]
</code></p>
<p>reappointing: breakpoint number</p>
<p>Example:</p>
<p><code>
(foo.rb:1) disable
</code></p>
<p>Use <code>disable</code> if you would like to disable all of the breakpoints.</p>
<p><code>
(foo.rb:1) disable 1 3
</code></p>
<p>This will disable the breakpoints at 1 and 3.</p>
<h4 id="enable-command">Enable Command</h4>
<p>This will enable the specified breakpoints.</p>
<p>Usage:</p>
<p><code>
enable [breakpoint-no]
e [breakpoint-no]
</code></p>
<p>breakpoint-no: breakpoint number</p>
<p>Example:</p>
<p><code>
(foo.rb:1) enable
</code></p>
<p>Enabling all breakpoints
<code>
(foo.rb:1) enable 1 3
</code></p>
<p>Enabling the breakpoint 1 and 3</p>
<h4 id="eval-command">eval command</h4>
<p>Evaluating the string as source code and printing the value.</p>
<p>Same as print command, please see print command.</p>
<h4 id="help-command">help command</h4>
<p>Displaying the help message.</p>
<p>Usage:</p>
<p><code>
help [command]
h [command]
</code></p>
<p>Typing <code>help</code> without any options will display the command list.</p>
<h4 id="info-breakpoints-command">Info Breakpoints Command</h4>
<p>Displaying the specified breakpoint information.</p>
<p>Usage:</p>
<p><code>
info breakpoints [breakpoint-no]
i b [breakpoint-no]
</code></p>
<p>breakpoint-no: breakpoint number</p>
<p>Typing “info breakpoints” without ant option will display all breakpoint information.
Example:</p>
<p><code>
(sample.rb:1) info breakpoints
Num Type Enb What
1 breakpoint y at sample.rb:3 -> file name,line number
2 breakpoint n in Sample_class:sample_class_method -> [class:]method name
3 breakpoint y in sample_global_method
</code></p>
<p>Displaying the specified breakpoint number:</p>
<p><code>
(foo.rb:1) info breakpoints 1 3
Num Type Enb What
1 breakpoint y at sample.rb:3
3 breakpoint y in sample_global_method
</code></p>
<h4 id="list-command">List Command</h4>
<p>To display the code of the source file.</p>
<p>Usage:</p>
<p><code>
list [filename:]first[,last]
l [filename]:first[,last]
</code></p>
<p>first: the opening row number
last : the closing row number</p>
<p>When you specify the <code>first</code>, but not the <code>last</code> option, you will receive 10 rows.
When you do not specify both the <code>first</code> and <code>last</code> options, you will receive the next 10 rows.</p>
<p>Example:</p>
<p><code>
Specifying file name and first row number
sample.rb:1) list sample2.rb:5
</code></p>
<p>Specifying the file name and the first and last row number:</p>
<p><code>
(sample.rb:1) list sample2.rb:6,7
</code></p>
<h4 id="print-command">Print Command</h4>
<p>Evaluating the string as source code and printing the value.</p>
<p>Usage:</p>
<p><code>
print [expr]
p [expr]
</code></p>
<p>expr: expression</p>
<p>The expression is mandatory.
The displayed expressions will be serially ordered from 1.
If an exception occurs, the exception information will be displayed and the debugging will be continued.</p>
<p>Example:</p>
<p><code>
(sample.rb:1) print 1+2
$1 = 3
(sample.rb:1) print self
$2 = main
</code></p>
<p>Below is the case of the exception:</p>
<p><code>
(sample.rb:1) print (1+2
$1 = SyntaxError: line 1: syntax error, unexpected $end, expecting ')'
</code></p>
<h4 id="quit-command">Quit Command</h4>
<p>Quitting the debugger.</p>
<p>Usage:</p>
<p><code>
quit
q
</code></p>
<h4 id="run-command">Run Command</h4>
<p>Running the program and stopping at the first breakpoint.</p>
<p>Usage:</p>
<p><code>
run
r
</code></p>
<h4 id="step-command">Step Command</h4>
<p>This will run the program step by step.
When the method and the block are invoked, the program will be stop at the first row.
The program, which is developed in C, will be ignored.</p>
</div></div>
<div id="footer">
Generated on Wed Nov 27 22:35:07 2019 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.20 in <a href="https://github.com/sagmor/yard-mruby">mruby mode</a> 0.3.0 (ruby-2.5.5).
</div>
</div>
</body>
</html>