ruby-debug 0.4.4-mswin32 → 0.4.5-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +6 -0
- data/ext/ruby_debug.c +1 -1
- data/lib/ruby-debug.rb +28 -5
- data/lib/ruby-debug/command.rb +1 -1
- data/lib/ruby-debug/commands/eval.rb +1 -1
- data/lib/ruby-debug/commands/list.rb +37 -0
- data/lib/ruby-debug/processor.rb +1 -0
- data/lib/ruby_debug.so +0 -0
- metadata +2 -2
data/CHANGES
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
0.4.5
|
2
|
+
- Fixed debug_method when applied to setter.
|
3
|
+
- Added reload command which can be used to reload source code in case it's been changed.
|
4
|
+
- Added Debugger.reload_source_on_change option (true, by default) which controls whether ruby-debug should keep
|
5
|
+
track of the source files modification times and reload them if they've been changed.
|
6
|
+
|
1
7
|
0.4.4
|
2
8
|
- Renamed Context#set_suspend and Context#clear_suspend methods to Context#suspend and Context#resume respectively.
|
3
9
|
- Context#resume method not only clears suspend flag, but also resumes the thread execution.
|
data/ext/ruby_debug.c
CHANGED
data/lib/ruby-debug.rb
CHANGED
@@ -5,11 +5,13 @@ require 'ruby_debug.so'
|
|
5
5
|
require 'ruby-debug/processor'
|
6
6
|
|
7
7
|
SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__
|
8
|
+
SCRIPT_TIMESTAMPS__ = {} unless defined? SCRIPT_TIMESTAMPS__
|
8
9
|
|
9
10
|
module Debugger
|
10
11
|
PORT = 8989
|
11
12
|
|
12
13
|
@processor = CommandProcessor.new
|
14
|
+
@reload_source_on_change = false
|
13
15
|
|
14
16
|
class Context
|
15
17
|
def interrupt
|
@@ -48,6 +50,9 @@ module Debugger
|
|
48
50
|
# in remote mode, wait for the remote connection
|
49
51
|
attr_accessor :wait_connection
|
50
52
|
|
53
|
+
# if <tt>true</tt>, checks the modification time of source files and reloads if it was modified
|
54
|
+
attr_accessor :reload_source_on_change
|
55
|
+
|
51
56
|
attr_reader :thread, :control_thread
|
52
57
|
|
53
58
|
#
|
@@ -164,12 +169,28 @@ module Debugger
|
|
164
169
|
private :stop_main_thread
|
165
170
|
|
166
171
|
def source_for(file) # :nodoc:
|
167
|
-
|
168
|
-
return source
|
172
|
+
unless File.exists?(file)
|
173
|
+
return (source == true ? nil : source)
|
169
174
|
end
|
170
|
-
|
175
|
+
|
176
|
+
if SCRIPT_LINES__[file].nil? || SCRIPT_LINES__[file] == true
|
177
|
+
SCRIPT_LINES__[file] = File.readlines(file)
|
178
|
+
end
|
179
|
+
|
180
|
+
change_time = test(?M, file)
|
181
|
+
SCRIPT_TIMESTAMPS__[file] ||= change_time
|
182
|
+
if @reload_source_on_change && SCRIPT_TIMESTAMPS__[file] < change_time
|
171
183
|
SCRIPT_LINES__[file] = File.readlines(file)
|
172
184
|
end
|
185
|
+
|
186
|
+
SCRIPT_LINES__[file]
|
187
|
+
end
|
188
|
+
|
189
|
+
def source_reload
|
190
|
+
SCRIPT_LINES__.keys.each do |file|
|
191
|
+
next unless File.exists?(file)
|
192
|
+
SCRIPT_LINES__[file] = nil
|
193
|
+
end
|
173
194
|
end
|
174
195
|
|
175
196
|
def line_at(file, line) # :nodoc:
|
@@ -216,12 +237,14 @@ class Module
|
|
216
237
|
# Wraps the +meth+ method with Debugger.start {...} block.
|
217
238
|
#
|
218
239
|
def debug_method(meth)
|
219
|
-
|
240
|
+
old_meth = "__debugee_#{meth}"
|
241
|
+
old_meth = "#{$1}_set" if old_meth =~ /^(.+)=$/
|
242
|
+
alias_method old_meth.to_sym, meth
|
220
243
|
class_eval <<-EOD
|
221
244
|
def #{meth}(*args, &block)
|
222
245
|
Debugger.start do
|
223
246
|
debugger 2
|
224
|
-
|
247
|
+
#{old_meth}(*args, &block)
|
225
248
|
end
|
226
249
|
end
|
227
250
|
EOD
|
data/lib/ruby-debug/command.rb
CHANGED
@@ -73,4 +73,41 @@ module Debugger
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
76
|
+
|
77
|
+
class ReloadCommand < Command # :nodoc
|
78
|
+
self.control = true
|
79
|
+
|
80
|
+
def regexp
|
81
|
+
/^\s*r(?:eload)?(?:\s*(on|off))?$/
|
82
|
+
end
|
83
|
+
|
84
|
+
def execute
|
85
|
+
if @match[1]
|
86
|
+
Debugger.reload_source_on_change = (@match[1] == 'on')
|
87
|
+
print "Automatic reloading is #{source_reloading}.\n"
|
88
|
+
else
|
89
|
+
Debugger.source_reload
|
90
|
+
print "Source code is reloaded. Automatic reloading is #{source_reloading}.\n"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
private
|
95
|
+
|
96
|
+
def source_reloading
|
97
|
+
Debugger.reload_source_on_change ? 'on' : 'off'
|
98
|
+
end
|
99
|
+
|
100
|
+
class << self
|
101
|
+
def help_command
|
102
|
+
'reload'
|
103
|
+
end
|
104
|
+
|
105
|
+
def help(cmd)
|
106
|
+
%{
|
107
|
+
r[eload]\tforces source code reloading
|
108
|
+
r[eload] on/off\tenales/disables automatic source code reloading
|
109
|
+
}
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
76
113
|
end
|
data/lib/ruby-debug/processor.rb
CHANGED
data/lib/ruby_debug.so
CHANGED
Binary file
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ruby-debug
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.4.
|
7
|
-
date: 2006-
|
6
|
+
version: 0.4.5
|
7
|
+
date: 2006-12-04 15:26:06 -05:00
|
8
8
|
summary: Fast Ruby debugger
|
9
9
|
require_paths:
|
10
10
|
- lib
|