debugger 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +3 -0
- data/README.md +2 -1
- data/Rakefile +4 -5
- data/bin/rdebug +29 -30
- data/lib/debugger.rb +0 -2
- data/lib/debugger/version.rb +1 -1
- data/lib/ruby-debug-base.rb +26 -27
- data/{cli → lib}/ruby-debug.rb +0 -0
- data/{cli → lib}/ruby-debug/command.rb +19 -20
- data/{cli → lib}/ruby-debug/commands/breakpoints.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/catchpoint.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/condition.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/continue.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/control.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/display.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/edit.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/enable.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/eval.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/finish.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/frame.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/help.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/info.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/irb.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/jump.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/kill.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/list.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/method.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/quit.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/reload.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/save.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/set.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/show.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/skip.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/source.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/stepping.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/threads.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/tmate.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/trace.rb +0 -0
- data/{cli → lib}/ruby-debug/commands/variables.rb +0 -0
- data/{cli → lib}/ruby-debug/debugger.rb +0 -0
- data/{cli → lib}/ruby-debug/helper.rb +0 -0
- data/{cli → lib}/ruby-debug/interface.rb +0 -0
- data/{cli → lib}/ruby-debug/processor.rb +0 -0
- data/test/helper.rb +14 -16
- data/test/{cli → lib}/commands/catchpoint_test.rb +4 -12
- data/test/{cli → lib}/commands/unit/regexp.rb +3 -7
- data/test/tdebug.rb +17 -18
- data/test/test-annotate.rb +2 -3
- data/test/test-break-bad.rb +4 -5
- data/test/test-breakpoints.rb +2 -3
- data/test/test-catch.rb +1 -2
- data/test/test-catch2.rb +1 -2
- data/test/test-catch3.rb +1 -2
- data/test/test-condition.rb +2 -3
- data/test/test-ctrl.rb +1 -2
- data/test/test-display.rb +3 -4
- data/test/test-dollar-0.rb +7 -8
- data/test/test-edit.rb +2 -3
- data/test/test-emacs-basic.rb +4 -5
- data/test/test-enable.rb +2 -3
- data/test/test-finish.rb +3 -4
- data/test/test-frame.rb +2 -3
- data/test/test-help.rb +6 -7
- data/test/test-hist.rb +4 -7
- data/test/test-info-thread.rb +2 -3
- data/test/test-info-var.rb +3 -4
- data/test/test-info.rb +2 -3
- data/test/test-init.rb +1 -2
- data/test/test-jump.rb +4 -5
- data/test/test-list.rb +3 -4
- data/test/test-method.rb +4 -5
- data/test/test-next.rb +2 -3
- data/test/test-output.rb +2 -3
- data/test/test-quit.rb +2 -3
- data/test/test-raise.rb +1 -2
- data/test/test-save.rb +2 -3
- data/test/test-scope-var.rb +2 -3
- data/test/test-setshow.rb +2 -3
- data/test/test-source.rb +2 -3
- data/test/test-stepping.rb +2 -3
- data/test/test-trace.rb +4 -5
- data/test/thread1.rb +1 -2
- metadata +76 -51
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
## Description
|
2
2
|
A fork of ruby-debug19 that works on 1.9.2 and 1.9.3 and installs easily for rvm/rbenv rubies.
|
3
3
|
|
4
|
-
[](http://travis-ci.org/cldwalker/
|
4
|
+
[](http://travis-ci.org/cldwalker/debugger)
|
5
5
|
|
6
6
|
## Install
|
7
7
|
|
@@ -58,6 +58,7 @@ Let's keep this working for the ruby community!
|
|
58
58
|
## Credits
|
59
59
|
|
60
60
|
* Thanks to the original authors: Kent Sibilev and Mark Moseley
|
61
|
+
* Contributors: jnimety
|
61
62
|
* Fork started on awesome @relevance fridays!
|
62
63
|
|
63
64
|
## TODO
|
data/Rakefile
CHANGED
@@ -15,13 +15,13 @@ COMMON_FILES = FileList[
|
|
15
15
|
'Rakefile',
|
16
16
|
]
|
17
17
|
|
18
|
-
CLI_TEST_FILE_LIST = FileList['test/
|
19
|
-
'test/
|
20
|
-
'test/
|
18
|
+
CLI_TEST_FILE_LIST = FileList['test/lib/commands/unit/*.rb',
|
19
|
+
'test/lib/commands/*_test.rb',
|
20
|
+
'test/lib/**/*_test.rb']
|
21
21
|
# disabled until requires fixed and tests pass
|
22
22
|
# 'test/test-*.rb']
|
23
23
|
CLI_FILES = COMMON_FILES + FileList[
|
24
|
-
"
|
24
|
+
"lib/**/*",
|
25
25
|
'ChangeLog',
|
26
26
|
'bin/*',
|
27
27
|
'doc/rdebug.1',
|
@@ -51,7 +51,6 @@ task :test => :test_base do
|
|
51
51
|
Rake::TestTask.new(:test) do |t|
|
52
52
|
t.libs << './ext'
|
53
53
|
t.libs << './lib'
|
54
|
-
t.libs << './cli'
|
55
54
|
t.test_files = CLI_TEST_FILE_LIST
|
56
55
|
t.verbose = true
|
57
56
|
end
|
data/bin/rdebug
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
#Fast Ruby Debugger.
|
7
7
|
#
|
8
8
|
#Command invocation:
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# rdebug [options] [--] [script-options] ruby-script-to-debug
|
11
11
|
# rdebug [options] [script-options] [--client]
|
12
12
|
# rdebug [--version | --help]
|
@@ -89,7 +89,7 @@
|
|
89
89
|
# Keep frame bindings.
|
90
90
|
#
|
91
91
|
#<tt>--script=</tt><i>file</i>::
|
92
|
-
# Name of the script file to run
|
92
|
+
# Name of the script file to run
|
93
93
|
#
|
94
94
|
#<tt>-s | --server</tt>::
|
95
95
|
# Listen for remote connections. Another rdebug session
|
@@ -102,19 +102,18 @@
|
|
102
102
|
#<tt>--help</tt>::
|
103
103
|
# Show invocation help and exit.
|
104
104
|
|
105
|
-
require 'rubygems'
|
106
105
|
require 'optparse'
|
107
106
|
require 'ostruct'
|
108
|
-
|
107
|
+
require 'ruby-debug'
|
109
108
|
|
110
109
|
def debug_program(options)
|
111
110
|
# Make sure Ruby script syntax checks okay.
|
112
|
-
# Otherwise we get a load message that looks like rdebug has
|
113
|
-
# a problem.
|
111
|
+
# Otherwise we get a load message that looks like rdebug has
|
112
|
+
# a problem.
|
114
113
|
output = `ruby -c "#{Debugger::PROG_SCRIPT}" 2>&1`
|
115
114
|
if $?.exitstatus != 0 and RUBY_PLATFORM !~ /mswin/
|
116
115
|
puts output
|
117
|
-
exit $?.exitstatus
|
116
|
+
exit $?.exitstatus
|
118
117
|
end
|
119
118
|
print "\032\032starting\n" if Debugger.annotate and Debugger.annotate > 2
|
120
119
|
|
@@ -172,20 +171,20 @@ Usage: #{program} [options] <script.rb> -- <script.rb parameters>
|
|
172
171
|
EOB
|
173
172
|
opts.separator ""
|
174
173
|
opts.separator "Options:"
|
175
|
-
opts.on("-A", "--annotate LEVEL", Integer, "Set annotation level") do
|
174
|
+
opts.on("-A", "--annotate LEVEL", Integer, "Set annotation level") do
|
176
175
|
|annotate|
|
177
176
|
Debugger.annotate = annotate
|
178
177
|
end
|
179
|
-
opts.on("-c", "--client", "Connect to remote debugger") do
|
178
|
+
opts.on("-c", "--client", "Connect to remote debugger") do
|
180
179
|
options.client = true
|
181
180
|
end
|
182
|
-
opts.on("--cport PORT", Integer, "Port used for control commands") do
|
181
|
+
opts.on("--cport PORT", Integer, "Port used for control commands") do
|
183
182
|
|cport|
|
184
183
|
options.cport = cport
|
185
184
|
end
|
186
185
|
opts.on("-d", "--debug", "Set $DEBUG=true") {$DEBUG = true}
|
187
186
|
opts.on("--emacs LEVEL", Integer,
|
188
|
-
"Activates full Emacs support at annotation level LEVEL") do
|
187
|
+
"Activates full Emacs support at annotation level LEVEL") do
|
189
188
|
|level|
|
190
189
|
Debugger.annotate = level.to_i
|
191
190
|
ENV['EMACS'] = '1'
|
@@ -193,7 +192,7 @@ EOB
|
|
193
192
|
options.control = false
|
194
193
|
options.quit = false
|
195
194
|
end
|
196
|
-
opts.on('--emacs-basic', 'Activates basic Emacs mode') do
|
195
|
+
opts.on('--emacs-basic', 'Activates basic Emacs mode') do
|
197
196
|
ENV['EMACS'] = '1'
|
198
197
|
end
|
199
198
|
opts.on('-h', '--host HOST', 'Host name used for remote debugging') do
|
@@ -203,23 +202,23 @@ EOB
|
|
203
202
|
opts.on('-I', '--include PATH', String, 'Add PATH to $LOAD_PATH') do |path|
|
204
203
|
$LOAD_PATH.unshift(path)
|
205
204
|
end
|
206
|
-
opts.on('--no-control', 'Do not automatically start control thread') do
|
205
|
+
opts.on('--no-control', 'Do not automatically start control thread') do
|
207
206
|
options.control = false
|
208
207
|
end
|
209
208
|
opts.on('--no-quit', 'Do not quit when script finishes') do
|
210
209
|
options.quit = false
|
211
210
|
end
|
212
211
|
opts.on('--no-rewrite-program',
|
213
|
-
'Do not set $0 to the program being debugged') do
|
212
|
+
'Do not set $0 to the program being debugged') do
|
214
213
|
options.no_rewrite_program = true
|
215
214
|
end
|
216
|
-
opts.on('--no-stop', 'Do not stop when script is loaded') do
|
215
|
+
opts.on('--no-stop', 'Do not stop when script is loaded') do
|
217
216
|
options.stop = false
|
218
217
|
end
|
219
218
|
opts.on('-nx', 'Not run debugger initialization files (e.g. .rdebugrc') do
|
220
219
|
options.nx = true
|
221
220
|
end
|
222
|
-
opts.on('-p', '--port PORT', Integer, 'Port used for remote debugging') do
|
221
|
+
opts.on('-p', '--port PORT', Integer, 'Port used for remote debugging') do
|
223
222
|
|port|
|
224
223
|
options.port = port
|
225
224
|
end
|
@@ -231,8 +230,8 @@ EOB
|
|
231
230
|
require name
|
232
231
|
end
|
233
232
|
end
|
234
|
-
opts.on('--restart-script FILE', String,
|
235
|
-
'Name of the script file to run. Erased after read') do
|
233
|
+
opts.on('--restart-script FILE', String,
|
234
|
+
'Name of the script file to run. Erased after read') do
|
236
235
|
|restart_script|
|
237
236
|
options.restart_script = restart_script
|
238
237
|
unless File.exists?(options.restart_script)
|
@@ -240,7 +239,7 @@ EOB
|
|
240
239
|
exit
|
241
240
|
end
|
242
241
|
end
|
243
|
-
opts.on('--script FILE', String, 'Name of the script file to run') do
|
242
|
+
opts.on('--script FILE', String, 'Name of the script file to run') do
|
244
243
|
|script|
|
245
244
|
options.script = script
|
246
245
|
unless File.exists?(options.script)
|
@@ -248,7 +247,7 @@ EOB
|
|
248
247
|
exit
|
249
248
|
end
|
250
249
|
end
|
251
|
-
opts.on('-s', '--server', 'Listen for remote connections') do
|
250
|
+
opts.on('-s', '--server', 'Listen for remote connections') do
|
252
251
|
options.server = true
|
253
252
|
end
|
254
253
|
opts.on('-w', '--wait', 'Wait for a client connection, implies -s option') do
|
@@ -261,7 +260,7 @@ EOB
|
|
261
260
|
puts opts
|
262
261
|
exit
|
263
262
|
end
|
264
|
-
opts.on_tail('--version',
|
263
|
+
opts.on_tail('--version',
|
265
264
|
'Print the version') do
|
266
265
|
puts "ruby-debug #{Debugger::VERSION}"
|
267
266
|
exit
|
@@ -270,7 +269,7 @@ EOB
|
|
270
269
|
$VERBOSE = true
|
271
270
|
options.verbose_long = true
|
272
271
|
end
|
273
|
-
opts.on_tail('-v',
|
272
|
+
opts.on_tail('-v',
|
274
273
|
'Print version number, then turn on verbose mode') do
|
275
274
|
puts "ruby-debug #{Debugger::VERSION}"
|
276
275
|
$VERBOSE = true
|
@@ -284,7 +283,7 @@ unless defined?(OPTS_INITFILE)
|
|
284
283
|
if RUBY_PLATFORM =~ /mswin/
|
285
284
|
# Of course MS Windows has to be different
|
286
285
|
OPTS_INITFILE = 'rdbopt.ini'
|
287
|
-
HOME_DIR = (ENV['HOME'] ||
|
286
|
+
HOME_DIR = (ENV['HOME'] ||
|
288
287
|
ENV['HOMEDRIVE'].to_s + ENV['HOMEPATH'].to_s).to_s
|
289
288
|
else
|
290
289
|
OPTS_INITFILE = '.rdboptrc'
|
@@ -293,7 +292,7 @@ unless defined?(OPTS_INITFILE)
|
|
293
292
|
end
|
294
293
|
begin
|
295
294
|
initfile = File.join(HOME_DIR, OPTS_INITFILE)
|
296
|
-
eval(File.read(initfile)) if
|
295
|
+
eval(File.read(initfile)) if
|
297
296
|
File.exist?(initfile)
|
298
297
|
rescue
|
299
298
|
end
|
@@ -328,18 +327,18 @@ else
|
|
328
327
|
puts 'Must specify a script to run'
|
329
328
|
exit(-1)
|
330
329
|
end
|
331
|
-
|
330
|
+
|
332
331
|
# save script name
|
333
332
|
prog_script = ARGV.shift
|
334
333
|
prog_script = whence_file(prog_script) unless File.exist?(prog_script)
|
335
334
|
Debugger::PROG_SCRIPT = File.expand_path prog_script
|
336
|
-
|
335
|
+
|
337
336
|
# install interruption handler
|
338
337
|
trap('INT') { Debugger.interrupt_last }
|
339
|
-
|
338
|
+
|
340
339
|
# set options
|
341
340
|
Debugger.wait_connection = options.wait
|
342
|
-
|
341
|
+
|
343
342
|
if options.server
|
344
343
|
# start remote mode
|
345
344
|
Debugger.start_remote(options.host, [options.port, options.cport]) do
|
@@ -355,7 +354,7 @@ else
|
|
355
354
|
|
356
355
|
# load initrc script (e.g. .rdebugrc)
|
357
356
|
Debugger.run_init_script(StringIO.new) unless options.nx
|
358
|
-
|
357
|
+
|
359
358
|
# run restore-settings startup script if specified
|
360
359
|
if options.restart_script
|
361
360
|
require 'fileutils'
|
@@ -384,7 +383,7 @@ else
|
|
384
383
|
print $!.backtrace.map{|l| "\t#{l}"}.join("\n"), "\n"
|
385
384
|
print "Uncaught exception: #{$!}\n"
|
386
385
|
end
|
387
|
-
print "The program finished.\n" unless
|
386
|
+
print "The program finished.\n" unless
|
388
387
|
Debugger.annotate.to_i > 1 # annotate has its own way
|
389
388
|
interface = Debugger::LocalInterface.new
|
390
389
|
# Not sure if ControlCommandProcessor is really the right
|
data/lib/debugger.rb
CHANGED
data/lib/debugger/version.rb
CHANGED
data/lib/ruby-debug-base.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
require 'ruby_debug.so'
|
2
|
-
require 'rubygems'
|
3
2
|
require 'linecache19'
|
4
3
|
|
5
4
|
module Debugger
|
6
|
-
|
5
|
+
|
7
6
|
# Default options to Debugger.start
|
8
|
-
DEFAULT_START_SETTINGS = {
|
9
|
-
:init => true, # Set $0 and save ARGV?
|
7
|
+
DEFAULT_START_SETTINGS = {
|
8
|
+
:init => true, # Set $0 and save ARGV?
|
10
9
|
:post_mortem => false, # post-mortem debugging on uncaught exception?
|
11
10
|
:tracing => nil # Debugger.tracing value. true/false resets,
|
12
11
|
# nil keeps the prior value
|
@@ -16,7 +15,7 @@ module Debugger
|
|
16
15
|
def interrupt
|
17
16
|
self.stop_next = 1
|
18
17
|
end
|
19
|
-
|
18
|
+
|
20
19
|
alias __c_frame_binding frame_binding
|
21
20
|
def frame_binding(frame)
|
22
21
|
__c_frame_binding(frame) || hbinding(frame)
|
@@ -59,27 +58,27 @@ module Debugger
|
|
59
58
|
handler.at_return(self, file, line)
|
60
59
|
end
|
61
60
|
end
|
62
|
-
|
61
|
+
|
63
62
|
@reload_source_on_change = false
|
64
63
|
@tracing_started = false
|
65
|
-
|
64
|
+
|
66
65
|
class << self
|
67
66
|
# interface modules provide +handler+ object
|
68
67
|
attr_accessor :handler
|
69
|
-
|
68
|
+
|
70
69
|
# if <tt>true</tt>, checks the modification time of source files and reloads if it was modified
|
71
70
|
attr_accessor :reload_source_on_change
|
72
71
|
|
73
72
|
attr_accessor :last_exception
|
74
73
|
Debugger.last_exception = nil
|
75
|
-
|
74
|
+
|
76
75
|
#
|
77
76
|
# Interrupts the current thread
|
78
77
|
#
|
79
78
|
def interrupt
|
80
79
|
current_context.interrupt
|
81
80
|
end
|
82
|
-
|
81
|
+
|
83
82
|
#
|
84
83
|
# Interrupts the last debugged thread
|
85
84
|
#
|
@@ -90,11 +89,11 @@ module Debugger
|
|
90
89
|
end
|
91
90
|
context
|
92
91
|
end
|
93
|
-
|
92
|
+
|
94
93
|
def source_reload
|
95
94
|
LineCache::clear_file_cache
|
96
95
|
end
|
97
|
-
|
96
|
+
|
98
97
|
# Get line +line_number+ from file named +filename+. Return "\n"
|
99
98
|
# there was a problem. Leaking blanks are stripped off.
|
100
99
|
def line_at(filename, line_number) # :nodoc:
|
@@ -106,7 +105,7 @@ module Debugger
|
|
106
105
|
|
107
106
|
#
|
108
107
|
# Activates the post-mortem mode. There are two ways of using it:
|
109
|
-
#
|
108
|
+
#
|
110
109
|
# == Global post-mortem mode
|
111
110
|
# By calling Debugger.post_mortem method without a block, you install
|
112
111
|
# at_exit hook that intercepts any unhandled by your script exceptions
|
@@ -145,9 +144,9 @@ module Debugger
|
|
145
144
|
end
|
146
145
|
end
|
147
146
|
end
|
148
|
-
|
147
|
+
|
149
148
|
def handle_post_mortem(exp)
|
150
|
-
return if !exp || !exp.__debug_context ||
|
149
|
+
return if !exp || !exp.__debug_context ||
|
151
150
|
exp.__debug_context.stack_size == 0
|
152
151
|
Debugger.suspend
|
153
152
|
orig_tracing = Debugger.tracing, Debugger.current_context.tracing
|
@@ -160,10 +159,10 @@ module Debugger
|
|
160
159
|
end
|
161
160
|
# private :handle_post_mortem
|
162
161
|
end
|
163
|
-
|
162
|
+
|
164
163
|
class DebugThread # :nodoc:
|
165
164
|
end
|
166
|
-
|
165
|
+
|
167
166
|
class ThreadsTable # :nodoc:
|
168
167
|
end
|
169
168
|
|
@@ -189,27 +188,27 @@ module Debugger
|
|
189
188
|
# <i>Note that if you want to stop debugger, you must call
|
190
189
|
# Debugger.stop as many time as you called Debugger.start
|
191
190
|
# method.</i>
|
192
|
-
#
|
191
|
+
#
|
193
192
|
# +options+ is a hash used to set various debugging options.
|
194
193
|
# Set :init true if you want to save ARGV and some variables which
|
195
194
|
# make a debugger restart possible. Only the first time :init is set true
|
196
|
-
# will values get set. Since ARGV is saved, you should make sure
|
197
|
-
# it hasn't been changed before the (first) call.
|
195
|
+
# will values get set. Since ARGV is saved, you should make sure
|
196
|
+
# it hasn't been changed before the (first) call.
|
198
197
|
# Set :post_mortem true if you want to enter post-mortem debugging
|
199
198
|
# on an uncaught exception. Once post-mortem debugging is set, it can't
|
200
199
|
# be unset.
|
201
200
|
def start(options={}, &block)
|
202
201
|
options = Debugger::DEFAULT_START_SETTINGS.merge(options)
|
203
202
|
if options[:init]
|
204
|
-
Debugger.const_set('ARGV', ARGV.clone) unless
|
203
|
+
Debugger.const_set('ARGV', ARGV.clone) unless
|
205
204
|
defined? Debugger::ARGV
|
206
|
-
Debugger.const_set('PROG_SCRIPT', $0) unless
|
205
|
+
Debugger.const_set('PROG_SCRIPT', $0) unless
|
207
206
|
defined? Debugger::PROG_SCRIPT
|
208
|
-
Debugger.const_set('INITIAL_DIR', Dir.pwd) unless
|
207
|
+
Debugger.const_set('INITIAL_DIR', Dir.pwd) unless
|
209
208
|
defined? Debugger::INITIAL_DIR
|
210
209
|
end
|
211
210
|
Debugger.tracing = options[:tracing] unless options[:tracing].nil?
|
212
|
-
retval = Debugger.started? ? block && block.call(self) : Debugger.start_(&block)
|
211
|
+
retval = Debugger.started? ? block && block.call(self) : Debugger.start_(&block)
|
213
212
|
if options[:post_mortem]
|
214
213
|
post_mortem
|
215
214
|
end
|
@@ -230,7 +229,7 @@ module Kernel
|
|
230
229
|
# right after the last statement in some scope, because the next
|
231
230
|
# step will take you out of some scope.
|
232
231
|
|
233
|
-
# If a block is given (and the debugger hasn't been started, we run the
|
232
|
+
# If a block is given (and the debugger hasn't been started, we run the
|
234
233
|
# block under the debugger. Alas, when a block is given, we can't support
|
235
234
|
# running the startup script or support the steps option. FIXME.
|
236
235
|
def debugger(steps = 1, &block)
|
@@ -247,7 +246,7 @@ module Kernel
|
|
247
246
|
end
|
248
247
|
end
|
249
248
|
alias breakpoint debugger unless respond_to?(:breakpoint)
|
250
|
-
|
249
|
+
|
251
250
|
#
|
252
251
|
# Returns a binding of n-th call frame
|
253
252
|
#
|
@@ -283,7 +282,7 @@ class Module
|
|
283
282
|
end
|
284
283
|
EOD
|
285
284
|
end
|
286
|
-
|
285
|
+
|
287
286
|
#
|
288
287
|
# Wraps the +meth+ method with Debugger.post_mortem {...} block.
|
289
288
|
#
|
data/{cli → lib}/ruby-debug.rb
RENAMED
File without changes
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'columnize'
|
3
2
|
require_relative 'helper'
|
4
3
|
|
@@ -29,22 +28,22 @@ module Debugger
|
|
29
28
|
def commands
|
30
29
|
@commands ||= []
|
31
30
|
end
|
32
|
-
|
31
|
+
|
33
32
|
DEF_OPTIONS = {
|
34
|
-
:allow_in_control => false,
|
33
|
+
:allow_in_control => false,
|
35
34
|
:allow_in_post_mortem => true,
|
36
|
-
:event => true,
|
35
|
+
:event => true,
|
37
36
|
:always_run => 0,
|
38
37
|
:unknown => false,
|
39
38
|
:need_context => false,
|
40
39
|
} unless defined?(DEF_OPTIONS)
|
41
|
-
|
40
|
+
|
42
41
|
def inherited(klass)
|
43
42
|
DEF_OPTIONS.each do |o, v|
|
44
43
|
klass.options[o] = v if klass.options[o].nil?
|
45
44
|
end
|
46
45
|
commands << klass
|
47
|
-
end
|
46
|
+
end
|
48
47
|
|
49
48
|
def load_commands
|
50
49
|
Dir[File.join(Debugger.const_get(:RUBY_DEBUG_DIR), 'commands', '*')].each do |file|
|
@@ -54,7 +53,7 @@ module Debugger
|
|
54
53
|
include mod
|
55
54
|
end
|
56
55
|
end
|
57
|
-
|
56
|
+
|
58
57
|
def method_missing(meth, *args, &block)
|
59
58
|
if meth.to_s =~ /^(.+?)=$/
|
60
59
|
@options[$1.intern] = args.first
|
@@ -66,7 +65,7 @@ module Debugger
|
|
66
65
|
end
|
67
66
|
end
|
68
67
|
end
|
69
|
-
|
68
|
+
|
70
69
|
def options
|
71
70
|
@options ||= {}
|
72
71
|
end
|
@@ -75,7 +74,7 @@ module Debugger
|
|
75
74
|
@@settings_map ||= {}
|
76
75
|
end
|
77
76
|
private :settings_map
|
78
|
-
|
77
|
+
|
79
78
|
def settings
|
80
79
|
unless true and defined? @settings and @settings
|
81
80
|
@settings = Object.new
|
@@ -126,7 +125,7 @@ module Debugger
|
|
126
125
|
end
|
127
126
|
end
|
128
127
|
|
129
|
-
register_setting_var(:basename, false) # use basename in showing files?
|
128
|
+
register_setting_var(:basename, false) # use basename in showing files?
|
130
129
|
register_setting_var(:callstyle, :last)
|
131
130
|
register_setting_var(:debuggertesting, false)
|
132
131
|
register_setting_var(:force_stepping, false)
|
@@ -134,18 +133,18 @@ module Debugger
|
|
134
133
|
register_setting_var(:listsize, 10) # number of lines in list command
|
135
134
|
register_setting_var(:stack_trace_on_error, false)
|
136
135
|
register_setting_var(:tracing_plus, false) # different linetrace lines?
|
137
|
-
|
138
|
-
# width of line output. Use COLUMNS value if it exists and is
|
136
|
+
|
137
|
+
# width of line output. Use COLUMNS value if it exists and is
|
139
138
|
# not too rediculously large.
|
140
|
-
width = ENV['COLUMNS'].to_i
|
139
|
+
width = ENV['COLUMNS'].to_i
|
141
140
|
width = 80 unless width > 10
|
142
|
-
register_setting_var(:width, width)
|
141
|
+
register_setting_var(:width, width)
|
143
142
|
|
144
143
|
if not defined? Debugger::ARGV
|
145
144
|
Debugger::ARGV = ARGV.clone
|
146
145
|
end
|
147
146
|
register_setting_var(:argv, Debugger::ARGV)
|
148
|
-
|
147
|
+
|
149
148
|
def initialize(state)
|
150
149
|
@state = state
|
151
150
|
end
|
@@ -156,7 +155,7 @@ module Debugger
|
|
156
155
|
|
157
156
|
protected
|
158
157
|
|
159
|
-
# FIXME: use delegate?
|
158
|
+
# FIXME: use delegate?
|
160
159
|
def errmsg(*args)
|
161
160
|
@state.errmsg(*args)
|
162
161
|
end
|
@@ -204,15 +203,15 @@ module Debugger
|
|
204
203
|
|
205
204
|
def get_context(thnum)
|
206
205
|
Debugger.contexts.find{|c| c.thnum == thnum}
|
207
|
-
end
|
206
|
+
end
|
208
207
|
end
|
209
|
-
|
208
|
+
|
210
209
|
Command.load_commands
|
211
210
|
|
212
211
|
# Returns setting object.
|
213
212
|
# Use Debugger.settings[] and Debugger.settings[]= methods to query and set
|
214
213
|
# debugger settings. These settings are available:
|
215
|
-
#
|
214
|
+
#
|
216
215
|
# - :autolist - automatically calls 'list' command on breakpoint
|
217
216
|
# - :autoeval - evaluates input in the current binding if it's not recognized as a debugger command
|
218
217
|
# - :autoirb - automatically calls 'irb' command on breakpoint
|
@@ -221,7 +220,7 @@ module Debugger
|
|
221
220
|
# - :frame_class_names - displays method's class name when showing frame stack
|
222
221
|
# - :reload_source_on_change - makes 'list' command to always display up-to-date source code
|
223
222
|
# - :force_stepping - stepping command asways move to the new line
|
224
|
-
#
|
223
|
+
#
|
225
224
|
def self.settings
|
226
225
|
Command.settings
|
227
226
|
end
|