ruby-debug 0.5.2-mswin32 → 0.6-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +12 -0
- data/bin/rdebug +13 -4
- data/ext/ruby_debug.c +360 -116
- data/ext/tags +90 -0
- data/lib/ruby-debug.rb +29 -5
- data/lib/ruby-debug/command.rb +8 -3
- data/lib/ruby-debug/commands/breakpoints.rb +6 -6
- data/lib/ruby-debug/commands/irb.rb +5 -1
- data/lib/ruby-debug/commands/variables.rb +12 -5
- data/lib/ruby-debug/interface.rb +1 -1
- data/lib/ruby-debug/processor.rb +19 -16
- data/lib/ruby_debug.so +0 -0
- metadata +4 -3
data/ext/tags
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
CTX_FL_SET ruby_debug.c /^#define CTX_FL_SET(c,f) do { (c)->flags |= (f); } /
|
2
|
+
CTX_FL_TEST ruby_debug.c /^#define CTX_FL_TEST(c,f) ((c)->flags & (f))$/
|
3
|
+
CTX_FL_UNSET ruby_debug.c /^#define CTX_FL_UNSET(c,f) do { (c)->flags &= ~(f);/
|
4
|
+
Init_breakpoint ruby_debug.c /^Init_breakpoint()$/
|
5
|
+
Init_context ruby_debug.c /^Init_context()$/
|
6
|
+
Init_frame ruby_debug.c /^Init_frame()$/
|
7
|
+
Init_ruby_debug ruby_debug.c /^Init_ruby_debug()$/
|
8
|
+
VALUE ruby_debug.c /^ typedef VALUE (*bind_func_t)(VALUE);$/
|
9
|
+
add_to_locked ruby_debug.c /^add_to_locked(VALUE thread)$/
|
10
|
+
basename ruby_debug.c /^basename(VALUE filename)$/
|
11
|
+
breakpoint_expr ruby_debug.c /^breakpoint_expr(VALUE self)$/
|
12
|
+
breakpoint_id ruby_debug.c /^breakpoint_id(VALUE self)$/
|
13
|
+
breakpoint_mark ruby_debug.c /^breakpoint_mark(void *data)$/
|
14
|
+
breakpoint_pos ruby_debug.c /^breakpoint_pos(VALUE self)$/
|
15
|
+
breakpoint_source ruby_debug.c /^breakpoint_source(VALUE self)$/
|
16
|
+
call_at_line ruby_debug.c /^call_at_line(VALUE context, int thnum, VALUE bindi/
|
17
|
+
call_at_line_unprotected ruby_debug.c /^call_at_line_unprotected(VALUE args)$/
|
18
|
+
check_breakpoint_expression ruby_debug.c /^check_breakpoint_expression(VALUE breakpoint, VALU/
|
19
|
+
check_breakpoints ruby_debug.c /^check_breakpoints(debug_context_t *debug_context, /
|
20
|
+
classname_cmp ruby_debug.c /^classname_cmp(debug_breakpoint_t *debug_breakpoint/
|
21
|
+
context_frames ruby_debug.c /^context_frames(VALUE self)$/
|
22
|
+
context_ignore ruby_debug.c /^context_ignore(VALUE self)$/
|
23
|
+
context_resume ruby_debug.c /^context_resume(VALUE self)$/
|
24
|
+
context_set_ignore ruby_debug.c /^context_set_ignore(VALUE self, VALUE value)$/
|
25
|
+
context_set_tracing ruby_debug.c /^context_set_tracing(VALUE self, VALUE value)$/
|
26
|
+
context_step_over ruby_debug.c /^context_step_over(int argc, VALUE *argv, VALUE sel/
|
27
|
+
context_stop_frame ruby_debug.c /^context_stop_frame(VALUE self, VALUE frame)$/
|
28
|
+
context_stop_next ruby_debug.c /^context_stop_next(VALUE self, VALUE steps)$/
|
29
|
+
context_suspend ruby_debug.c /^context_suspend(VALUE self)$/
|
30
|
+
context_thnum ruby_debug.c /^context_thnum(VALUE self)$/
|
31
|
+
context_thread ruby_debug.c /^context_thread(VALUE self)$/
|
32
|
+
context_tracing ruby_debug.c /^context_tracing(VALUE self)$/
|
33
|
+
create_binding ruby_debug.c /^create_binding(VALUE self)$/
|
34
|
+
debug_add_breakpoint ruby_debug.c /^debug_add_breakpoint(int argc, VALUE *argv, VALUE /
|
35
|
+
debug_at_exit ruby_debug.c /^debug_at_exit(VALUE self)$/
|
36
|
+
debug_at_exit_c ruby_debug.c /^debug_at_exit_c(VALUE proc)$/
|
37
|
+
debug_at_exit_i ruby_debug.c /^debug_at_exit_i(VALUE proc)$/
|
38
|
+
debug_breakpoint_t ruby_debug.c /^} debug_breakpoint_t;$/
|
39
|
+
debug_breakpoints ruby_debug.c /^debug_breakpoints(VALUE self)$/
|
40
|
+
debug_catchpoint ruby_debug.c /^debug_catchpoint(VALUE self)$/
|
41
|
+
debug_check_started ruby_debug.c /^debug_check_started()$/
|
42
|
+
debug_context_create ruby_debug.c /^debug_context_create(VALUE thread)$/
|
43
|
+
debug_context_mark ruby_debug.c /^debug_context_mark(void* data)$/
|
44
|
+
debug_context_t ruby_debug.c /^} debug_context_t;$/
|
45
|
+
debug_contexts ruby_debug.c /^debug_contexts(VALUE self)$/
|
46
|
+
debug_current_context ruby_debug.c /^debug_current_context(VALUE self)$/
|
47
|
+
debug_debug_load ruby_debug.c /^debug_debug_load(VALUE self, VALUE file)$/
|
48
|
+
debug_event_hook ruby_debug.c /^debug_event_hook(rb_event_t event, NODE *node, VAL/
|
49
|
+
debug_frame_create ruby_debug.c /^debug_frame_create(VALUE file, VALUE line, VALUE b/
|
50
|
+
debug_frame_mark ruby_debug.c /^debug_frame_mark(void *data)$/
|
51
|
+
debug_frame_t ruby_debug.c /^} debug_frame_t;$/
|
52
|
+
debug_is_started ruby_debug.c /^debug_is_started(VALUE self)$/
|
53
|
+
debug_last_interrupted ruby_debug.c /^debug_last_interrupted(VALUE self)$/
|
54
|
+
debug_post_mortem ruby_debug.c /^debug_post_mortem(VALUE self)$/
|
55
|
+
debug_remove_breakpoint ruby_debug.c /^debug_remove_breakpoint(VALUE self, VALUE id_value/
|
56
|
+
debug_resume ruby_debug.c /^debug_resume(VALUE self)$/
|
57
|
+
debug_set_catchpoint ruby_debug.c /^debug_set_catchpoint(VALUE self, VALUE value)$/
|
58
|
+
debug_set_post_mortem ruby_debug.c /^debug_set_post_mortem(VALUE self, VALUE value)$/
|
59
|
+
debug_set_tracing ruby_debug.c /^debug_set_tracing(VALUE self, VALUE value)$/
|
60
|
+
debug_skip ruby_debug.c /^debug_skip(VALUE self)$/
|
61
|
+
debug_start ruby_debug.c /^debug_start(VALUE self)$/
|
62
|
+
debug_stop ruby_debug.c /^debug_stop(VALUE self)$/
|
63
|
+
debug_stop_i ruby_debug.c /^debug_stop_i(VALUE self)$/
|
64
|
+
debug_suspend ruby_debug.c /^debug_suspend(VALUE self)$/
|
65
|
+
debug_tracing ruby_debug.c /^debug_tracing(VALUE self)$/
|
66
|
+
eval_expression ruby_debug.c /^eval_expression(VALUE args)$/
|
67
|
+
filename_cmp ruby_debug.c /^filename_cmp(debug_breakpoint_t *debug_breakpoint,/
|
68
|
+
find_last_context_func ruby_debug.c /^find_last_context_func(VALUE key, VALUE value, VAL/
|
69
|
+
frame_binding ruby_debug.c /^frame_binding(VALUE self)$/
|
70
|
+
frame_file ruby_debug.c /^frame_file(VALUE self)$/
|
71
|
+
frame_id ruby_debug.c /^frame_id(VALUE self)$/
|
72
|
+
frame_line ruby_debug.c /^frame_line(VALUE self)$/
|
73
|
+
get_breakpoint_at ruby_debug.c /^get_breakpoint_at(int index) $/
|
74
|
+
is_in_locked ruby_debug.c /^is_in_locked(VALUE thread)$/
|
75
|
+
locked_thread_t ruby_debug.c /^} locked_thread_t;$/
|
76
|
+
remove_from_locked ruby_debug.c /^remove_from_locked()$/
|
77
|
+
save_call_frame ruby_debug.c /^save_call_frame(VALUE self, VALUE file, VALUE line/
|
78
|
+
save_current_position ruby_debug.c /^save_current_position(VALUE context)$/
|
79
|
+
set_current_skipped_status ruby_debug.c /^set_current_skipped_status(VALUE status)$/
|
80
|
+
set_frame_source ruby_debug.c /^set_frame_source(debug_context_t *debug_context, V/
|
81
|
+
thread_cmp ruby_debug.c /^thread_cmp(VALUE a, VALUE b)$/
|
82
|
+
thread_context_lookup ruby_debug.c /^thread_context_lookup(VALUE thread)$/
|
83
|
+
thread_hash ruby_debug.c /^thread_hash(VALUE thread)$/
|
84
|
+
threads_table_clear ruby_debug.c /^threads_table_clear(VALUE table)$/
|
85
|
+
threads_table_clear_i ruby_debug.c /^threads_table_clear_i(VALUE key, VALUE value, VALU/
|
86
|
+
threads_table_create ruby_debug.c /^threads_table_create()$/
|
87
|
+
threads_table_free ruby_debug.c /^threads_table_free(void* data)$/
|
88
|
+
threads_table_mark ruby_debug.c /^threads_table_mark(void* data)$/
|
89
|
+
threads_table_mark_keyvalue ruby_debug.c /^threads_table_mark_keyvalue(VALUE key, VALUE value/
|
90
|
+
threads_table_t ruby_debug.c /^} threads_table_t;$/
|
data/lib/ruby-debug.rb
CHANGED
@@ -36,8 +36,8 @@ module Debugger
|
|
36
36
|
processor.at_tracing(self, file, line)
|
37
37
|
end
|
38
38
|
|
39
|
-
def at_line(file, line
|
40
|
-
processor.at_line(self, file, line
|
39
|
+
def at_line(file, line)
|
40
|
+
processor.at_line(self, file, line)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -77,7 +77,7 @@ module Debugger
|
|
77
77
|
def interface=(value) # :nodoc:
|
78
78
|
processor.interface = value
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
#
|
82
82
|
# Starts a remote debugger.
|
83
83
|
#
|
@@ -170,7 +170,7 @@ module Debugger
|
|
170
170
|
private :stop_main_thread
|
171
171
|
|
172
172
|
def source_for(file) # :nodoc:
|
173
|
-
|
173
|
+
finder = lambda do
|
174
174
|
unless File.exists?(file)
|
175
175
|
return (SCRIPT_LINES__[file] == true ? nil : SCRIPT_LINES__[file])
|
176
176
|
end
|
@@ -187,6 +187,7 @@ module Debugger
|
|
187
187
|
|
188
188
|
SCRIPT_LINES__[file]
|
189
189
|
end
|
190
|
+
Dir.chdir(File.dirname($0)){finder.call} || finder.call
|
190
191
|
end
|
191
192
|
|
192
193
|
def source_reload
|
@@ -256,7 +257,12 @@ module Debugger
|
|
256
257
|
end
|
257
258
|
|
258
259
|
def handle_post_mortem(exp)
|
259
|
-
|
260
|
+
return if exp.__debug_frames.empty?
|
261
|
+
orig_tracing = Debugger.tracing, Debugger.current_context.tracing
|
262
|
+
Debugger.tracing = Debugger.current_context.tracing = false
|
263
|
+
processor.at_line(nil, exp.__debug_file, exp.__debug_line, exp.__debug_frames)
|
264
|
+
ensure
|
265
|
+
Debugger.tracing, Debugger.current_context.tracing = orig_tracing
|
260
266
|
end
|
261
267
|
private :handle_post_mortem
|
262
268
|
end
|
@@ -301,4 +307,22 @@ class Module
|
|
301
307
|
end
|
302
308
|
EOD
|
303
309
|
end
|
310
|
+
|
311
|
+
#
|
312
|
+
# Wraps the +meth+ method with Debugger.post_mortem {...} block.
|
313
|
+
#
|
314
|
+
def post_mortem_method(meth)
|
315
|
+
old_meth = "__postmortem_#{meth}"
|
316
|
+
old_meth = "#{$1}_set" if old_meth =~ /^(.+)=$/
|
317
|
+
alias_method old_meth.to_sym, meth
|
318
|
+
class_eval <<-EOD
|
319
|
+
def #{meth}(*args, &block)
|
320
|
+
Debugger.start do |dbg|
|
321
|
+
dbg.post_mortem do
|
322
|
+
#{old_meth}(*args, &block)
|
323
|
+
end
|
324
|
+
end
|
325
|
+
end
|
326
|
+
EOD
|
327
|
+
end
|
304
328
|
end
|
data/lib/ruby-debug/command.rb
CHANGED
@@ -62,11 +62,15 @@ module Debugger
|
|
62
62
|
@state.confirm(msg) == 'y'
|
63
63
|
end
|
64
64
|
|
65
|
-
def debug_eval(str)
|
65
|
+
def debug_eval(str, b = @state.binding)
|
66
|
+
unless b
|
67
|
+
print "Can't evaluate in the current context.\n"
|
68
|
+
throw :debug_error
|
69
|
+
end
|
66
70
|
begin
|
67
|
-
val = eval(str,
|
71
|
+
val = eval(str, b)
|
68
72
|
rescue StandardError, ScriptError => e
|
69
|
-
at = eval("caller(1)",
|
73
|
+
at = eval("caller(1)", b)
|
70
74
|
print "%s:%s\n", at.shift, e.to_s.sub(/\(eval\):1:(in `.*?':)?/, '')
|
71
75
|
for i in at
|
72
76
|
print "\tfrom %s\n", i
|
@@ -76,6 +80,7 @@ module Debugger
|
|
76
80
|
end
|
77
81
|
|
78
82
|
def debug_silent_eval(str)
|
83
|
+
return nil unless @state.binding
|
79
84
|
begin
|
80
85
|
eval(str, @state.binding)
|
81
86
|
rescue StandardError, ScriptError
|
@@ -46,8 +46,8 @@ module Debugger
|
|
46
46
|
pos = pos.intern.id2name
|
47
47
|
end
|
48
48
|
|
49
|
-
Debugger.add_breakpoint file, pos, expr
|
50
|
-
print "Set breakpoint %d at %s:%s\n",
|
49
|
+
b = Debugger.add_breakpoint file, pos, expr
|
50
|
+
print "Set breakpoint %d at %s:%s\n", b.id, file, pos.to_s
|
51
51
|
end
|
52
52
|
|
53
53
|
class << self
|
@@ -74,11 +74,11 @@ module Debugger
|
|
74
74
|
def execute
|
75
75
|
unless Debugger.breakpoints.empty?
|
76
76
|
print "Breakpoints:\n"
|
77
|
-
Debugger.breakpoints.
|
77
|
+
Debugger.breakpoints.sort_by{|b| b.id }.each do |b|
|
78
78
|
if b.expr.nil?
|
79
|
-
print " %d %s:%s\n",
|
79
|
+
print " %d %s:%s\n", b.id, b.source, b.pos
|
80
80
|
else
|
81
|
-
print " %d %s:%s if %s\n",
|
81
|
+
print " %d %s:%s if %s\n", b.id, b.source, b.pos, b.expr
|
82
82
|
end
|
83
83
|
end
|
84
84
|
print "\n"
|
@@ -115,7 +115,7 @@ module Debugger
|
|
115
115
|
end
|
116
116
|
else
|
117
117
|
pos = pos.to_i
|
118
|
-
unless Debugger.
|
118
|
+
unless Debugger.remove_breakpoint(pos)
|
119
119
|
print "Breakpoint %d is not defined\n", pos
|
120
120
|
end
|
121
121
|
end
|
@@ -35,7 +35,11 @@ module Debugger
|
|
35
35
|
def execute
|
36
36
|
unless @state.interface.kind_of?(LocalInterface)
|
37
37
|
print "Command is available only in local mode.\n"
|
38
|
-
|
38
|
+
throw :debug_error
|
39
|
+
end
|
40
|
+
unless @state.binding
|
41
|
+
print "Can't evaluate in the current context.\n"
|
42
|
+
throw :debug_error
|
39
43
|
end
|
40
44
|
IRB.start_session(@state.binding)
|
41
45
|
end
|
@@ -1,10 +1,17 @@
|
|
1
1
|
module Debugger
|
2
2
|
module VarFunctions # :nodoc:
|
3
|
-
def var_list(ary, bind =
|
4
|
-
bind ||= @state.binding
|
3
|
+
def var_list(ary, bind = @state.binding)
|
5
4
|
ary.sort!
|
6
5
|
for v in ary
|
7
|
-
print " %s => %s\n", v,
|
6
|
+
print " %s => %s\n", v, debug_eval(v, bind).inspect
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def var_consts(mod)
|
11
|
+
constants = mod.constants
|
12
|
+
constants.sort!
|
13
|
+
for c in constants
|
14
|
+
print " %s => %s\n", c, mod.const_get(c)
|
8
15
|
end
|
9
16
|
end
|
10
17
|
end
|
@@ -21,7 +28,7 @@ module Debugger
|
|
21
28
|
unless obj.kind_of? Module
|
22
29
|
print "Should be Class/Module: %s\n", @match.post_match
|
23
30
|
else
|
24
|
-
|
31
|
+
var_consts(obj)
|
25
32
|
end
|
26
33
|
end
|
27
34
|
|
@@ -95,7 +102,7 @@ module Debugger
|
|
95
102
|
end
|
96
103
|
|
97
104
|
def execute
|
98
|
-
var_list(
|
105
|
+
var_list(debug_eval("local_variables"))
|
99
106
|
end
|
100
107
|
|
101
108
|
class << self
|
data/lib/ruby-debug/interface.rb
CHANGED
data/lib/ruby-debug/processor.rb
CHANGED
@@ -11,6 +11,7 @@ module Debugger
|
|
11
11
|
@display = []
|
12
12
|
@mutex = Mutex.new
|
13
13
|
@last_cmd = nil
|
14
|
+
@actions = []
|
14
15
|
end
|
15
16
|
|
16
17
|
def interface=(interface)
|
@@ -61,12 +62,12 @@ module Debugger
|
|
61
62
|
end
|
62
63
|
protect :at_tracing
|
63
64
|
|
64
|
-
def at_line(context, file, line,
|
65
|
+
def at_line(context, file, line, frames = context.frames)
|
65
66
|
print "%s:%d: %s", file, line, Debugger.line_at(file, line)
|
66
|
-
process_commands(context, file, line,
|
67
|
+
process_commands(context, file, line, frames)
|
67
68
|
end
|
68
69
|
protect :at_line
|
69
|
-
|
70
|
+
|
70
71
|
private
|
71
72
|
|
72
73
|
def print(*args)
|
@@ -81,13 +82,13 @@ module Debugger
|
|
81
82
|
end
|
82
83
|
end
|
83
84
|
|
84
|
-
def process_commands(context, file, line,
|
85
|
+
def process_commands(context, file, line, frames)
|
85
86
|
event_cmds = Command.commands.select{|cmd| cmd.event }
|
86
87
|
state = State.new do |s|
|
87
88
|
s.context = context
|
88
89
|
s.file = file
|
89
90
|
s.line = line
|
90
|
-
s.binding = binding
|
91
|
+
s.binding = frames.first.binding
|
91
92
|
s.display = display
|
92
93
|
s.interface = interface
|
93
94
|
s.commands = event_cmds
|
@@ -106,18 +107,20 @@ module Debugger
|
|
106
107
|
@last_cmd = input
|
107
108
|
end
|
108
109
|
|
109
|
-
|
110
|
-
if
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
unknown_cmd = commands.find{|cmd| cmd.class.unknown }
|
117
|
-
if unknown_cmd
|
118
|
-
unknown_cmd.execute
|
110
|
+
input.split(";").each do |input|
|
111
|
+
if cmd = commands.find{ |c| c.match(input) }
|
112
|
+
if context.nil? && cmd.class.need_context
|
113
|
+
print "Command is unavailable\n"
|
114
|
+
else
|
115
|
+
cmd.execute
|
116
|
+
end
|
119
117
|
else
|
120
|
-
|
118
|
+
unknown_cmd = commands.find{|cmd| cmd.class.unknown }
|
119
|
+
if unknown_cmd
|
120
|
+
unknown_cmd.execute
|
121
|
+
else
|
122
|
+
print "Unknown command\n"
|
123
|
+
end
|
121
124
|
end
|
122
125
|
end
|
123
126
|
end
|
data/lib/ruby_debug.so
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.1
|
3
3
|
specification_version: 1
|
4
4
|
name: ruby-debug
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date:
|
6
|
+
version: "0.6"
|
7
|
+
date: 2007-01-26 15:22:44 -05:00
|
8
8
|
summary: Fast Ruby debugger
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- lib/ruby-debug/commands/variables.rb
|
58
58
|
- ext/extconf.rb
|
59
59
|
- ext/ruby_debug.c
|
60
|
+
- ext/tags
|
60
61
|
- ext/win32
|
61
62
|
- bin/rdebug
|
62
63
|
- lib/ruby_debug.so
|