ruby-debug19 0.11.5
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +9 -0
- data/LICENSE +23 -0
- data/bin/rdebug +415 -0
- data/cli/ruby-debug.rb +176 -0
- data/cli/ruby-debug/command.rb +228 -0
- data/cli/ruby-debug/commands/breakpoints.rb +153 -0
- data/cli/ruby-debug/commands/catchpoint.rb +55 -0
- data/cli/ruby-debug/commands/condition.rb +49 -0
- data/cli/ruby-debug/commands/continue.rb +38 -0
- data/cli/ruby-debug/commands/control.rb +107 -0
- data/cli/ruby-debug/commands/display.rb +120 -0
- data/cli/ruby-debug/commands/edit.rb +48 -0
- data/cli/ruby-debug/commands/enable.rb +202 -0
- data/cli/ruby-debug/commands/eval.rb +176 -0
- data/cli/ruby-debug/commands/finish.rb +42 -0
- data/cli/ruby-debug/commands/frame.rb +301 -0
- data/cli/ruby-debug/commands/help.rb +56 -0
- data/cli/ruby-debug/commands/info.rb +469 -0
- data/cli/ruby-debug/commands/irb.rb +123 -0
- data/cli/ruby-debug/commands/kill.rb +51 -0
- data/cli/ruby-debug/commands/list.rb +94 -0
- data/cli/ruby-debug/commands/method.rb +84 -0
- data/cli/ruby-debug/commands/quit.rb +39 -0
- data/cli/ruby-debug/commands/reload.rb +40 -0
- data/cli/ruby-debug/commands/save.rb +90 -0
- data/cli/ruby-debug/commands/set.rb +237 -0
- data/cli/ruby-debug/commands/show.rb +253 -0
- data/cli/ruby-debug/commands/source.rb +36 -0
- data/cli/ruby-debug/commands/stepping.rb +81 -0
- data/cli/ruby-debug/commands/threads.rb +189 -0
- data/cli/ruby-debug/commands/tmate.rb +36 -0
- data/cli/ruby-debug/commands/trace.rb +57 -0
- data/cli/ruby-debug/commands/variables.rb +199 -0
- data/cli/ruby-debug/debugger.rb +5 -0
- data/cli/ruby-debug/helper.rb +69 -0
- data/cli/ruby-debug/interface.rb +232 -0
- data/cli/ruby-debug/processor.rb +474 -0
- data/rdbg.rb +33 -0
- metadata +122 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
module Debugger
|
2
|
+
# Implements debugger "source" command.
|
3
|
+
class SourceCommand < Command
|
4
|
+
self.allow_in_control = true
|
5
|
+
|
6
|
+
def regexp
|
7
|
+
/^\s* so(?:urce)? \s+ (.+) $/x
|
8
|
+
end
|
9
|
+
|
10
|
+
def execute
|
11
|
+
file = File.expand_path(@match[1]).strip
|
12
|
+
unless File.exist?(file)
|
13
|
+
errmsg "Command file '#{file}' is not found\n"
|
14
|
+
return
|
15
|
+
end
|
16
|
+
if @state and @state.interface
|
17
|
+
@state.interface.command_queue += File.open(file).readlines
|
18
|
+
else
|
19
|
+
Debugger.run_script(file, @state)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class << self
|
24
|
+
def help_command
|
25
|
+
'source'
|
26
|
+
end
|
27
|
+
|
28
|
+
def help(cmd)
|
29
|
+
%{
|
30
|
+
source FILE\texecutes a file containing debugger commands
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
module Debugger
|
2
|
+
# Mix-in module to assist in command parsing.
|
3
|
+
module SteppingFunctions # :nodoc:
|
4
|
+
def parse_stepping_args(command_name, match)
|
5
|
+
if match[1].nil?
|
6
|
+
force = Command.settings[:force_stepping]
|
7
|
+
elsif match[1] == '+'
|
8
|
+
force = true
|
9
|
+
elsif match[1] == '-'
|
10
|
+
force = false
|
11
|
+
end
|
12
|
+
steps = get_int(match[2], command_name, 1)
|
13
|
+
return [steps, force]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
# Implements debugger "next" command.
|
17
|
+
class NextCommand < Command
|
18
|
+
self.allow_in_post_mortem = false
|
19
|
+
self.need_context = true
|
20
|
+
|
21
|
+
def regexp
|
22
|
+
/^\s* n(?:ext)?
|
23
|
+
([+-])?(?:\s+(\S+))?
|
24
|
+
\s*$/x
|
25
|
+
end
|
26
|
+
|
27
|
+
def execute
|
28
|
+
steps, force = parse_stepping_args("Next", @match)
|
29
|
+
return unless steps
|
30
|
+
@state.context.step_over steps, @state.frame_pos, force
|
31
|
+
@state.proceed
|
32
|
+
end
|
33
|
+
|
34
|
+
class << self
|
35
|
+
def help_command
|
36
|
+
'next'
|
37
|
+
end
|
38
|
+
|
39
|
+
def help(cmd)
|
40
|
+
%{
|
41
|
+
n[ext][+-]?[ nnn]\tstep over once or nnn times,
|
42
|
+
\t\t'+' forces to move to another line.
|
43
|
+
\t\t'-' is the opposite of '+' and disables the force_stepping setting.
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Implements debugger "step" command.
|
50
|
+
class StepCommand < Command
|
51
|
+
self.allow_in_post_mortem = false
|
52
|
+
self.need_context = true
|
53
|
+
|
54
|
+
def regexp
|
55
|
+
/^\s* s(?:tep)?
|
56
|
+
([+-])?(?:\s+(\S+))?
|
57
|
+
\s*$/x
|
58
|
+
end
|
59
|
+
|
60
|
+
def execute
|
61
|
+
steps, force = parse_stepping_args("Step", @match)
|
62
|
+
return unless steps
|
63
|
+
@state.context.step(steps, force)
|
64
|
+
@state.proceed
|
65
|
+
end
|
66
|
+
|
67
|
+
class << self
|
68
|
+
def help_command
|
69
|
+
'step'
|
70
|
+
end
|
71
|
+
|
72
|
+
def help(cmd)
|
73
|
+
%{
|
74
|
+
s[tep][+-]?[ nnn]\tstep (into methods) once or nnn times
|
75
|
+
\t\t'+' forces to move to another line.
|
76
|
+
\t\t'-' is the opposite of '+' and disables the force_stepping setting.
|
77
|
+
}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,189 @@
|
|
1
|
+
module Debugger
|
2
|
+
module ThreadFunctions # :nodoc:
|
3
|
+
def display_context(c, show_top_frame=true)
|
4
|
+
c_flag = c.thread == Thread.current ? '+' : ' '
|
5
|
+
c_flag = '$' if c.suspended?
|
6
|
+
d_flag = c.ignored? ? '!' : ' '
|
7
|
+
print "%s%s", c_flag, d_flag
|
8
|
+
print "%d ", c.thnum
|
9
|
+
print "%s\t", c.thread.inspect
|
10
|
+
if c.stack_size > 0 and show_top_frame
|
11
|
+
print "%s:%d", c.frame_file(0), c.frame_line(0)
|
12
|
+
end
|
13
|
+
print "\n"
|
14
|
+
end
|
15
|
+
|
16
|
+
def parse_thread_num(subcmd, arg)
|
17
|
+
if '' == arg
|
18
|
+
errmsg "'%s' needs a thread number\n" % subcmd
|
19
|
+
nil
|
20
|
+
else
|
21
|
+
thread_num = get_int(arg, "thread #{subcmd}", 1)
|
22
|
+
return nil unless thread_num
|
23
|
+
get_context(thread_num)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def parse_thread_num_for_cmd(subcmd, arg)
|
28
|
+
c = parse_thread_num(subcmd, arg)
|
29
|
+
return nil unless c
|
30
|
+
case
|
31
|
+
when nil == c
|
32
|
+
errmsg "No such thread.\n"
|
33
|
+
when @state.context == c
|
34
|
+
errmsg "It's the current thread.\n"
|
35
|
+
when c.ignored?
|
36
|
+
errmsg "Can't #{subcmd} to the debugger thread #{arg}.\n"
|
37
|
+
else # Everything is okay
|
38
|
+
return c
|
39
|
+
end
|
40
|
+
return nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class ThreadListCommand < Command # :nodoc:
|
45
|
+
self.allow_in_control = true
|
46
|
+
|
47
|
+
def regexp
|
48
|
+
/^\s*th(?:read)?\s+l(?:ist)?\s*$/
|
49
|
+
end
|
50
|
+
|
51
|
+
def execute
|
52
|
+
threads = Debugger.contexts.sort_by{|c| c.thnum}.each do |c|
|
53
|
+
display_context(c)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class << self
|
58
|
+
def help_command
|
59
|
+
'thread'
|
60
|
+
end
|
61
|
+
|
62
|
+
def help(cmd)
|
63
|
+
%{
|
64
|
+
th[read] l[ist]\t\t\tlist all threads
|
65
|
+
}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class ThreadStopCommand < Command # :nodoc:
|
71
|
+
self.allow_in_control = true
|
72
|
+
self.allow_in_post_mortem = false
|
73
|
+
self.need_context = true
|
74
|
+
|
75
|
+
def regexp
|
76
|
+
/^\s*th(?:read)?\s+stop\s*(\S*)\s*$/
|
77
|
+
end
|
78
|
+
|
79
|
+
def execute
|
80
|
+
c = parse_thread_num_for_cmd("thread stop", @match[1])
|
81
|
+
return unless c
|
82
|
+
c.suspend
|
83
|
+
display_context(c)
|
84
|
+
end
|
85
|
+
|
86
|
+
class << self
|
87
|
+
def help_command
|
88
|
+
'thread'
|
89
|
+
end
|
90
|
+
|
91
|
+
def help(cmd)
|
92
|
+
%{
|
93
|
+
th[read] stop <nnn>\t\tstop thread nnn
|
94
|
+
}
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
class ThreadResumeCommand < Command # :nodoc:
|
100
|
+
self.allow_in_post_mortem = false
|
101
|
+
self.allow_in_control = true
|
102
|
+
self.need_context = true
|
103
|
+
|
104
|
+
def regexp
|
105
|
+
/^\s*th(?:read)?\s+resume\s*(\S*)\s*$/
|
106
|
+
end
|
107
|
+
|
108
|
+
def execute
|
109
|
+
c = parse_thread_num_for_cmd("thread resume", @match[1])
|
110
|
+
return unless c
|
111
|
+
if !c.thread.stop?
|
112
|
+
print "Already running."
|
113
|
+
return
|
114
|
+
end
|
115
|
+
c.resume
|
116
|
+
display_context(c)
|
117
|
+
end
|
118
|
+
|
119
|
+
class << self
|
120
|
+
def help_command
|
121
|
+
'thread'
|
122
|
+
end
|
123
|
+
|
124
|
+
def help(cmd)
|
125
|
+
%{
|
126
|
+
th[read] resume <nnn>\t\tresume thread nnn
|
127
|
+
}
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# Thread switch Must come after "Thread resume" because "switch" is
|
133
|
+
# optional
|
134
|
+
|
135
|
+
class ThreadSwitchCommand < Command # :nodoc:
|
136
|
+
self.allow_in_control = true
|
137
|
+
self.allow_in_post_mortem = false
|
138
|
+
self.need_context = true
|
139
|
+
|
140
|
+
def regexp
|
141
|
+
/^\s*th(?:read)?\s*(?:sw(?:itch)?)?\s+(\S+)\s*$/
|
142
|
+
end
|
143
|
+
|
144
|
+
def execute
|
145
|
+
c = parse_thread_num_for_cmd("thread switch", @match[1])
|
146
|
+
return unless c
|
147
|
+
display_context(c)
|
148
|
+
c.stop_next = 1
|
149
|
+
c.thread.run
|
150
|
+
@state.proceed
|
151
|
+
end
|
152
|
+
|
153
|
+
class << self
|
154
|
+
def help_command
|
155
|
+
'thread'
|
156
|
+
end
|
157
|
+
|
158
|
+
def help(cmd)
|
159
|
+
%{
|
160
|
+
th[read] [sw[itch]] <nnn>\tswitch thread context to nnn
|
161
|
+
}
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
class ThreadCurrentCommand < Command # :nodoc:
|
167
|
+
self.need_context = true
|
168
|
+
|
169
|
+
def regexp
|
170
|
+
/^\s*th(?:read)?\s*(?:cur(?:rent)?)?\s*$/
|
171
|
+
end
|
172
|
+
|
173
|
+
def execute
|
174
|
+
display_context(@state.context)
|
175
|
+
end
|
176
|
+
|
177
|
+
class << self
|
178
|
+
def help_command
|
179
|
+
'thread'
|
180
|
+
end
|
181
|
+
|
182
|
+
def help(cmd)
|
183
|
+
%{
|
184
|
+
th[read] [cur[rent]]\t\tshow current thread
|
185
|
+
}
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Debugger
|
2
|
+
if RUBY_PLATFORM =~ /darwin/
|
3
|
+
class TextMateCommand < Command # :nodoc:
|
4
|
+
def regexp
|
5
|
+
/^\s*tm(?:ate)?(?:\s*(\d+))?$/
|
6
|
+
end
|
7
|
+
|
8
|
+
def execute
|
9
|
+
if @match[1]
|
10
|
+
frm_n = @match[1].to_i
|
11
|
+
if frm_n > @state.context.stack_size || frm_n == 0
|
12
|
+
print "Wrong frame number\n"
|
13
|
+
return
|
14
|
+
end
|
15
|
+
file, line = @state.context.frame_file(frm_n-1), @state.context.frame_line(frm_n-1)
|
16
|
+
else
|
17
|
+
file, line = @state.file, @state.line
|
18
|
+
end
|
19
|
+
%x|open 'txmt://open?url=file://#{File.expand_path(file)}&line=#{line}'|
|
20
|
+
end
|
21
|
+
|
22
|
+
class << self
|
23
|
+
def help_command
|
24
|
+
'tmate'
|
25
|
+
end
|
26
|
+
|
27
|
+
def help(cmd)
|
28
|
+
%{
|
29
|
+
tm[ate] n\topens a current file in TextMate.
|
30
|
+
\t\tIt uses n-th frame if arg (n) is specifed.
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Debugger
|
2
|
+
class TraceCommand < Command # :nodoc:
|
3
|
+
def regexp
|
4
|
+
/^\s* tr(?:ace)? (?: \s+ (\S+)) # on |off | var(iable)
|
5
|
+
(?: \s+ (\S+))? # (all | variable-name)?
|
6
|
+
(?: \s+ (\S+))? \s* # (stop | nostop)?
|
7
|
+
$/ix
|
8
|
+
end
|
9
|
+
|
10
|
+
def execute
|
11
|
+
if @match[1] =~ /on|off/
|
12
|
+
onoff = 'on' == @match[1]
|
13
|
+
if @match[2]
|
14
|
+
Debugger.current_context.tracing = onoff
|
15
|
+
print "Tracing %s all threads.\n" % (onoff ? 'on' : 'off')
|
16
|
+
else
|
17
|
+
Debugger.tracing = onoff
|
18
|
+
print "Tracing %s on current thread.\n" % (onoff ? 'on' : 'off')
|
19
|
+
end
|
20
|
+
elsif @match[1] =~ /var(?:iable)?/
|
21
|
+
varname=@match[2]
|
22
|
+
if debug_eval("defined?(#{varname})")
|
23
|
+
if @match[3] && @match[3] !~ /(:?no)?stop/
|
24
|
+
errmsg("expecting 'stop' or 'nostop'; got %s\n" % @match[3])
|
25
|
+
else
|
26
|
+
dbg_cmd = if @match[3] && (@match[3] !~ /nostop/)
|
27
|
+
'debugger' else '' end
|
28
|
+
end
|
29
|
+
eval("
|
30
|
+
trace_var(:#{varname}) do |val|
|
31
|
+
print \"traced variable #{varname} has value \#{val}\n\"
|
32
|
+
#{dbg_cmd}
|
33
|
+
end")
|
34
|
+
else
|
35
|
+
errmsg "#{varname} is not a global variable.\n"
|
36
|
+
end
|
37
|
+
else
|
38
|
+
errmsg("expecting 'on', 'off', 'var' or 'variable'; got: %s\n" %
|
39
|
+
@match[1])
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class << self
|
44
|
+
def help_command
|
45
|
+
'trace'
|
46
|
+
end
|
47
|
+
|
48
|
+
def help(cmd)
|
49
|
+
%{
|
50
|
+
tr[ace] (on|off)\tset trace mode of current thread
|
51
|
+
tr[ace] (on|off) all\tset trace mode of all threads
|
52
|
+
tr[ace] var(iable) VARNAME [stop|nostop]\tset trace variable on VARNAME
|
53
|
+
}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,199 @@
|
|
1
|
+
module Debugger
|
2
|
+
module VarFunctions # :nodoc:
|
3
|
+
def var_list(ary, b = get_binding)
|
4
|
+
ary.sort!
|
5
|
+
for v in ary
|
6
|
+
begin
|
7
|
+
s = debug_eval(v, b).inspect
|
8
|
+
rescue
|
9
|
+
begin
|
10
|
+
s = debug_eval(v, b).to_s
|
11
|
+
rescue
|
12
|
+
s = "*Error in evaluation*"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
if s.size > self.class.settings[:width]
|
16
|
+
s[self.class.settings[:width]-3 .. -1] = "..."
|
17
|
+
end
|
18
|
+
print "%s = %s\n", v, s
|
19
|
+
end
|
20
|
+
end
|
21
|
+
def var_class_self
|
22
|
+
obj = debug_eval('self')
|
23
|
+
var_list(obj.class.class_variables, get_binding)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Implements the debugger 'var class' command.
|
28
|
+
class VarClassVarCommand < Command
|
29
|
+
def regexp
|
30
|
+
/^\s*v(?:ar)?\s+cl(?:ass)?/
|
31
|
+
end
|
32
|
+
|
33
|
+
def execute
|
34
|
+
unless @state.context
|
35
|
+
errmsg "can't get class variables here.\n"
|
36
|
+
return
|
37
|
+
end
|
38
|
+
var_class_self
|
39
|
+
end
|
40
|
+
|
41
|
+
class << self
|
42
|
+
def help_command
|
43
|
+
'var'
|
44
|
+
end
|
45
|
+
|
46
|
+
def help(cmd)
|
47
|
+
%{
|
48
|
+
v[ar] cl[ass] \t\t\tshow class variables of self
|
49
|
+
}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class VarConstantCommand < Command # :nodoc:
|
55
|
+
def regexp
|
56
|
+
/^\s*v(?:ar)?\s+co(?:nst(?:ant)?)?\s+/
|
57
|
+
end
|
58
|
+
|
59
|
+
def execute
|
60
|
+
obj = debug_eval(@match.post_match)
|
61
|
+
if obj.kind_of? Module
|
62
|
+
constants = debug_eval("#{@match.post_match}.constants")
|
63
|
+
constants.sort!
|
64
|
+
for c in constants
|
65
|
+
next if c =~ /SCRIPT/
|
66
|
+
value = obj.const_get(c) rescue "ERROR: #{$!}"
|
67
|
+
print " %s => %p\n", c, value
|
68
|
+
end
|
69
|
+
else
|
70
|
+
print "Should be Class/Module: %s\n", @match.post_match
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
class << self
|
75
|
+
def help_command
|
76
|
+
'var'
|
77
|
+
end
|
78
|
+
|
79
|
+
def help(cmd)
|
80
|
+
%{
|
81
|
+
v[ar] c[onst] <object>\t\tshow constants of object
|
82
|
+
}
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
class VarGlobalCommand < Command # :nodoc:
|
88
|
+
def regexp
|
89
|
+
/^\s*v(?:ar)?\s+g(?:lobal)?\s*$/
|
90
|
+
end
|
91
|
+
|
92
|
+
def execute
|
93
|
+
var_list(global_variables)
|
94
|
+
end
|
95
|
+
|
96
|
+
class << self
|
97
|
+
def help_command
|
98
|
+
'var'
|
99
|
+
end
|
100
|
+
|
101
|
+
def help(cmd)
|
102
|
+
%{
|
103
|
+
v[ar] g[lobal]\t\t\tshow global variables
|
104
|
+
}
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
class VarInstanceCommand < Command # :nodoc:
|
110
|
+
def regexp
|
111
|
+
/^\s*v(?:ar)?\s+ins(?:tance)?\s*/
|
112
|
+
end
|
113
|
+
|
114
|
+
def execute
|
115
|
+
obj = debug_eval(@match.post_match.empty? ? 'self' : @match.post_match)
|
116
|
+
var_list(obj.instance_variables, obj.instance_eval{binding()})
|
117
|
+
end
|
118
|
+
|
119
|
+
class << self
|
120
|
+
def help_command
|
121
|
+
'var'
|
122
|
+
end
|
123
|
+
|
124
|
+
def help(cmd)
|
125
|
+
%{
|
126
|
+
v[ar] i[nstance] <object>\tshow instance variables of object
|
127
|
+
}
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# Implements the debugger 'var local' command.
|
133
|
+
class VarLocalCommand < Command
|
134
|
+
def regexp
|
135
|
+
/^\s*v(?:ar)?\s+l(?:ocal)?\s*$/
|
136
|
+
end
|
137
|
+
|
138
|
+
def execute
|
139
|
+
locals = @state.context.frame_locals(@state.frame_pos)
|
140
|
+
_self = @state.context.frame_self(@state.frame_pos)
|
141
|
+
locals.keys.sort.each do |name|
|
142
|
+
print " %s => %p\n", name, locals[name]
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
class << self
|
147
|
+
def help_command
|
148
|
+
'var'
|
149
|
+
end
|
150
|
+
|
151
|
+
def help(cmd)
|
152
|
+
%{
|
153
|
+
v[ar] l[ocal]\t\t\tshow local variables
|
154
|
+
}
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
# Implements the debugger 'var inherit' command.
|
160
|
+
begin
|
161
|
+
require 'classtree'
|
162
|
+
have_classtree = true
|
163
|
+
rescue LoadError
|
164
|
+
have_classtree = false
|
165
|
+
end
|
166
|
+
|
167
|
+
class VarInheritCommand < Command
|
168
|
+
def regexp
|
169
|
+
/^\s*v(?:ar)?\s+ct\s*/
|
170
|
+
end
|
171
|
+
|
172
|
+
def execute
|
173
|
+
unless @state.context
|
174
|
+
errmsg "can't get object inheritance.\n"
|
175
|
+
return
|
176
|
+
end
|
177
|
+
puts @match.post_match
|
178
|
+
obj = debug_eval("#{@match.post_match}.classtree")
|
179
|
+
if obj
|
180
|
+
print obj
|
181
|
+
else
|
182
|
+
errmsg "Trouble getting object #{@match.post_match}\n"
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
class << self
|
187
|
+
def help_command
|
188
|
+
'var'
|
189
|
+
end
|
190
|
+
|
191
|
+
def help(cmd)
|
192
|
+
%{
|
193
|
+
v[ar] ct\t\t\tshow class heirarchy of object
|
194
|
+
}
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end if have_classtree
|
198
|
+
|
199
|
+
end
|