tddium-ruby-debug-base19 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +10 -0
- data/CHANGES +334 -0
- data/LICENSE +23 -0
- data/README +122 -0
- data/Rakefile +266 -0
- data/ext/ruby_debug/breakpoint.c +578 -0
- data/ext/ruby_debug/extconf.rb +41 -0
- data/ext/ruby_debug/ruby_debug.c +2541 -0
- data/ext/ruby_debug/ruby_debug.h +138 -0
- data/lib/ChangeLog +1065 -0
- data/lib/ruby-debug-base.rb +304 -0
- data/test/base/base.rb +56 -0
- data/test/base/binding.rb +31 -0
- data/test/base/catchpoint.rb +23 -0
- metadata +108 -0
data/AUTHORS
ADDED
data/CHANGES
ADDED
@@ -0,0 +1,334 @@
|
|
1
|
+
0.10.3
|
2
|
+
11/17/08
|
3
|
+
|
4
|
+
- a backtrace now warns when it thinks the callstack is truncated which it
|
5
|
+
gets by comparing with caller()
|
6
|
+
- fix setting $0.
|
7
|
+
- fix bug in showing variables in post-mortem
|
8
|
+
- Document how Debugger.start with a block is intended to be used.
|
9
|
+
- Move Kernel#debugger from ruby-debug-base into ruby-debug
|
10
|
+
- Get regression tests working again
|
11
|
+
- Warn and add a "confirmation" when setting a breakpoint on a
|
12
|
+
file that is not loaded.
|
13
|
+
|
14
|
+
0.10.2
|
15
|
+
- debugger(steps=0) breaks inside of debugger rather than wait for a line event.
|
16
|
+
- trace var varname (stop|nostop) added which issues trace_var.
|
17
|
+
- start method is now properly defined in Debugger module
|
18
|
+
- fixed 'finish' command
|
19
|
+
- rdebug script now works with Ruby 1.8.7
|
20
|
+
|
21
|
+
0.10.1
|
22
|
+
4/10/08 - in honor of the 30th Birthday of Kate Schwarz
|
23
|
+
|
24
|
+
- bin/rdebug
|
25
|
+
|
26
|
+
* "rdebug --post-mortem" now really catches uncaught exceptions and
|
27
|
+
brings you to post-mortem handling. "info program" shows the exception.
|
28
|
+
|
29
|
+
* rdebug now searches using ENV['PATH'] for a Ruby program to debug
|
30
|
+
if the program name is not found and doesn't have any path
|
31
|
+
characters in it.
|
32
|
+
|
33
|
+
* Use ~/.rdboptrc (rdbopt.ini on MS Windows) to change default options.
|
34
|
+
|
35
|
+
* --emacs is now --emacs-basic while --emacs 3 now implies emacs-basic
|
36
|
+
---annotate=3 --post-mortem --no-control --no-start --no-quit
|
37
|
+
|
38
|
+
- rdebug (CLI)
|
39
|
+
|
40
|
+
* "info" command additions and changes:
|
41
|
+
o fix bug in "info variables" when string had embedded %s'
|
42
|
+
o "info program" now shows uncaught exception information
|
43
|
+
o "info files" show what Ruby files are loaded
|
44
|
+
o "info file <f>" specific file information of <f> (e.g. time, # of lines, SHA1)
|
45
|
+
o "info catch" - Exceptions that can be caught in the current stack frame.
|
46
|
+
o "info "variables" shows "self" and class variables
|
47
|
+
o "info threads verbose" shows stack trace of all threads
|
48
|
+
o "info thread <t> verbose" shows stack trace of thread <t>.
|
49
|
+
|
50
|
+
* "frame" command now accepts an optional thread number argument
|
51
|
+
|
52
|
+
* Long information added to commands with subcommands: show, set,
|
53
|
+
info, enable, and disable. For example "help info <xxx>" will give
|
54
|
+
more detailed information about the "info <xxx>" command.
|
55
|
+
|
56
|
+
* columnize now pulled in from a separate package.
|
57
|
+
|
58
|
+
* add "var cl[ass]" command. Note "var const" can no longer be
|
59
|
+
abbreviated "var c"; use "var co" (or const or constant).
|
60
|
+
|
61
|
+
* add "condition" command. Allow removal of condition.
|
62
|
+
|
63
|
+
* $0 == __FILE__ when running rdebug should work -- most of the
|
64
|
+
time. See comments in code for a better solution.
|
65
|
+
|
66
|
+
* rdebug command history can be displayed with "show commands". Fix a bug
|
67
|
+
in history saving.
|
68
|
+
|
69
|
+
* INCOMPATIBLE CHANGE: "finish" works like gdb - stop just before the most
|
70
|
+
recent method finishes. Will now accept a number which stops that many
|
71
|
+
frames completed. (Note that return line numbers will be funny, the
|
72
|
+
first line of the method until Ruby 1.8.7.)
|
73
|
+
|
74
|
+
* fix bug in 'list' command when wrapping off the end.
|
75
|
+
|
76
|
+
- Emacs interaction drastically reworked, expanded, and improved.
|
77
|
+
|
78
|
+
- rdebug base
|
79
|
+
* allow catching multiple exceptions.
|
80
|
+
INCOMPATIBLE CHANGE: variable "Debugger.catchpoint", a String, was turned
|
81
|
+
into "Debugger.catchpoints", a Hash. Method "Debugger.catchpoint=" no
|
82
|
+
longer exists. Debugger.set_catchpoint was turned into
|
83
|
+
Debugger.add_catchpoint
|
84
|
+
|
85
|
+
* Add Debugger.last_exception which is set in post-mortem.
|
86
|
+
|
87
|
+
* remove Debugger.stop() when an exception is raised that would terminate the
|
88
|
+
debugged program. This may allow catchpoints to work and allow tracing user
|
89
|
+
code which handles "Exit" exceptions
|
90
|
+
|
91
|
+
* split off breakpoint code in ruby_debug.c.
|
92
|
+
|
93
|
+
* preface ruby_debug global Ruby variables with rdebug_.
|
94
|
+
|
95
|
+
* Change Debugger.start() to accept an optional options argument
|
96
|
+
:init => true saves things (like $0 and ARGV) necessary to
|
97
|
+
allow restart. Default: true
|
98
|
+
:post_mortem => true runs post-mortem on an uncaught exception
|
99
|
+
Default: false
|
100
|
+
|
101
|
+
The old Debugger.start() is now renamed to Debugger.start_()
|
102
|
+
|
103
|
+
* split of line caching to an external gem. We now only allow setting
|
104
|
+
breakpoints on lines where it makes sense to do so.
|
105
|
+
|
106
|
+
* Incompatible enhancement: even return/end will now call event handler
|
107
|
+
|
108
|
+
See ChangeLog for full details, and the reference guide for more complete
|
109
|
+
documentation of these changes.
|
110
|
+
|
111
|
+
0.10.0
|
112
|
+
12/25/07
|
113
|
+
|
114
|
+
- '-r' option can be used to require additional libraries.
|
115
|
+
- --noquit option added to stay in debugger when the program exits
|
116
|
+
- gdb-like --annotate option added. Can be used by front-ends to get information
|
117
|
+
without polling
|
118
|
+
- Fixed 'var const' command. Issue #10847.
|
119
|
+
- Using pretty-print for all var commands.
|
120
|
+
- Better error reporting for commands that require a numeric argument.
|
121
|
+
- Fixed Kernel#binding_n method
|
122
|
+
- Add option -d ($DEBUG = true) and --verbose. Make -v work like ruby.
|
123
|
+
- Remove debugger messages caused when warnings are turned on.
|
124
|
+
- "info" and "show" commands added. "set" made more like gdb's
|
125
|
+
set. subcommands can be abbreviated and are case insensitive.
|
126
|
+
- restart program if it terminates normally and we've got a tty and
|
127
|
+
we stop on the first statement.
|
128
|
+
- help is in tidy column format. method lists are shown that way as well.
|
129
|
+
the "width" setting ("set/show width") is used for the line width
|
130
|
+
- stack traces now show parameter names and types. "info args" lists just
|
131
|
+
the parameters (with the most recent values, not the values at call time).
|
132
|
+
- post-mortem "exit" bug fixed.
|
133
|
+
- More Emacs-friendly: rdebug-track.el will track location inside an Emacs
|
134
|
+
shell. Emacs position information is shown in breakpoints and catchpoints
|
135
|
+
similar to gdba. Commands to position in another window a unit test traceback
|
136
|
+
or ruby traceback. Much more work invisioned for Emacs.
|
137
|
+
- INCOMPATIBLE CHANGE: "break" now sets a breakpoint on the current line
|
138
|
+
(same as gdb). Use "info break" for a list of breakpoints.
|
139
|
+
- INCOMPATIBLE CHANGE: "script" command removed. Use "source" command instead
|
140
|
+
(same as gdb).
|
141
|
+
- Run .rdebugrc on Debugger.start. Look for a file in the current directory and
|
142
|
+
run that instead of the one in $HOME if that exists. Again, inspired by and compatible
|
143
|
+
with gdb.
|
144
|
+
- Changes compatible with Ruby 1.9. NOTE: this debugger will NOT work with
|
145
|
+
Ruby 1.9
|
146
|
+
- leaving irb shows position same as entering debugger; "list" position
|
147
|
+
is also cleared when leaving irb
|
148
|
+
- help "foo" gives message "Undefined command "foo" rather than a list
|
149
|
+
of help commands. (Message test is gdb's)
|
150
|
+
- Add set linetrace+ - similar to step+ for linetrace
|
151
|
+
- Start unit tests.
|
152
|
+
- Start a reference guide.
|
153
|
+
|
154
|
+
0.9.3
|
155
|
+
- Fixed if..elsif..end stepping.
|
156
|
+
- From irb session Ctrl-C or 'cont' command continues execution without showing the debugger prompt.
|
157
|
+
- Added Debugger.settings method to programatically modify command settings.
|
158
|
+
- Added Kernel#breakpoint as alias to Kernel#debugger is the former is not already defined.
|
159
|
+
|
160
|
+
0.9.2
|
161
|
+
- Fixed file comparison in Windows platform.
|
162
|
+
- Added setter methods to Breakpoint properties
|
163
|
+
- Added breakpoint hit condition functionality (not available via CLI yet) and methods:
|
164
|
+
Breakpoint:hit_count
|
165
|
+
Breakpoint:hit_value[=]
|
166
|
+
Breakpoint:hit_condition[=]
|
167
|
+
|
168
|
+
0.9.1
|
169
|
+
- Fixed incorrect stack calculation.
|
170
|
+
- Context#stop_next= method aliased as Context#step.
|
171
|
+
- Added the 'force' parameter to Context#step_over.
|
172
|
+
- Added the 'force' parameter to Context#step.
|
173
|
+
- 'next+/step+' commands forces to move to another line
|
174
|
+
- Added a new 'forcestep' setting.
|
175
|
+
|
176
|
+
0.9
|
177
|
+
- Kernel#debugger method will start the debugger if it's not running.
|
178
|
+
- Added Context#stop_reason method.
|
179
|
+
- Calling a method with a block will create a new frame. This changes the behavior of 'next' command. So in order to step into a block, 'step' command must be used. That fixes bug #9629.
|
180
|
+
- Added the possibility to add a temporary context-specific breakpoint. Context#breakpoint and Context#set_breakpoint methods are added.
|
181
|
+
- 'cont' command now accepts a numerical parameter which implements 'Continue until line' behavior.
|
182
|
+
- Added new Context.frame_class method
|
183
|
+
- Added new 'framefullpath' setting.
|
184
|
+
- Added new 'frameclassname' setting.
|
185
|
+
- All Ruby's 'eval' and require/load methods create a new frame. Fixes bug #9686.
|
186
|
+
|
187
|
+
0.8.1
|
188
|
+
- Added a shortcut module 'debugger'. require "ruby-debug/debugger" will start the debugger and stop at the next line (similar to require 'debug').
|
189
|
+
- Fixed remote debugging.
|
190
|
+
|
191
|
+
0.8
|
192
|
+
- Extract the base debugger API into a separate gem (ruby-debug-base), so it will be easier to add a new interface.
|
193
|
+
- Added 'set autoirb' setting.
|
194
|
+
- Bugfixes.
|
195
|
+
|
196
|
+
0.7.5
|
197
|
+
- Fixed 'reload on' command
|
198
|
+
- 'reload on' command is removed in favor of 'set autoreload'
|
199
|
+
- rdebug will evaluate ~/.rdebugrc script on startup
|
200
|
+
|
201
|
+
0.7.4
|
202
|
+
- Added a workaround of the Ruby interpreter problem where a method created with Module#define_method
|
203
|
+
and which raises an exception doesn't trigger a :return event, this way screwing the stack trace.
|
204
|
+
- Fixed a situation of an array 'out of bounds' access.
|
205
|
+
- Fixed the help for 'where' command.
|
206
|
+
|
207
|
+
0.7.3
|
208
|
+
- Fixed a case when a frame is not popped up properly.
|
209
|
+
- Removed Context.ignore= method, since it can result with the segmentation fault error.
|
210
|
+
- Fixed the case when Context#suspend may effect the state of the thread on Context#resume
|
211
|
+
- Fixed several cases of seg faults when accessing dyna_vars structure.
|
212
|
+
|
213
|
+
0.7.2
|
214
|
+
- Fixed Context#resume (a thread should be waked up only when it was running when it was suspended).
|
215
|
+
- When handling post-mortem exception, all threads must be suspended.
|
216
|
+
|
217
|
+
0.7.1
|
218
|
+
- Fixed 'delete' command
|
219
|
+
|
220
|
+
0.7
|
221
|
+
- Eliminated explicit Frame object. Use Context.frame_[binding,file,line] instead.
|
222
|
+
- Fixed help command.
|
223
|
+
- Renamed Debugger.keep_frame_info to Debugger.keep_frame_binding
|
224
|
+
- 'eval' command is available, even when keep_frame_binding is not used.
|
225
|
+
- New 'set' command is available.
|
226
|
+
|
227
|
+
0.6.2
|
228
|
+
- Added thread lookup cache.
|
229
|
+
- Control thread is always started by rdebug script.
|
230
|
+
- Ability to specify negative frame number to frame commands. Patch from R. Bernstein.
|
231
|
+
|
232
|
+
0.6.1
|
233
|
+
- Another performance optimization.
|
234
|
+
|
235
|
+
0.6
|
236
|
+
- Added option to exclude collecting of frame bindings.
|
237
|
+
- Several performance optimizations.
|
238
|
+
|
239
|
+
0.5.4
|
240
|
+
- Added -x/--trace option to rdebug script. Patch from R. Bernstein.
|
241
|
+
- Removed a live thread reference from the context's structure avoiding memory leakage.
|
242
|
+
|
243
|
+
0.5.3
|
244
|
+
- Added Module#post_mortem_method method, which wraps any method with Debugger.post_mortem block.
|
245
|
+
- Added breakpoint id, which is not dependent on the breakpoint position in Debugger.breakpoints array.
|
246
|
+
|
247
|
+
0.5.2
|
248
|
+
- Fixes interoperability problems with rspec.
|
249
|
+
- Made 'exit' as an alias to 'quit'
|
250
|
+
- Added 'restart' command. Patch from R. Bernstein.
|
251
|
+
|
252
|
+
0.5.1
|
253
|
+
- Bugfixes.
|
254
|
+
|
255
|
+
0.5
|
256
|
+
- Added post-mortem debugging
|
257
|
+
- Added 'irb' command.
|
258
|
+
|
259
|
+
0.4.5
|
260
|
+
- Fixed debug_method when applied to setter.
|
261
|
+
- Added 'reload' command which can be used to reload source code in case it's been changed.
|
262
|
+
- Added Debugger.reload_source_on_change option (true, by default) which controls whether ruby-debug should keep
|
263
|
+
track of the source files modification times and reload them if they've been changed.
|
264
|
+
|
265
|
+
0.4.4
|
266
|
+
- Renamed Context#set_suspend and Context#clear_suspend methods to Context#suspend and Context#resume respectively.
|
267
|
+
- Context#resume method not only clears suspend flag, but also resumes the thread execution.
|
268
|
+
- Bugfixes.
|
269
|
+
|
270
|
+
0.4.3
|
271
|
+
- Added Debugger.skip method which allows escaping a block from the debugger reach.
|
272
|
+
- Bugfixes.
|
273
|
+
|
274
|
+
0.4.2
|
275
|
+
- Module#deubg_method added.
|
276
|
+
- Added rdoc.
|
277
|
+
- Bugfixes.
|
278
|
+
|
279
|
+
0.4.1
|
280
|
+
- New binding_n method for Kernel module.
|
281
|
+
- Bugfixes.
|
282
|
+
|
283
|
+
0.4
|
284
|
+
- Debugger.start method takes a block. If a block is specified, this method starts debugger, yields to the block
|
285
|
+
and stops debugger at the end.
|
286
|
+
- 'tm[ate]' command accepts a frame number now.
|
287
|
+
- 'list' command accepts on/off parameter which controls whether listing will be displayed on every stop.
|
288
|
+
- 'eval on/off' controls the evaluation of unknown command.
|
289
|
+
- Debugger reads readline history file .rdebug_hist at startup and saves it at exit.
|
290
|
+
- 'sa[ve] <file>' command can be used to save current breackpoints and catchpoint if any
|
291
|
+
- 'sc[ript] <file>' command can be used to run script file. Script files can contain only control commands.
|
292
|
+
- rdebug script accepts '--script FILE' parameter.
|
293
|
+
- thread commands are available for the control port.
|
294
|
+
|
295
|
+
0.3 (2006-08-07)
|
296
|
+
- Renamed Debugger.start_server to Debugger.start_remote.
|
297
|
+
- Debugger.start_remote activates debugger by calling Debugger.start.
|
298
|
+
- Debugger.start_remote starts a control thread which listen on port 8990 and accepts control
|
299
|
+
commands, such as adding/deleting breakpoints, assigning catchpoint, etc. (Useful for GUI integration)
|
300
|
+
- New Debugger.wait_connection option. When it's true, Debugger.start_remote waits until
|
301
|
+
a remote connection is made.
|
302
|
+
- New Debugger.stop_on_connect option. When a remote connection is established, debugger
|
303
|
+
stops the main thread (Thread.main).
|
304
|
+
- 'interrupt' command is available for the control thread.
|
305
|
+
|
306
|
+
0.2.1 (2006-07-29)
|
307
|
+
- 'f[rame] nn' command selects a numbered frame. Frame numbers can be obtained by running frame
|
308
|
+
command without parameters.
|
309
|
+
- 'l[ist] =' show code in the context of the current line.
|
310
|
+
- 'tm[ate]' opens the current file in TextMate. Available only on Mac OSX.
|
311
|
+
|
312
|
+
0.2 (2006-07-17)
|
313
|
+
- Added the remote debugging. It should be activated by calling Debugger#start_server method.
|
314
|
+
- CHANGED: In order to activate the debugger, it's not enough to require 'ruby-debug'.
|
315
|
+
Debugger#start method must be called explicitly.
|
316
|
+
- Debugger used to evaluate anything you enter as long as it's not a command. Starting from
|
317
|
+
this version the 'eval' command must be used to evaluate an expression.
|
318
|
+
|
319
|
+
0.1.5 (2006-07-13)
|
320
|
+
- Now the check for a breakpoint uses base filename of the source file.
|
321
|
+
- Removed compilation warnings when compiling with -Wall
|
322
|
+
|
323
|
+
0.1.4 (2006-07-12)
|
324
|
+
- Remembers the previous command. Invoke it by typing a carriage return
|
325
|
+
at the command prompt.
|
326
|
+
|
327
|
+
0.1.3 (2006-07-11)
|
328
|
+
- Conditional breakpoints
|
329
|
+
- Bugfixes
|
330
|
+
|
331
|
+
0.1.2 (2006-07-16)
|
332
|
+
========================
|
333
|
+
|
334
|
+
- Initial release.
|
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (C) 2005 Kent Sibilev <ksibilev@yahoo.com>
|
2
|
+
All rights reserved.
|
3
|
+
*
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions
|
6
|
+
are met:
|
7
|
+
1. Redistributions of source code must retain the above copyright
|
8
|
+
notice, this list of conditions and the following disclaimer.
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright
|
10
|
+
notice, this list of conditions and the following disclaimer in the
|
11
|
+
documentation and/or other materials provided with the distribution.
|
12
|
+
*
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
14
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
15
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
16
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
17
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
18
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
19
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
20
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
21
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
22
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
23
|
+
SUCH DAMAGE.
|
data/README
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
*************************************************************
|
2
|
+
|
3
|
+
NOTE: For Ruby 1.9 installation instructions, please see:
|
4
|
+
|
5
|
+
http://wiki.github.com/mark-moseley/ruby-debug
|
6
|
+
|
7
|
+
*************************************************************
|
8
|
+
|
9
|
+
= ruby-debug
|
10
|
+
|
11
|
+
== Overview
|
12
|
+
|
13
|
+
ruby-debug is a fast implementation of the standard debugger debug.rb.
|
14
|
+
The faster execution speed is achieved by utilizing a new hook in the
|
15
|
+
Ruby C API.
|
16
|
+
|
17
|
+
== Requirements
|
18
|
+
|
19
|
+
ruby-debug requires Ruby 1.8.4 or higher.
|
20
|
+
|
21
|
+
Unless you get the packages as a binary (Microsoft Windows binaries
|
22
|
+
are sometimes available), you'll need a C compiler and Ruby
|
23
|
+
development headers, and a Make program so the extension in
|
24
|
+
ruby-debug-base can be compiled when it is installed.
|
25
|
+
|
26
|
+
To install on Microsoft Windows, unless you run under cygwin or mingw
|
27
|
+
you'll need Microsoft Visual C++ 6.0 also known as VC6.
|
28
|
+
http://rubyforge.org/tracker/index.php?func=detail&aid=16774&group_id=1900&atid=7436
|
29
|
+
suggests why.
|
30
|
+
|
31
|
+
|
32
|
+
== Install
|
33
|
+
|
34
|
+
ruby-debug is provided as a RubyGem. To install:
|
35
|
+
|
36
|
+
<tt>gem install ruby-debug</tt>
|
37
|
+
|
38
|
+
This should also pull in <tt>ruby-debug-base</tt> as a dependency.
|
39
|
+
|
40
|
+
(If you install ruby-debug-base explicitly, you can add in the <tt>--test</tt>
|
41
|
+
option after "install" to have the regression test run before
|
42
|
+
installing.)
|
43
|
+
|
44
|
+
For Emacs support and the Reference Manual, get
|
45
|
+
<tt>ruby-debug-extra</tt>. This is not a RubyGem, you'll need a Make
|
46
|
+
program and a POSIX shell. With this installed, run:
|
47
|
+
|
48
|
+
sh ./configure
|
49
|
+
make
|
50
|
+
make test # optional, but a good idea
|
51
|
+
sudo make install
|
52
|
+
|
53
|
+
|
54
|
+
==== Install on MS Windows
|
55
|
+
|
56
|
+
Compiling under cygwin or mingw works like it does on Unix.
|
57
|
+
|
58
|
+
* Have Microsoft Visual C++ 6.0 (VC6) installed - exactly that version.
|
59
|
+
|
60
|
+
* Set the appropriate environment variables.
|
61
|
+
|
62
|
+
* run `nmake'.
|
63
|
+
|
64
|
+
* Copy ruby_debug.so to `win32'.
|
65
|
+
|
66
|
+
* Go to the ruby_debug root.
|
67
|
+
|
68
|
+
* rake win32_gem
|
69
|
+
|
70
|
+
* The file is in named `rdebug-debug-base-0.10.0-mswin32.gem'.
|
71
|
+
|
72
|
+
== Usage
|
73
|
+
|
74
|
+
There are two ways of running ruby-debug.
|
75
|
+
|
76
|
+
=== rdebug executable:
|
77
|
+
|
78
|
+
$ rdebug <your-script>
|
79
|
+
|
80
|
+
When you start your script this way, the debugger will stop at
|
81
|
+
the first line of code in the script file. So you will be able
|
82
|
+
to set up your breakpoints.
|
83
|
+
|
84
|
+
=== ruby-debug API
|
85
|
+
|
86
|
+
The second way is to use the ruby-debug API to interrupt your
|
87
|
+
code execution at run time.
|
88
|
+
|
89
|
+
require 'ruby-debug' ; Debugger.start
|
90
|
+
...
|
91
|
+
def your_method
|
92
|
+
...
|
93
|
+
debugger
|
94
|
+
...
|
95
|
+
end
|
96
|
+
|
97
|
+
or
|
98
|
+
|
99
|
+
require 'ruby-debug' ;
|
100
|
+
Debugger.start do
|
101
|
+
...
|
102
|
+
debugger
|
103
|
+
end
|
104
|
+
|
105
|
+
When Kernel#debugger method is executed, the debugger is activated
|
106
|
+
and you will be able to inspect and step through your code.
|
107
|
+
|
108
|
+
== Performance
|
109
|
+
|
110
|
+
The <tt>debug.rb</tt> script that comes with the standard Ruby library uses
|
111
|
+
<tt>Kernel#set_trace_func</tt> API. Implementing the debugger in pure Ruby has
|
112
|
+
a negative impact on the speed of your program execution. This is
|
113
|
+
because the Ruby interpreter creates a Binding object each trace call,
|
114
|
+
even though it is not being used most of the time. ruby-debug moves
|
115
|
+
most of the functionality for Binding access and for breakpoint
|
116
|
+
testing to a native extension. Because this code is in C and because
|
117
|
+
and can be selectively enabled or disabled, the overhead in running
|
118
|
+
your program can be minimized.
|
119
|
+
|
120
|
+
== License
|
121
|
+
|
122
|
+
See LICENSE for license information.
|