trepanning 0.1.6 → 1.93.32
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +57 -0
- data/ChangeLog +585 -736
- data/NEWS +26 -12
- data/README.md +62 -0
- data/Rakefile +15 -9
- data/app/breakpoint.rb +11 -12
- data/app/complete.rb +14 -14
- data/app/core.rb +34 -30
- data/app/default.rb +8 -7
- data/app/markdown.rb +191 -0
- data/app/options.rb +104 -99
- data/app/run.rb +9 -1
- data/app/util.rb +7 -7
- data/bin/trepan +7 -7
- data/interface.rb +0 -4
- data/interface/user.rb +11 -11
- data/io/input.rb +13 -13
- data/lib/trepanning.rb +30 -29
- data/processor.rb +40 -40
- data/processor/command.rb +13 -9
- data/processor/command/alias.rb +21 -15
- data/processor/command/backtrace.rb +27 -19
- data/processor/command/break.rb +24 -21
- data/processor/command/complete.rb +5 -2
- data/processor/command/condition.rb +14 -9
- data/processor/command/debug.rb +8 -8
- data/processor/command/down.rb +6 -6
- data/processor/command/edit.rb +4 -0
- data/processor/command/eval.rb +2 -2
- data/processor/command/exit.rb +12 -9
- data/processor/command/finish.rb +25 -23
- data/processor/command/frame.rb +30 -26
- data/processor/command/help.rb +203 -185
- data/processor/command/help/{command.txt → command.md} +21 -18
- data/processor/command/help/examples.md +20 -0
- data/processor/command/help/filename.md +46 -0
- data/processor/command/help/location.md +34 -0
- data/processor/command/help/suffixes.md +19 -0
- data/processor/command/info.rb +6 -4
- data/processor/command/info_subcmd/breakpoints.rb +13 -13
- data/processor/command/info_subcmd/files.rb +35 -31
- data/processor/command/info_subcmd/frame.rb +82 -33
- data/processor/command/info_subcmd/macro.rb +1 -1
- data/processor/command/info_subcmd/program.rb +8 -5
- data/processor/command/info_subcmd/registers.rb +15 -13
- data/processor/command/kill.rb +23 -17
- data/processor/command/list.rb +63 -56
- data/processor/command/macro.rb +45 -28
- data/processor/command/next.rb +29 -23
- data/processor/command/pp.rb +11 -9
- data/processor/command/pr.rb +10 -8
- data/processor/command/ps.rb +5 -5
- data/processor/command/quit.rb +24 -17
- data/processor/command/raise.rb +6 -6
- data/processor/command/reload.rb +9 -2
- data/processor/command/reload_subcmd/command.rb +4 -4
- data/processor/command/restart.rb +9 -4
- data/processor/command/save.rb +9 -9
- data/processor/command/server.rb +18 -17
- data/processor/command/set.rb +8 -6
- data/processor/command/set_subcmd/confirm.rb +15 -2
- data/processor/command/set_subcmd/different.rb +7 -5
- data/processor/command/set_subcmd/highlight.rb +14 -3
- data/processor/command/set_subcmd/pc.rb +62 -0
- data/processor/command/set_subcmd/sp.rb +8 -2
- data/processor/command/shell.rb +25 -23
- data/processor/command/show.rb +9 -7
- data/processor/command/show_subcmd/confirm.rb +12 -1
- data/processor/command/show_subcmd/highlight.rb +13 -3
- data/processor/command/source.rb +27 -26
- data/processor/command/step.rb +52 -43
- data/processor/command/tbreak.rb +9 -4
- data/processor/command/unalias.rb +9 -7
- data/processor/command/undisplay.rb +11 -7
- data/processor/command/up.rb +18 -13
- data/processor/command/watchg.rb +20 -17
- data/processor/complete.rb +120 -0
- data/processor/default.rb +47 -43
- data/processor/list.rb +23 -6
- data/processor/load_cmds.rb +25 -105
- data/processor/location.rb +104 -96
- data/processor/mock.rb +12 -12
- data/processor/msg.rb +61 -52
- data/processor/validate.rb +36 -27
- data/test/data/fname-with-blank.right +0 -1
- data/test/data/trace-mingw.right +28 -0
- data/test/data/trace.right +0 -2
- data/test/functional/test-raise.rb +3 -0
- data/test/integration/helper.rb +16 -16
- data/test/integration/test-debugger-stop.rb +8 -2
- data/test/integration/test-quit.rb +16 -15
- data/test/integration/test-trace.rb +19 -10
- data/test/unit/cmd-helper.rb +4 -1
- data/test/unit/test-app-complete.rb +3 -1
- data/test/unit/test-app-options.rb +7 -1
- data/test/unit/test-app-run.rb +9 -1
- data/test/unit/test-cmd-alias.rb +1 -1
- data/test/unit/test-cmd-edit.rb +2 -0
- data/test/unit/test-cmd-help.rb +10 -5
- data/test/unit/test-cmd-parse_list_cmd.rb +3 -3
- data/test/unit/test-completion.rb +2 -2
- data/test/unit/test-proc-default.rb +34 -0
- data/trepanning.gemspec +15 -14
- metadata +70 -44
- data/README.textile +0 -50
- data/processor/command/help/examples.txt +0 -16
- data/processor/command/help/filename.txt +0 -40
- data/processor/command/help/location.txt +0 -37
- data/processor/command/help/suffixes.txt +0 -17
- data/processor/command/info_subcmd/registers_subcmd/dfp.rb +0 -28
- data/processor/command/info_subcmd/registers_subcmd/lfp.rb +0 -47
- data/processor/command/nocache.rb +0 -32
- data/processor/command/parsetree.rb +0 -56
data/processor/mock.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2010,
|
1
|
+
# Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
# Mock setup for commands.
|
3
3
|
require_relative '../processor'
|
4
4
|
|
@@ -7,9 +7,9 @@ require_relative '../app/default'
|
|
7
7
|
require_relative '../app/frame'
|
8
8
|
require_relative '../interface/user' # user interface (includes I/O)
|
9
9
|
|
10
|
-
SCRIPT_ISEQS__ = {} unless
|
10
|
+
SCRIPT_ISEQS__ = {} unless
|
11
11
|
defined?(SCRIPT_ISEQS__) && SCRIPT_ISEQS__.is_a?(Hash)
|
12
|
-
ISEQS__ = {} unless
|
12
|
+
ISEQS__ = {} unless
|
13
13
|
defined?(ISEQS__) && ISEQS__.is_a?(Hash)
|
14
14
|
|
15
15
|
module MockDebugger
|
@@ -21,14 +21,14 @@ module MockDebugger
|
|
21
21
|
attr_accessor :intf # The way the outside world interfaces with us.
|
22
22
|
attr_reader :initial_dir # String. Current directory when program
|
23
23
|
# started. Used in restart program.
|
24
|
-
attr_accessor :restart_argv # How to restart us, empty or nil.
|
24
|
+
attr_accessor :restart_argv # How to restart us, empty or nil.
|
25
25
|
# Note restart[0] is typically $0.
|
26
26
|
attr_reader :settings # Hash[:symbol] of things you can configure
|
27
27
|
attr_accessor :processor
|
28
28
|
|
29
29
|
# FIXME: move more stuff of here and into Trepan::CmdProcessor
|
30
30
|
# These below should go into Trepan::CmdProcessor.
|
31
|
-
attr_reader :cmd_argstr, :cmd_name, :vm_locations, :current_frame,
|
31
|
+
attr_reader :cmd_argstr, :cmd_name, :vm_locations, :current_frame,
|
32
32
|
:debugee_thread
|
33
33
|
|
34
34
|
def initialize(settings={})
|
@@ -39,7 +39,7 @@ module MockDebugger
|
|
39
39
|
@trace_filter = []
|
40
40
|
|
41
41
|
# Don't allow user commands in mocks.
|
42
|
-
@core.processor.settings[:user_cmd_dir] = nil
|
42
|
+
@core.processor.settings[:user_cmd_dir] = nil
|
43
43
|
|
44
44
|
end
|
45
45
|
|
@@ -48,7 +48,7 @@ module MockDebugger
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
# Common Mock debugger setup
|
51
|
+
# Common Mock debugger setup
|
52
52
|
def setup(name=nil, show_constants=true)
|
53
53
|
unless name
|
54
54
|
tf = RubyVM::Frame.current.prev
|
@@ -114,7 +114,7 @@ module MockDebugger
|
|
114
114
|
def show_special_class_constants(cmd)
|
115
115
|
puts 'ALIASES: %s' % [cmd.class.const_get('ALIASES').inspect] if
|
116
116
|
cmd.class.constants.member?(:ALIASES)
|
117
|
-
%w(CATEGORY MIN_ARGS MAX_ARGS
|
117
|
+
%w(CATEGORY MIN_ARGS MAX_ARGS
|
118
118
|
NAME NEED_STACK SHORT_HELP).each do |name|
|
119
119
|
puts '%s: %s' % [name, cmd.class.const_get(name).inspect]
|
120
120
|
end
|
@@ -127,8 +127,8 @@ module MockDebugger
|
|
127
127
|
end
|
128
128
|
|
129
129
|
if __FILE__ == $0
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
130
|
+
dbgr = MockDebugger::MockDebugger.new
|
131
|
+
p dbgr.settings
|
132
|
+
puts '=' * 10
|
133
|
+
p dbgr.core.processor.settings
|
134
134
|
end
|
data/processor/msg.rb
CHANGED
@@ -1,73 +1,82 @@
|
|
1
|
-
# Copyright (C) 2010,
|
1
|
+
# Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
# I/O related command processor methods
|
3
3
|
require_relative '../app/util'
|
4
|
+
require_relative '../app/markdown'
|
4
5
|
require_relative 'virtual'
|
5
6
|
|
6
7
|
begin require 'term/ansicolor'; rescue LoadError; end
|
7
8
|
|
8
9
|
class Trepan::CmdProcessor < Trepan::VirtualCmdProcessor
|
9
|
-
|
10
|
+
include Trepan::Markdown
|
10
11
|
|
11
|
-
|
12
|
-
@settings[:confirm] ? @dbgr.intf[-1].confirm(msg, default) : true
|
13
|
-
end
|
12
|
+
attr_accessor :ruby_highlighter
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
message.each do |mess|
|
18
|
-
errmsg(mess, opts)
|
19
|
-
end
|
20
|
-
return
|
21
|
-
else
|
22
|
-
message = safe_rep(message) unless opts[:unlimited]
|
14
|
+
def confirm(msg, default)
|
15
|
+
@settings[:confirm] ? @dbgr.intf[-1].confirm(msg, default) : true
|
23
16
|
end
|
24
|
-
|
25
|
-
|
26
|
-
|
17
|
+
|
18
|
+
def errmsg(message, opts={})
|
19
|
+
if message.kind_of?(Array)
|
20
|
+
message.each do |mess|
|
21
|
+
errmsg(mess, opts)
|
22
|
+
end
|
23
|
+
return
|
24
|
+
else
|
25
|
+
message = safe_rep(message) unless opts[:unlimited]
|
26
|
+
end
|
27
|
+
if @settings[:highlight] && defined?(Term::ANSIColor)
|
28
|
+
message =
|
29
|
+
Term::ANSIColor.italic + message + Term::ANSIColor.reset
|
30
|
+
end
|
31
|
+
@dbgr.intf[-1].errmsg(message)
|
27
32
|
end
|
28
|
-
@dbgr.intf[-1].errmsg(message)
|
29
|
-
end
|
30
33
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
34
|
+
def markdown(message, opts={})
|
35
|
+
message = render(message, @settings[:maxwidth], @settings[:highlight])
|
36
|
+
@dbgr.intf[-1].msg(message)
|
37
|
+
end
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
def msg(message, opts={})
|
40
|
+
message = safe_rep(message) unless opts[:unlimited]
|
41
|
+
message = ruby_format(message) if opts[:code]
|
42
|
+
@dbgr.intf[-1].msg(message)
|
43
|
+
end
|
41
44
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
+
def msg_nocr(message, opts={})
|
46
|
+
message = safe_rep(message) unless opts[:unlimited]
|
47
|
+
@dbgr.intf[-1].msg_nocr(message)
|
48
|
+
end
|
45
49
|
|
46
|
-
|
47
|
-
|
48
|
-
unless @ruby_highlighter
|
49
|
-
begin
|
50
|
-
require 'coderay'
|
51
|
-
require 'term/ansicolor'
|
52
|
-
@ruby_highlighter = CodeRay::Duo[:ruby, :term]
|
53
|
-
rescue LoadError
|
54
|
-
return text
|
55
|
-
end
|
50
|
+
def read_command()
|
51
|
+
@dbgr.intf[-1].read_command(@prompt)
|
56
52
|
end
|
57
|
-
return @ruby_highlighter.encode(text)
|
58
|
-
end
|
59
53
|
|
60
|
-
|
61
|
-
|
62
|
-
|
54
|
+
def ruby_format(text)
|
55
|
+
return text unless settings[:highlight]
|
56
|
+
unless @ruby_highlighter
|
57
|
+
begin
|
58
|
+
require 'coderay'
|
59
|
+
require 'term/ansicolor'
|
60
|
+
@ruby_highlighter = CodeRay::Duo[:ruby, :term]
|
61
|
+
rescue LoadError
|
62
|
+
return text
|
63
|
+
end
|
64
|
+
end
|
65
|
+
return @ruby_highlighter.encode(text)
|
66
|
+
end
|
63
67
|
|
64
|
-
|
65
|
-
|
66
|
-
if @settings[:highlight] && defined?(Term::ANSIColor)
|
67
|
-
message =
|
68
|
-
Term::ANSIColor.bold + message + Term::ANSIColor.reset
|
68
|
+
def safe_rep(str)
|
69
|
+
Trepan::Util::safe_repr(str, @settings[:maxstring])
|
69
70
|
end
|
70
|
-
@dbgr.intf[-1].msg(message)
|
71
|
-
end
|
72
71
|
|
72
|
+
def section(message, opts={})
|
73
|
+
message = safe_rep(message) unless opts[:unlimited]
|
74
|
+
message =
|
75
|
+
if @settings[:highlight] && defined?(Term::ANSIColor)
|
76
|
+
Term::ANSIColor.bold + message + Term::ANSIColor.reset
|
77
|
+
else
|
78
|
+
message += "\n" + ('-' * message.size)
|
79
|
+
end
|
80
|
+
@dbgr.intf[-1].msg(message)
|
81
|
+
end
|
73
82
|
end
|
data/processor/validate.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
# Copyright (C) 2010,
|
1
|
+
# Copyright (C) 2010-2011, 2013 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
|
3
3
|
# Trepan command input validation routines. A String type is
|
4
4
|
# usually passed in as the argument to validation routines.
|
5
5
|
|
6
|
+
require 'rbconfig'
|
6
7
|
require 'rubygems'
|
7
8
|
require 'linecache'
|
8
9
|
|
@@ -62,7 +63,7 @@ class Trepan
|
|
62
63
|
# error. If there's a stack frame use that for bindings in
|
63
64
|
# evaluation.
|
64
65
|
def get_int(arg, opts={})
|
65
|
-
|
66
|
+
|
66
67
|
return default unless arg
|
67
68
|
opts = DEFAULT_GET_INT_OPTS.merge(opts)
|
68
69
|
val = arg ? get_int_noerr(arg) : opts[:default]
|
@@ -75,7 +76,7 @@ class Trepan
|
|
75
76
|
end
|
76
77
|
return nil
|
77
78
|
end
|
78
|
-
|
79
|
+
|
79
80
|
if val < opts[:min_value]
|
80
81
|
if opts[:cmdname]
|
81
82
|
errmsg(("Command '%s' expects an integer at least" +
|
@@ -104,7 +105,7 @@ class Trepan
|
|
104
105
|
def get_int_list(args, opts={})
|
105
106
|
args.map{|arg| get_an_int(arg, opts)}.compact
|
106
107
|
end
|
107
|
-
|
108
|
+
|
108
109
|
# Eval arg and it is an integer return the value. Otherwise
|
109
110
|
# return nil
|
110
111
|
def get_int_noerr(arg)
|
@@ -112,7 +113,7 @@ class Trepan
|
|
112
113
|
val = Integer(eval(arg, b))
|
113
114
|
rescue SyntaxError
|
114
115
|
nil
|
115
|
-
rescue
|
116
|
+
rescue
|
116
117
|
nil
|
117
118
|
end
|
118
119
|
|
@@ -157,13 +158,13 @@ class Trepan
|
|
157
158
|
vm_offset = ary.size > 1 ? ary[1] : ary[0]
|
158
159
|
line_no = position
|
159
160
|
elsif found_iseq = find_iseqs_with_lineno(filename, position)
|
160
|
-
return position_to_line_and_offset(found_iseq, filename, position,
|
161
|
+
return position_to_line_and_offset(found_iseq, filename, position,
|
161
162
|
offset_type)
|
162
163
|
elsif found_iseq = find_iseq_with_line_from_iseq(iseq, position)
|
163
|
-
return position_to_line_and_offset(found_iseq, filename, position,
|
164
|
+
return position_to_line_and_offset(found_iseq, filename, position,
|
164
165
|
offset_type)
|
165
166
|
else
|
166
|
-
errmsg("Unable to find offset for line #{position}\n\t" +
|
167
|
+
errmsg("Unable to find offset for line #{position}\n\t" +
|
167
168
|
"in #{iseq.name} of file #{filename}")
|
168
169
|
return [nil, nil]
|
169
170
|
end
|
@@ -200,11 +201,11 @@ class Trepan
|
|
200
201
|
end
|
201
202
|
return [nil] * 5 unless break_cmd_parse
|
202
203
|
tail = [break_cmd_parse.condition, break_cmd_parse.negate]
|
203
|
-
meth_or_frame, file, position, offset_type =
|
204
|
+
meth_or_frame, file, position, offset_type =
|
204
205
|
parse_position(break_cmd_parse.position)
|
205
206
|
if meth_or_frame
|
206
207
|
if iseq = meth_or_frame.iseq
|
207
|
-
iseq, line_no, vm_offset =
|
208
|
+
iseq, line_no, vm_offset =
|
208
209
|
position_to_line_and_offset(iseq, file, position, offset_type)
|
209
210
|
if vm_offset && line_no
|
210
211
|
return [iseq, line_no, vm_offset] + tail
|
@@ -216,18 +217,18 @@ class Trepan
|
|
216
217
|
if :line == offset_type
|
217
218
|
iseq = find_iseqs_with_lineno(file, position)
|
218
219
|
if iseq
|
219
|
-
junk, line_no, vm_offset =
|
220
|
+
junk, line_no, vm_offset =
|
220
221
|
position_to_line_and_offset(iseq, file, position, offset_type)
|
221
222
|
return [@frame.iseq, line_no, vm_offset] + tail
|
222
223
|
else
|
223
|
-
errmsg("Unable to find instruction sequence for" +
|
224
|
+
errmsg("Unable to find instruction sequence for" +
|
224
225
|
" position #{position} in #{file}")
|
225
226
|
end
|
226
227
|
else
|
227
228
|
errmsg "Come back later..."
|
228
229
|
end
|
229
|
-
elsif @frame.file == file
|
230
|
-
line_no, vm_offset = position_to_line_and_offset(@frame.iseq, position,
|
230
|
+
elsif @frame.respond_to?(:file) and @frame.file == file
|
231
|
+
line_no, vm_offset = position_to_line_and_offset(@frame.iseq, position,
|
231
232
|
offset_type)
|
232
233
|
return [@frame.iseq, line_no, vm_offset] + tail
|
233
234
|
else
|
@@ -260,7 +261,7 @@ class Trepan
|
|
260
261
|
include CmdParser
|
261
262
|
|
262
263
|
def get_method(meth)
|
263
|
-
start_binding =
|
264
|
+
start_binding =
|
264
265
|
begin
|
265
266
|
@frame.binding
|
266
267
|
rescue
|
@@ -278,8 +279,8 @@ class Trepan
|
|
278
279
|
end
|
279
280
|
end
|
280
281
|
|
281
|
-
# FIXME: this is a ? method but we return
|
282
|
-
# the method value.
|
282
|
+
# FIXME: this is a ? method but we return
|
283
|
+
# the method value.
|
283
284
|
def method?(meth)
|
284
285
|
get_method(meth)
|
285
286
|
end
|
@@ -290,22 +291,30 @@ class Trepan
|
|
290
291
|
# Parse arg as [filename:]lineno | function | module
|
291
292
|
# Make sure it works for C:\foo\bar.py:12
|
292
293
|
def parse_position(info)
|
294
|
+
## FIXME: push into parse
|
295
|
+
if RbConfig::CONFIG['target_os'].start_with?('mingw') and
|
296
|
+
info =~ /^[A-Za-z]:/
|
297
|
+
drive_letter = info[0..1]
|
298
|
+
info = info[2..-1]
|
299
|
+
else
|
300
|
+
drive_leter = nil
|
301
|
+
end
|
293
302
|
info = parse_location(info) if info.kind_of?(String)
|
294
303
|
case info.container_type
|
295
304
|
when :fn
|
296
305
|
if (meth = method?(info.container)) && meth.iseq
|
297
|
-
return [meth, meth.iseq.source_container[1], info.position,
|
306
|
+
return [meth, meth.iseq.source_container[1], info.position,
|
298
307
|
info.position_type]
|
299
308
|
else
|
300
309
|
return [nil] * 4
|
301
310
|
end
|
302
311
|
when :file
|
303
312
|
filename = canonic_file(info.container)
|
304
|
-
# ?? Try to look up method here?
|
313
|
+
# ?? Try to look up method here?
|
305
314
|
container = frame_container(@frame, false)
|
306
315
|
try_filename = container[1]
|
307
316
|
frame = (canonic_file(try_filename) == filename) ? @frame : nil
|
308
|
-
# else
|
317
|
+
# else
|
309
318
|
# LineCache.compiled_method(filename)
|
310
319
|
# end
|
311
320
|
return frame, filename, info.position, info.position_type
|
@@ -336,7 +345,7 @@ class Trepan
|
|
336
345
|
true
|
337
346
|
else
|
338
347
|
matches = find_scripts(filename)
|
339
|
-
if matches.size == 1
|
348
|
+
if matches.size == 1
|
340
349
|
LineCache.remap_file(filename, matches[0])
|
341
350
|
true
|
342
351
|
else
|
@@ -353,24 +362,24 @@ if __FILE__ == $0
|
|
353
362
|
if !(ARGV.size == 1 && ARGV[0] == 'noload')
|
354
363
|
ARGV[0..-1] = ['noload']
|
355
364
|
load(__FILE__)
|
356
|
-
else
|
365
|
+
else
|
357
366
|
require 'thread_frame'
|
358
367
|
require_relative '../app/mock'
|
359
368
|
require_relative './default'
|
360
369
|
require_relative 'frame'
|
361
370
|
|
362
371
|
# FIXME: Have to include before defining CmdProcessor!
|
363
|
-
require_relative '../processor'
|
372
|
+
require_relative '../processor'
|
364
373
|
|
365
374
|
cmdproc = Trepan::CmdProcessor.new(Trepan::MockCore.new())
|
366
375
|
cmdproc.frame_initialize
|
367
|
-
cmdproc.instance_variable_set('@settings',
|
376
|
+
cmdproc.instance_variable_set('@settings',
|
368
377
|
Trepan::CmdProcessor::DEFAULT_SETTINGS)
|
369
378
|
cmdproc.frame_setup(RubyVM::Frame.current)
|
370
379
|
onoff = %w(1 0 on off)
|
371
380
|
onoff.each { |val| puts "onoff(#{val}) = #{cmdproc.get_onoff(val)}" }
|
372
|
-
%w(1 1E bad 1+1 -5).each do |val|
|
373
|
-
puts "get_int_noerr(#{val}) = #{cmdproc.get_int_noerr(val).inspect}"
|
381
|
+
%w(1 1E bad 1+1 -5).each do |val|
|
382
|
+
puts "get_int_noerr(#{val}) = #{cmdproc.get_int_noerr(val).inspect}"
|
374
383
|
end
|
375
384
|
def foo; 5 end
|
376
385
|
def cmdproc.errmsg(msg)
|
@@ -381,7 +390,7 @@ if __FILE__ == $0
|
|
381
390
|
|
382
391
|
# puts cmdproc.object_iseq('foo@validate.rb').inspect
|
383
392
|
# puts cmdproc.object_iseq('cmdproc.object_iseq').inspect
|
384
|
-
|
393
|
+
|
385
394
|
puts cmdproc.parse_position(__FILE__).inspect
|
386
395
|
puts cmdproc.parse_position('@8').inspect
|
387
396
|
puts cmdproc.parse_position('8').inspect
|
@@ -0,0 +1,28 @@
|
|
1
|
+
-- (gcd.rb:4 @2)
|
2
|
+
def gcd(a, b)
|
3
|
+
-- (gcd.rb:18 @2)
|
4
|
+
a, b = ARGV[0..1].map {|arg| arg.to_i}
|
5
|
+
-- (gcd.rb:19 @45)
|
6
|
+
puts "The GCD of %d and %d is %d" % [a, b, gcd(a, b)]
|
7
|
+
-- (gcd.rb:6 @4)
|
8
|
+
if a > b
|
9
|
+
-- (gcd.rb:12 @40)
|
10
|
+
if a == 1 or b-a == 0
|
11
|
+
METHOD Object#gcd(a, b)
|
12
|
+
-> (gcd.rb:4 @2)
|
13
|
+
def gcd(a, b)
|
14
|
+
-- (gcd.rb:10 @24)
|
15
|
+
return nil if a <= 0
|
16
|
+
-- (gcd.rb:15 @71)
|
17
|
+
return gcd(b-a, a)
|
18
|
+
-- (gcd.rb:6 @4)
|
19
|
+
if a > b
|
20
|
+
-- (gcd.rb:12 @40)
|
21
|
+
if a == 1 or b-a == 0
|
22
|
+
<- (gcd.rb:13 @68)
|
23
|
+
R=> 1
|
24
|
+
return a
|
25
|
+
<- (gcd.rb:16 @88)
|
26
|
+
R=> 1
|
27
|
+
end
|
28
|
+
The GCD of 3 and 5 is 1
|
data/test/data/trace.right
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'test/unit'
|
3
|
+
require 'rbconfig'
|
3
4
|
require 'trace'
|
4
5
|
require_relative 'fn_helper'
|
5
6
|
|
@@ -9,6 +10,8 @@ class TestRaise < Test::Unit::TestCase
|
|
9
10
|
|
10
11
|
def test_raise
|
11
12
|
|
13
|
+
skip "FIXME on mingw" if
|
14
|
+
RbConfig::CONFIG['target_os'].start_with?('mingw')
|
12
15
|
cmds = [
|
13
16
|
'step',
|
14
17
|
'step',
|