rbx-trepanning 0.2.0-universal-rubinius-2.0
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/.gitignore +7 -0
- data/ChangeLog +2967 -0
- data/LICENSE +25 -0
- data/Makefile +13 -0
- data/NEWS +105 -0
- data/README.textile +34 -0
- data/Rakefile +244 -0
- data/THANKS +14 -0
- data/app/.gitignore +2 -0
- data/app/breakpoint.rb +242 -0
- data/app/brkptmgr.rb +153 -0
- data/app/client.rb +71 -0
- data/app/cmd_parse.kpeg +242 -0
- data/app/cmd_parse.rb +209 -0
- data/app/cmd_parser.rb +2083 -0
- data/app/complete.rb +79 -0
- data/app/condition.rb +22 -0
- data/app/default.rb +71 -0
- data/app/display.rb +186 -0
- data/app/eventbuffer.rb +147 -0
- data/app/file.rb +24 -0
- data/app/frame.rb +120 -0
- data/app/irb.rb +113 -0
- data/app/iseq.rb +188 -0
- data/app/method.rb +178 -0
- data/app/mock.rb +13 -0
- data/app/options.rb +154 -0
- data/app/rbx-llvm.rb +163 -0
- data/app/run.rb +92 -0
- data/app/util.rb +99 -0
- data/app/validate.rb +30 -0
- data/bin/.gitignore +2 -0
- data/bin/trepanx +69 -0
- data/data/.gitignore +2 -0
- data/data/irbrc +41 -0
- data/interface/.gitignore +2 -0
- data/interface/client.rb +84 -0
- data/interface/comcodes.rb +20 -0
- data/interface/script.rb +112 -0
- data/interface/server.rb +147 -0
- data/interface/user.rb +158 -0
- data/interface.rb +109 -0
- data/io/.gitignore +3 -0
- data/io/input.rb +151 -0
- data/io/null_output.rb +46 -0
- data/io/string_array.rb +155 -0
- data/io/tcpclient.rb +129 -0
- data/io/tcpfns.rb +33 -0
- data/io/tcpserver.rb +141 -0
- data/io.rb +148 -0
- data/lib/.gitignore +2 -0
- data/lib/trepanning.rb +467 -0
- data/processor/.gitignore +3 -0
- data/processor/Makefile +7 -0
- data/processor/breakpoint.rb +167 -0
- data/processor/command/.gitignore +2 -0
- data/processor/command/alias.rb +65 -0
- data/processor/command/backtrace.rb +68 -0
- data/processor/command/base/.gitignore +2 -0
- data/processor/command/base/subcmd.rb +226 -0
- data/processor/command/base/submgr.rb +185 -0
- data/processor/command/base/subsubcmd.rb +125 -0
- data/processor/command/base/subsubmgr.rb +196 -0
- data/processor/command/break.rb +78 -0
- data/processor/command/complete.rb +39 -0
- data/processor/command/condition.rb +64 -0
- data/processor/command/continue.rb +61 -0
- data/processor/command/delete.rb +44 -0
- data/processor/command/directory.rb +51 -0
- data/processor/command/disable.rb +71 -0
- data/processor/command/disassemble.rb +180 -0
- data/processor/command/display.rb +84 -0
- data/processor/command/down.rb +54 -0
- data/processor/command/edit.rb +74 -0
- data/processor/command/enable.rb +43 -0
- data/processor/command/eval.rb +93 -0
- data/processor/command/exit.rb +83 -0
- data/processor/command/finish.rb +80 -0
- data/processor/command/frame.rb +93 -0
- data/processor/command/help/.gitignore +1 -0
- data/processor/command/help/README +10 -0
- data/processor/command/help/command.txt +58 -0
- data/processor/command/help/examples.txt +16 -0
- data/processor/command/help/filename.txt +40 -0
- data/processor/command/help/location.txt +37 -0
- data/processor/command/help/suffixes.txt +17 -0
- data/processor/command/help.rb +228 -0
- data/processor/command/info.rb +30 -0
- data/processor/command/info_subcmd/.gitignore +3 -0
- data/processor/command/info_subcmd/breakpoints.rb +103 -0
- data/processor/command/info_subcmd/files.rb +219 -0
- data/processor/command/info_subcmd/frame.rb +68 -0
- data/processor/command/info_subcmd/line.rb +75 -0
- data/processor/command/info_subcmd/locals.rb +22 -0
- data/processor/command/info_subcmd/macro.rb +62 -0
- data/processor/command/info_subcmd/method.rb +71 -0
- data/processor/command/info_subcmd/program.rb +51 -0
- data/processor/command/info_subcmd/ruby.rb +64 -0
- data/processor/command/info_subcmd/source.rb +75 -0
- data/processor/command/info_subcmd/stack.rb +25 -0
- data/processor/command/info_subcmd/variables.rb +35 -0
- data/processor/command/info_subcmd/variables_subcmd/.gitignore +2 -0
- data/processor/command/info_subcmd/variables_subcmd/class.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/constant.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/globals.rb +69 -0
- data/processor/command/info_subcmd/variables_subcmd/instance.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/locals.rb +80 -0
- data/processor/command/kill.rb +79 -0
- data/processor/command/list.rb +234 -0
- data/processor/command/macro.rb +86 -0
- data/processor/command/next.rb +67 -0
- data/processor/command/nexti.rb +59 -0
- data/processor/command/parsetree.rb +51 -0
- data/processor/command/pr.rb +37 -0
- data/processor/command/ps.rb +40 -0
- data/processor/command/restart.rb +60 -0
- data/processor/command/save.rb +58 -0
- data/processor/command/server.rb +72 -0
- data/processor/command/set.rb +47 -0
- data/processor/command/set_subcmd/.gitignore +2 -0
- data/processor/command/set_subcmd/abbrev.rb +25 -0
- data/processor/command/set_subcmd/auto.rb +33 -0
- data/processor/command/set_subcmd/auto_subcmd/.gitignore +2 -0
- data/processor/command/set_subcmd/auto_subcmd/dis.rb +33 -0
- data/processor/command/set_subcmd/auto_subcmd/eval.rb +53 -0
- data/processor/command/set_subcmd/auto_subcmd/irb.rb +33 -0
- data/processor/command/set_subcmd/auto_subcmd/list.rb +33 -0
- data/processor/command/set_subcmd/basename.rb +25 -0
- data/processor/command/set_subcmd/confirm.rb +24 -0
- data/processor/command/set_subcmd/debug.rb +26 -0
- data/processor/command/set_subcmd/debug_subcmd/.gitignore +2 -0
- data/processor/command/set_subcmd/debug_subcmd/dbgr.rb +36 -0
- data/processor/command/set_subcmd/debug_subcmd/skip.rb +23 -0
- data/processor/command/set_subcmd/debug_subcmd/step.rb +23 -0
- data/processor/command/set_subcmd/different.rb +61 -0
- data/processor/command/set_subcmd/hidelevel.rb +62 -0
- data/processor/command/set_subcmd/highlight.rb +39 -0
- data/processor/command/set_subcmd/kernelstep.rb +60 -0
- data/processor/command/set_subcmd/max.rb +26 -0
- data/processor/command/set_subcmd/max_subcmd/.gitignore +2 -0
- data/processor/command/set_subcmd/max_subcmd/list.rb +49 -0
- data/processor/command/set_subcmd/max_subcmd/stack.rb +50 -0
- data/processor/command/set_subcmd/max_subcmd/string.rb +76 -0
- data/processor/command/set_subcmd/max_subcmd/width.rb +49 -0
- data/processor/command/set_subcmd/reload.rb +42 -0
- data/processor/command/set_subcmd/substitute.rb +24 -0
- data/processor/command/set_subcmd/substitute_subcmd/.gitignore +3 -0
- data/processor/command/set_subcmd/substitute_subcmd/path.rb +56 -0
- data/processor/command/set_subcmd/timer.rb +58 -0
- data/processor/command/set_subcmd/trace.rb +37 -0
- data/processor/command/set_subcmd/trace_subcmd/.gitignore +2 -0
- data/processor/command/set_subcmd/trace_subcmd/buffer.rb +42 -0
- data/processor/command/set_subcmd/trace_subcmd/print.rb +41 -0
- data/processor/command/shell.rb +131 -0
- data/processor/command/show.rb +39 -0
- data/processor/command/show_subcmd/.gitignore +3 -0
- data/processor/command/show_subcmd/abbrev.rb +20 -0
- data/processor/command/show_subcmd/aliases.rb +46 -0
- data/processor/command/show_subcmd/args.rb +25 -0
- data/processor/command/show_subcmd/auto.rb +28 -0
- data/processor/command/show_subcmd/auto_subcmd/.gitignore +3 -0
- data/processor/command/show_subcmd/auto_subcmd/dis.rb +37 -0
- data/processor/command/show_subcmd/auto_subcmd/eval.rb +24 -0
- data/processor/command/show_subcmd/auto_subcmd/irb.rb +23 -0
- data/processor/command/show_subcmd/auto_subcmd/list.rb +22 -0
- data/processor/command/show_subcmd/basename.rb +20 -0
- data/processor/command/show_subcmd/confirm.rb +18 -0
- data/processor/command/show_subcmd/debug.rb +26 -0
- data/processor/command/show_subcmd/debug_subcmd/.gitignore +3 -0
- data/processor/command/show_subcmd/debug_subcmd/dbgr.rb +21 -0
- data/processor/command/show_subcmd/debug_subcmd/skip.rb +22 -0
- data/processor/command/show_subcmd/debug_subcmd/step.rb +22 -0
- data/processor/command/show_subcmd/different.rb +26 -0
- data/processor/command/show_subcmd/directories.rb +22 -0
- data/processor/command/show_subcmd/hidelevel.rb +41 -0
- data/processor/command/show_subcmd/highlight.rb +25 -0
- data/processor/command/show_subcmd/kernelstep.rb +34 -0
- data/processor/command/show_subcmd/max.rb +27 -0
- data/processor/command/show_subcmd/max_subcmd/.gitignore +2 -0
- data/processor/command/show_subcmd/max_subcmd/list.rb +38 -0
- data/processor/command/show_subcmd/max_subcmd/stack.rb +36 -0
- data/processor/command/show_subcmd/max_subcmd/string.rb +42 -0
- data/processor/command/show_subcmd/max_subcmd/width.rb +37 -0
- data/processor/command/show_subcmd/reload.rb +18 -0
- data/processor/command/show_subcmd/timer.rb +18 -0
- data/processor/command/show_subcmd/trace.rb +27 -0
- data/processor/command/show_subcmd/trace_subcmd/.gitignore +2 -0
- data/processor/command/show_subcmd/trace_subcmd/buffer.rb +64 -0
- data/processor/command/show_subcmd/trace_subcmd/print.rb +23 -0
- data/processor/command/show_subcmd/version.rb +23 -0
- data/processor/command/source.rb +133 -0
- data/processor/command/step.rb +97 -0
- data/processor/command/tbreak.rb +20 -0
- data/processor/command/unalias.rb +49 -0
- data/processor/command/undisplay.rb +63 -0
- data/processor/command/up.rb +89 -0
- data/processor/command.rb +173 -0
- data/processor/default.rb +64 -0
- data/processor/disassemble.rb +59 -0
- data/processor/display.rb +53 -0
- data/processor/eval.rb +97 -0
- data/processor/eventbuf.rb +101 -0
- data/processor/frame.rb +265 -0
- data/processor/help.rb +94 -0
- data/processor/hook.rb +134 -0
- data/processor/list.rb +123 -0
- data/processor/load_cmds.rb +253 -0
- data/processor/location.rb +228 -0
- data/processor/mock.rb +138 -0
- data/processor/msg.rb +74 -0
- data/processor/running.rb +244 -0
- data/processor/stepping.rb +135 -0
- data/processor/subcmd.rb +136 -0
- data/processor/validate.rb +379 -0
- data/processor/virtual.rb +33 -0
- data/processor.rb +404 -0
- data/rbx-trepanning.gemspec +39 -0
- data/sample/.gitignore +2 -0
- data/sample/list-terminal-colors.rb +139 -0
- data/sample/rocky-dot-trepanxrc +14 -0
- data/sample/rocky-trepanx-colors.rb +46 -0
- data/test/data/.gitignore +1 -0
- data/test/data/enable.right +36 -0
- data/test/data/fname-with-blank.cmd +6 -0
- data/test/data/fname-with-blank.right +6 -0
- data/test/data/inline-call.cmd +6 -0
- data/test/data/inline-call.right +14 -0
- data/test/data/quit-Xdebug.right +3 -0
- data/test/data/quit.cmd +5 -0
- data/test/data/quit.right +3 -0
- data/test/data/quit2.cmd +6 -0
- data/test/data/quit2.right +3 -0
- data/test/example/.gitignore +2 -0
- data/test/example/debugger-stop.rb +16 -0
- data/test/example/factorial.rb +10 -0
- data/test/example/fname with blank.rb +1 -0
- data/test/example/gcd-server.rb +22 -0
- data/test/example/gcd.rb +19 -0
- data/test/example/goto2goto.rb +11 -0
- data/test/example/inline-call.rb +23 -0
- data/test/example/null.rb +1 -0
- data/test/example/thread1.rb +3 -0
- data/test/functional/.gitignore +3 -0
- data/test/functional/fn_helper.rb +112 -0
- data/test/functional/test-break-name.rb +52 -0
- data/test/functional/test-break.rb +85 -0
- data/test/functional/test-eval.rb +115 -0
- data/test/functional/test-finish.rb +70 -0
- data/test/functional/test-fn_helper.rb +43 -0
- data/test/functional/test-list.rb +56 -0
- data/test/functional/test-next-bug.rb +49 -0
- data/test/functional/test-next.rb +101 -0
- data/test/functional/test-recursive-bt.rb +94 -0
- data/test/functional/test-step.rb +272 -0
- data/test/functional/test-step2.rb +35 -0
- data/test/functional/test-tbreak.rb +41 -0
- data/test/integration/.gitignore +3 -0
- data/test/integration/file-diff.rb +89 -0
- data/test/integration/helper.rb +81 -0
- data/test/integration/test-fname-with-blank.rb +16 -0
- data/test/integration/test-inline-call.rb +20 -0
- data/test/integration/test-quit.rb +47 -0
- data/test/unit/.gitignore +3 -0
- data/test/unit/cmd-helper.rb +50 -0
- data/test/unit/mock-helper.rb +10 -0
- data/test/unit/test-app-brkpt.rb +31 -0
- data/test/unit/test-app-brkptmgr.rb +51 -0
- data/test/unit/test-app-cmd_parse.rb +97 -0
- data/test/unit/test-app-cmd_parser.rb +23 -0
- data/test/unit/test-app-complete.rb +39 -0
- data/test/unit/test-app-condition.rb +18 -0
- data/test/unit/test-app-display.rb +22 -0
- data/test/unit/test-app-iseq.rb +64 -0
- data/test/unit/test-app-method.rb +54 -0
- data/test/unit/test-app-options.rb +94 -0
- data/test/unit/test-app-run.rb +14 -0
- data/test/unit/test-app-util.rb +44 -0
- data/test/unit/test-app-validate.rb +18 -0
- data/test/unit/test-base-cmd.rb +45 -0
- data/test/unit/test-base-subcmd.rb +57 -0
- data/test/unit/test-base-submgr.rb +24 -0
- data/test/unit/test-base-subsubcmd.rb +17 -0
- data/test/unit/test-bin-trepanx.rb +48 -0
- data/test/unit/test-cmd-alias.rb +48 -0
- data/test/unit/test-cmd-break.rb +66 -0
- data/test/unit/test-cmd-edit.rb +34 -0
- data/test/unit/test-cmd-exit.rb +27 -0
- data/test/unit/test-cmd-finish.rb +31 -0
- data/test/unit/test-cmd-help.rb +104 -0
- data/test/unit/test-cmd-kill.rb +54 -0
- data/test/unit/test-cmd-parse_list_cmd.rb +36 -0
- data/test/unit/test-cmd-source.rb +34 -0
- data/test/unit/test-cmd-step.rb +29 -0
- data/test/unit/test-command.rb +45 -0
- data/test/unit/test-completion.rb +48 -0
- data/test/unit/test-intf-user.rb +46 -0
- data/test/unit/test-io-input.rb +27 -0
- data/test/unit/test-io-tcp.rb +33 -0
- data/test/unit/test-io-tcpclient.rb +54 -0
- data/test/unit/test-io-tcpfns.rb +17 -0
- data/test/unit/test-io-tcpserver.rb +50 -0
- data/test/unit/test-proc-eval.rb +35 -0
- data/test/unit/test-proc-frame.rb +81 -0
- data/test/unit/test-proc-help.rb +16 -0
- data/test/unit/test-proc-hook.rb +30 -0
- data/test/unit/test-proc-list.rb +55 -0
- data/test/unit/test-proc-load_cmds.rb +51 -0
- data/test/unit/test-proc-location.rb +67 -0
- data/test/unit/test-proc-main.rb +95 -0
- data/test/unit/test-proc-validate.rb +139 -0
- data/test/unit/test-subcmd-help.rb +43 -0
- metadata +545 -0
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'diff/lcs'
|
3
|
+
|
4
|
+
# Consider turning this into 'diff/lcs/file' or some such thing.
|
5
|
+
|
6
|
+
module DiffFile
|
7
|
+
def find_next(sdiff, i)
|
8
|
+
i += 1 while i < sdiff.size && sdiff[i].action == '='
|
9
|
+
return i
|
10
|
+
end
|
11
|
+
|
12
|
+
def find_pos(sdiff, i)
|
13
|
+
i += 1 while i < sdiff.size && sdiff[i].action != '='
|
14
|
+
return sdiff[i].old_position, sdiff[i].new_position
|
15
|
+
end
|
16
|
+
|
17
|
+
# Unix style context diff using files.
|
18
|
+
def diff_file(from_file, to_file, context=3)
|
19
|
+
seq1 = File.open(from_file).readlines
|
20
|
+
from_mtime = File.stat(from_file).mtime
|
21
|
+
seq2 = File.open(to_file).readlines
|
22
|
+
to_mtime = File.stat(to_file).mtime
|
23
|
+
sdiff = Diff::LCS.sdiff(seq1, seq2)
|
24
|
+
diff_lines(seq1, seq2, from_file, to_file, from_mtime,
|
25
|
+
to_mtime, context)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Unix style context diff with file/line stat info passed in.
|
29
|
+
|
30
|
+
# There may be some imprecision in position stuff here and there's a
|
31
|
+
# bug when context ranges overlap.
|
32
|
+
|
33
|
+
# FIXME: consider turning into an enumerator.
|
34
|
+
def diff_lines(seq1, seq2, from_file, to_file,
|
35
|
+
from_mtime, to_mtime, context=3)
|
36
|
+
sdiff = Diff::LCS.sdiff(seq1, seq2)
|
37
|
+
# PP.pp sdiff
|
38
|
+
# puts '-' * 40
|
39
|
+
started = false
|
40
|
+
result = []
|
41
|
+
i = 0
|
42
|
+
n = -(context+1)
|
43
|
+
while true do
|
44
|
+
i = find_next(sdiff, i)
|
45
|
+
break if i >= sdiff.size
|
46
|
+
if n < i-context
|
47
|
+
if started
|
48
|
+
result << '***************'
|
49
|
+
else
|
50
|
+
result << "*** #{from_file}\t#{from_mtime}"
|
51
|
+
result << "--- #{to_file}\t#{to_mtime}"
|
52
|
+
started = true
|
53
|
+
end
|
54
|
+
result << '*** %d,%d ****' % find_pos(sdiff, i)
|
55
|
+
context.downto(1) do |j|
|
56
|
+
result << ' ' + sdiff[i-j].new_element.chomp
|
57
|
+
end
|
58
|
+
end
|
59
|
+
i += 1
|
60
|
+
while i < sdiff.size && (action = sdiff[i-1].action) != '='
|
61
|
+
element =
|
62
|
+
if action == '+'
|
63
|
+
sdiff[i-1].new_element
|
64
|
+
else
|
65
|
+
sdiff[i-1].old_element
|
66
|
+
end
|
67
|
+
result << action + element.chomp
|
68
|
+
i += 1
|
69
|
+
end
|
70
|
+
-1.upto(context-2) do |j|
|
71
|
+
n = i+j
|
72
|
+
break if sdiff[n].action != '='
|
73
|
+
result << ' ' + sdiff[n].new_element.chomp
|
74
|
+
end
|
75
|
+
end
|
76
|
+
return result
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
if __FILE__ == $0
|
81
|
+
include DiffFile
|
82
|
+
eg_dir = File.join(File.dirname(__FILE__), %w(.. example))
|
83
|
+
filename = {}
|
84
|
+
%w(gcd gcd1 gcd-xx).each do |short|
|
85
|
+
filename[short] = File.join(eg_dir, short + '.rb')
|
86
|
+
end
|
87
|
+
puts diff_file(filename['gcd'], filename['gcd1']).join("\n")
|
88
|
+
puts diff_file(filename['gcd'], filename['gcd-xx']).join("\n")
|
89
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'rubygems'; require 'require_relative'
|
2
|
+
require 'diff/lcs'
|
3
|
+
require 'fileutils'
|
4
|
+
require_relative '../../app/run' # for RbConfig.ruby
|
5
|
+
|
6
|
+
DEFAULT_DEBUGGER_OPTS = {
|
7
|
+
:args => '',
|
8
|
+
:dbgr => '',
|
9
|
+
:outfile => nil,
|
10
|
+
:short_cmd => nil,
|
11
|
+
:short_right => nil,
|
12
|
+
:do_diff => true,
|
13
|
+
}
|
14
|
+
|
15
|
+
def run_debugger(testname, ruby_file, opts={})
|
16
|
+
opts = DEFAULT_DEBUGGER_OPTS.merge(opts)
|
17
|
+
srcdir = File.dirname(__FILE__)
|
18
|
+
datadir = File.join(srcdir, %w(.. data))
|
19
|
+
progdir = File.join(srcdir, %w(.. example))
|
20
|
+
|
21
|
+
dbgr_dir = File.join(srcdir, %w(.. ..))
|
22
|
+
dbgr_short = File.join(%w(bin trepanx))
|
23
|
+
dbgr_path = File.join(dbgr_dir, dbgr_short)
|
24
|
+
|
25
|
+
short_right = "#{opts[:short_right] || testname}.right"
|
26
|
+
rightfile = File.join(datadir, short_right)
|
27
|
+
|
28
|
+
short_cmd = "#{opts[:short_cmd] || testname}.cmd"
|
29
|
+
cmdfile = opts[:cmdfile] || File.join(datadir, short_cmd)
|
30
|
+
outfile = opts[:outfile] ||
|
31
|
+
File.join(srcdir, "#{testname}.out")
|
32
|
+
programfile = ruby_file ? File.join(progdir, ruby_file) : ''
|
33
|
+
|
34
|
+
FileUtils.rm(outfile) if File.exist?(outfile)
|
35
|
+
|
36
|
+
cmd = opts[:feed_input] ? "#{opts[:feed_input]} |" : ''
|
37
|
+
cmd +=
|
38
|
+
if opts[:xdebug]
|
39
|
+
"%s -Xdebug '%s' %s >%s 2>&1 <%s" %
|
40
|
+
[RbConfig.ruby, programfile, opts[:args], outfile, cmdfile]
|
41
|
+
elsif opts[:standalone]
|
42
|
+
"%s %s %s >%s 2>&1" %
|
43
|
+
[RbConfig.ruby, programfile, opts[:args], outfile]
|
44
|
+
else
|
45
|
+
"%s %s --nx --command %s %s '%s' %s >%s 2>&1" %
|
46
|
+
[RbConfig.ruby, dbgr_path, cmdfile, opts[:dbgr],
|
47
|
+
programfile, opts[:args], outfile]
|
48
|
+
end
|
49
|
+
puts cmd # if opts[:verbose]
|
50
|
+
system(cmd)
|
51
|
+
return false unless 0 == $?.exitstatus
|
52
|
+
if opts[:do_diff]
|
53
|
+
expected_lines = File.open(rightfile).readlines()
|
54
|
+
got_lines = File.open(outfile).readlines()
|
55
|
+
opts[:filter].call(got_lines, expected_lines) if opts[:filter]
|
56
|
+
# puts "=" * 80
|
57
|
+
# got_lines.map{|line| puts line}
|
58
|
+
|
59
|
+
# Seems to be a bug in LCS in that it will return a diff even if two
|
60
|
+
# files are the same.
|
61
|
+
return true if expected_lines == got_lines
|
62
|
+
|
63
|
+
sdiffs = Diff::LCS.sdiff(expected_lines, got_lines)
|
64
|
+
|
65
|
+
if sdiffs.empty?
|
66
|
+
FileUtils.rm(outfile)
|
67
|
+
else
|
68
|
+
puts cmd
|
69
|
+
sdiffs.each do |diff|
|
70
|
+
p diff
|
71
|
+
end
|
72
|
+
end
|
73
|
+
return sdiffs.empty?
|
74
|
+
else
|
75
|
+
return true # We already tested for false above
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
if __FILE__ == $0
|
80
|
+
run_debugger('testing', 'gcd1.rb')
|
81
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative 'helper'
|
5
|
+
|
6
|
+
class TestFnameWithBlank < Test::Unit::TestCase
|
7
|
+
@@NAME = File.basename(__FILE__, '.rb')[5..-1]
|
8
|
+
|
9
|
+
def test_it
|
10
|
+
opts = {}
|
11
|
+
opts[:filter] = Proc.new{|got_lines, correct_lines|
|
12
|
+
got_lines[0] = "-> (fname with blank.rb:1 @0)\n"
|
13
|
+
}
|
14
|
+
assert_equal(true, run_debugger(@@NAME, 'fname with blank.rb', opts))
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative 'helper'
|
5
|
+
|
6
|
+
class TestInlineCall < Test::Unit::TestCase
|
7
|
+
@@NAME = File.basename(__FILE__, '.rb')[5..-1]
|
8
|
+
def test_inline_call
|
9
|
+
opts = {
|
10
|
+
:short_cmd => @@NAME, :do_diff => true,
|
11
|
+
:standalone => true
|
12
|
+
}
|
13
|
+
opts[:filter] = Proc.new{|got_lines, correct_lines|
|
14
|
+
got_lines[0] = "-- (inline-call.rb:11 @12)\n"
|
15
|
+
}
|
16
|
+
|
17
|
+
no_error = run_debugger(@@NAME, @@NAME + '.rb', opts)
|
18
|
+
assert_equal(true, no_error)
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative 'helper'
|
5
|
+
|
6
|
+
class TestQuit < Test::Unit::TestCase
|
7
|
+
@@NAME = File.basename(__FILE__, '.rb')[5..-1]
|
8
|
+
|
9
|
+
# FIXME: causes rubinius to hang. Use
|
10
|
+
# rbx -Xagent.start -S rake
|
11
|
+
# to see backtrace
|
12
|
+
# def test_trepanx_set_confirm_off
|
13
|
+
# opts = {}
|
14
|
+
# opts[:filter] = Proc.new{|got_lines, correct_lines|
|
15
|
+
# got_lines[0] = "-> (null.rb:1 @0)\n"
|
16
|
+
# }
|
17
|
+
# assert_equal(true, run_debugger('quit2', 'null.rb', opts))
|
18
|
+
# end
|
19
|
+
|
20
|
+
def test_trepanx_call
|
21
|
+
opts = {}
|
22
|
+
opts[:filter] = Proc.new{|got_lines, correct_lines|
|
23
|
+
got_lines[0] = "-> (null.rb:1 @0)\n"
|
24
|
+
}
|
25
|
+
assert_equal(true, run_debugger(@@NAME, 'null.rb', opts))
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_xcode_call
|
29
|
+
startup_file = File.join(ENV['HOME'], '.rbxrc')
|
30
|
+
lines = File.open(startup_file).readlines.grep(/Trepan\.start/)
|
31
|
+
if lines && lines.any?{|line| line.grep(/:Xdebug/)}
|
32
|
+
no_error = run_debugger('quit-Xdebug', 'null.rb',
|
33
|
+
{:xdebug => true,
|
34
|
+
:short_cmd => @@NAME,
|
35
|
+
:do_diff => false
|
36
|
+
})
|
37
|
+
assert_equal(true, no_error)
|
38
|
+
if no_error
|
39
|
+
outfile = File.join(File.dirname(__FILE__), 'quit-Xdebug.out')
|
40
|
+
FileUtils.rm(outfile)
|
41
|
+
end
|
42
|
+
else
|
43
|
+
puts "Trepan.start(:skip_loader=>:Xdebug) is not in ~.rbxrc. Skipping."
|
44
|
+
assert true
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'; require 'require_relative'
|
3
|
+
require_relative '../../processor/mock'
|
4
|
+
require_relative '../../processor/frame'
|
5
|
+
|
6
|
+
module UnitHelper
|
7
|
+
|
8
|
+
module_function
|
9
|
+
def common_setup
|
10
|
+
@dbg ||= MockDebugger::MockDebugger.new(:nx => true)
|
11
|
+
@cmdproc ||= Trepan::CmdProcessor.new(@dbg)
|
12
|
+
@cmdproc.frame_initialize
|
13
|
+
@cmdproc.dbgr ||= @dbg
|
14
|
+
@cmds = @cmdproc.commands
|
15
|
+
|
16
|
+
def @cmdproc.errmsg(message, opts={})
|
17
|
+
@errmsgs << message
|
18
|
+
end
|
19
|
+
def @cmdproc.errmsgs
|
20
|
+
@errmsgs
|
21
|
+
end
|
22
|
+
def @cmdproc.msg(message, opts={})
|
23
|
+
@msgs << message
|
24
|
+
end
|
25
|
+
def @cmdproc.msgs
|
26
|
+
@msgs
|
27
|
+
end
|
28
|
+
def @cmdproc.section(message, opts={})
|
29
|
+
@msgs << message
|
30
|
+
end
|
31
|
+
reset_cmdproc_vars
|
32
|
+
end
|
33
|
+
|
34
|
+
def common_teardown
|
35
|
+
@cmdproc.finalize
|
36
|
+
end
|
37
|
+
|
38
|
+
def reset_cmdproc_vars
|
39
|
+
@cmdproc.instance_variable_set('@msgs', [])
|
40
|
+
@cmdproc.instance_variable_set('@errmsgs', [])
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
if __FILE__ == $0
|
46
|
+
include UnitHelper
|
47
|
+
common_setup
|
48
|
+
p @cmdproc.msgs
|
49
|
+
p @dbg
|
50
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../../app/breakpoint'
|
5
|
+
|
6
|
+
class TestAppBrkpt < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def test_basic
|
9
|
+
method = Rubinius::CompiledMethod.of_sender
|
10
|
+
b1 = Trepan::Breakpoint.new('<start>', method, 1, 2, 0)
|
11
|
+
assert_equal(false, b1.temp?)
|
12
|
+
assert_equal(0, b1.hits)
|
13
|
+
assert_equal('B', b1.icon_char)
|
14
|
+
assert_equal(true, b1.condition?(binding))
|
15
|
+
assert_equal(1, b1.hits)
|
16
|
+
b1.enabled = false
|
17
|
+
assert_equal(false, b1.active?)
|
18
|
+
assert_equal('b', b1.icon_char)
|
19
|
+
assert_raises ArgumentError do
|
20
|
+
b1.activate
|
21
|
+
end
|
22
|
+
|
23
|
+
b2 = Trepan::Breakpoint.new('<start>', method, 0, 2, 0)
|
24
|
+
b2.activate
|
25
|
+
assert_equal(true, b2.active?)
|
26
|
+
b2.remove!
|
27
|
+
assert_equal(false, b2.active?)
|
28
|
+
b3 = Trepan::Breakpoint.new('temp brkpt', method, 2, 3, 0, :temp => true)
|
29
|
+
assert_equal('t', b3.icon_char)
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../../app/brkptmgr'
|
5
|
+
require_relative '../../app/breakpoint'
|
6
|
+
|
7
|
+
class TestLibAppBrkptMgr < Test::Unit::TestCase
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@meth = Rubinius::CompiledMethod.of_sender
|
11
|
+
@brkpts = Trepan::BreakpointMgr.new
|
12
|
+
@offset = 0
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_basic
|
16
|
+
assert_equal(0, @brkpts.size)
|
17
|
+
b1 = @brkpts.add("<start>", @meth, @offset, 0, 1)
|
18
|
+
assert_equal(b1, @brkpts.find(@meth, @offset))
|
19
|
+
assert_equal(1, @brkpts.size)
|
20
|
+
# require 'trepanning'
|
21
|
+
# dbgr = Trepan.new(:set_restart => true); dbgr.start
|
22
|
+
assert_equal(b1, @brkpts.delete(b1.id))
|
23
|
+
assert_equal(0, @brkpts.size)
|
24
|
+
|
25
|
+
# Try adding via << rather than .add
|
26
|
+
b2 = @brkpts << Trepan::Breakpoint.new(@meth, 5, nil, :temp => true)
|
27
|
+
|
28
|
+
assert_equal(nil, @brkpts.find(@meth, 6))
|
29
|
+
@brkpts.reset
|
30
|
+
assert_equal(0, @brkpts.size)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_multiple_brkpt_per_offset
|
34
|
+
b1 = @brkpts.add("b1", @meth, @offset, 5, 2)
|
35
|
+
b2 = @brkpts.add("b2", @meth, @offset, 5, 2)
|
36
|
+
assert_equal(2, @brkpts.size)
|
37
|
+
assert_equal(1, @brkpts.set.size,
|
38
|
+
'Two breakpoints but only one @meth/offset')
|
39
|
+
@brkpts.delete_by_brkpt(b1)
|
40
|
+
assert_equal(1, @brkpts.size,
|
41
|
+
'One breakpoint after 2nd breakpoint deleted')
|
42
|
+
assert_equal(1, @brkpts.set.size,
|
43
|
+
'Two breakpoints, but only one @meth/offset')
|
44
|
+
@brkpts.delete_by_brkpt(b2)
|
45
|
+
assert_equal(0, @brkpts.size,
|
46
|
+
'Both breakpoints deleted')
|
47
|
+
assert_equal(0, @brkpts.set.size,
|
48
|
+
'Second breakpoint delete should delete @meth/offset')
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../../app/cmd_parse'
|
5
|
+
|
6
|
+
class TestCmdParse < Test::Unit::TestCase
|
7
|
+
|
8
|
+
# require_relative '../../lib/trepanning'
|
9
|
+
def test_parse_location
|
10
|
+
[['fn', [:fn, nil, nil]],
|
11
|
+
['fn 2', [:fn, :line, 2]],
|
12
|
+
['fn @5', [:fn, :offset, 5]],
|
13
|
+
['@3', [nil, :offset, 3]],
|
14
|
+
['fn:6', [:fn, :line, 6]],
|
15
|
+
["#{__FILE__}:5", [:file, :line, 5]],
|
16
|
+
['fn:@15', [:fn, :offset, 15]],
|
17
|
+
].each do |location, expect|
|
18
|
+
cp = parse_location(location)
|
19
|
+
assert cp, "should be able to parse #{location} as a location"
|
20
|
+
assert_equal(expect[0], cp.container_type,
|
21
|
+
"mismatch container_type on #{location}")
|
22
|
+
assert_equal(expect[1], cp.position_type,
|
23
|
+
"mismatch position_type on #{location}")
|
24
|
+
assert_equal(expect[2], cp.position,
|
25
|
+
"mismatch position on #{location}")
|
26
|
+
end
|
27
|
+
|
28
|
+
# %w(0 1e10 a.b).each do |location|
|
29
|
+
# begin
|
30
|
+
# cp = CmdParse.new(name)
|
31
|
+
# assert_equal nil cp._location,
|
32
|
+
# "should be able to parse #{name} as a location"
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
end
|
36
|
+
|
37
|
+
module Testing
|
38
|
+
def testing; 5 end
|
39
|
+
module_function :testing
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_parse_identifier
|
43
|
+
%w(a a1 $global __FILE__ Constant).each do |name|
|
44
|
+
cp = CmdParse.new(name)
|
45
|
+
assert cp._identifier, "should be able to parse #{name} as an identifier"
|
46
|
+
end
|
47
|
+
%w(0 1e10 @10).each do |name|
|
48
|
+
cp = CmdParse.new(name)
|
49
|
+
assert_equal(true, !cp._identifier,
|
50
|
+
"should not have been able to parse of #{name}")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_parse_method
|
55
|
+
[['Object', 0], ['A::B', 1], ['A::B::C', 2],
|
56
|
+
['A::B::C::D', 3], ['A::B.c', 2], ['A.b.c.d', 3]].each do |name, count|
|
57
|
+
cp = CmdParse.new(name)
|
58
|
+
assert cp._class_module_chain, "should be able to parse of #{name}"
|
59
|
+
m = cp.result
|
60
|
+
count.times do |i|
|
61
|
+
assert m, "Chain item #{i} of #{name} should not be nil"
|
62
|
+
m = m.chain[1]
|
63
|
+
end
|
64
|
+
assert_nil m.chain, "#{count} chain item in #{cp.result} should be nil"
|
65
|
+
end
|
66
|
+
['A(5)'].each do |name|
|
67
|
+
cp = CmdParse.new(name)
|
68
|
+
cp._class_module_chain
|
69
|
+
assert_not_equal(name, cp.result.name,
|
70
|
+
"should not have been able to parse of #{name}")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
include Trepan::CmdParser
|
75
|
+
def test_method_name
|
76
|
+
def five; 5 end
|
77
|
+
%w(five Rubinius::VM.backtrace Kernel.eval
|
78
|
+
Testing.testing Kernel::eval File.basename).each do |str|
|
79
|
+
meth = meth_for_string(str, binding)
|
80
|
+
assert meth.kind_of?(Method), "#{str} method's class should be Method, not #{meth.class}"
|
81
|
+
end
|
82
|
+
x = File
|
83
|
+
def x.five; 5; end
|
84
|
+
%w(x.basename x.five).each do |str|
|
85
|
+
meth = meth_for_string(str, binding)
|
86
|
+
assert meth.kind_of?(Method), "#{str} method's class should be Method, not #{meth.class}"
|
87
|
+
end
|
88
|
+
%w(Array.map).each do |str|
|
89
|
+
meth = meth_for_string(str, binding)
|
90
|
+
assert meth.kind_of?(UnboundMethod), "#{meth.class}"
|
91
|
+
end
|
92
|
+
%w(O5).each do |str|
|
93
|
+
meth = meth_for_string(str, binding)
|
94
|
+
assert_equal nil, meth, "should have found a method for #{str}"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../../app/cmd_parser'
|
5
|
+
|
6
|
+
class TestAppCmdParser < Test::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
@cp = CmdParse.new('', :debug=>true)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_parse_filename
|
12
|
+
[
|
13
|
+
['filename', 'filename'],
|
14
|
+
['"this is a filename"', 'this is a filename'],
|
15
|
+
['this\ is\ another\ filename', 'this is another filename'],
|
16
|
+
['C\:filename', 'C:filename']
|
17
|
+
].each do |name, expect|
|
18
|
+
@cp.setup_parser(name, :debug => true)
|
19
|
+
res = @cp._filename
|
20
|
+
assert_equal(expect, @cp.result)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../../app/complete'
|
5
|
+
|
6
|
+
class TestAppUtil < Test::Unit::TestCase
|
7
|
+
include Trepan::Complete
|
8
|
+
def test_complete
|
9
|
+
hash = {'ab' => 1, 'aac' => 2, 'aa' => 3, 'a' => 4}
|
10
|
+
ary = hash.keys.sort
|
11
|
+
[[[], 'b'], [ary, 'a'], [%w(aa aac), 'aa'],
|
12
|
+
[ary, ''], [['ab'], 'ab'], [[], 'abc']].each do |result, prefix|
|
13
|
+
assert_equal(result, complete_token(ary, prefix),
|
14
|
+
"Trouble matching #{ary}.inspect on #{prefix.inspect}")
|
15
|
+
end
|
16
|
+
[[ary, 'a'], [%w(aa aac), 'aa'],
|
17
|
+
[['ab'], 'ab'], [[], 'abc']].each do |result_keys, prefix|
|
18
|
+
result = result_keys.map {|key| [key, hash[key]]}
|
19
|
+
assert_equal(result, complete_token_with_next(hash, prefix),
|
20
|
+
"Trouble matching #{hash}.inspect on #{prefix.inspect}")
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_next_token
|
26
|
+
x = ' now is the time'
|
27
|
+
[[0, [ 5, 'now']],
|
28
|
+
[2, [ 5, 'now']],
|
29
|
+
[5, [ 8, 'is']],
|
30
|
+
[8, [13, 'the']],
|
31
|
+
[9, [13, 'the']],
|
32
|
+
[13, [19, 'time']],
|
33
|
+
[19, [19, '']],
|
34
|
+
].each do |pos, expect|
|
35
|
+
assert_equal expect, next_token(x, pos)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'stringio'
|
3
|
+
require 'test/unit'
|
4
|
+
require 'rubygems'; require 'require_relative'
|
5
|
+
require_relative '../../app/condition'
|
6
|
+
|
7
|
+
class TestAppCondition < Test::Unit::TestCase
|
8
|
+
include Trepan::Condition
|
9
|
+
|
10
|
+
def test_basic
|
11
|
+
assert valid_condition?('1+2')
|
12
|
+
old_stderr = $stderr
|
13
|
+
new_stdout = StringIO.new
|
14
|
+
$stderr = new_stdout
|
15
|
+
assert_equal nil, valid_condition?('1+')
|
16
|
+
$stderr = old_stderr
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'; require 'require_relative'
|
3
|
+
require 'test/unit'
|
4
|
+
require_relative '../../app/display'
|
5
|
+
require_relative '../../app/frame'
|
6
|
+
|
7
|
+
class TestLibAppBrkptMgr < Test::Unit::TestCase
|
8
|
+
|
9
|
+
def test_basic
|
10
|
+
mgr = DisplayMgr.new
|
11
|
+
# frame = Trepan::Frame.new(self, 0, Rubinius::VM.backtrace(0)[1])
|
12
|
+
assert_equal(0, mgr.size)
|
13
|
+
# disp = mgr.add(frame, '3 > 1')
|
14
|
+
# assert_equal(1, mgr.max)
|
15
|
+
# assert_equal(true, disp.enabled?)
|
16
|
+
|
17
|
+
# mgr.enable_disable(disp.number, false)
|
18
|
+
# assert_equal(false, disp.enabled?)
|
19
|
+
# mgr.enable_disable(disp.number, true)
|
20
|
+
# assert_equal(true, disp.enabled?)
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../../app/iseq'
|
5
|
+
|
6
|
+
class TestAppISeq < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def test_disasm_prefix
|
9
|
+
meth = Rubinius::VM.backtrace(0, true)[0].method
|
10
|
+
assert_equal(' -->', Trepan::ISeq.disasm_prefix(0, 0, meth))
|
11
|
+
assert_equal(' ', Trepan::ISeq.disasm_prefix(0, 1, meth))
|
12
|
+
meth.set_breakpoint(0, nil)
|
13
|
+
assert_equal('B-->', Trepan::ISeq.disasm_prefix(0, 0, meth))
|
14
|
+
assert_equal('B ', Trepan::ISeq.disasm_prefix(0, 1, meth))
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_basic
|
18
|
+
|
19
|
+
def single_return
|
20
|
+
cm = Rubinius::VM.backtrace(0, true)[0].method
|
21
|
+
last = cm.lines.last
|
22
|
+
first = 0
|
23
|
+
0.upto((cm.lines.last+1)/2) do |i|
|
24
|
+
first = cm.lines[i*2]
|
25
|
+
break if -1 != first
|
26
|
+
end
|
27
|
+
[last, Trepan::ISeq.yield_or_return_between(cm, first, last)]
|
28
|
+
end
|
29
|
+
|
30
|
+
def branching(bool)
|
31
|
+
cm = Rubinius::VM.backtrace(0, true)[0].method
|
32
|
+
last = cm.lines.last
|
33
|
+
first = nil
|
34
|
+
0.upto((cm.lines.last+1)/2) do |i|
|
35
|
+
first = cm.lines[i*2]
|
36
|
+
break if -1 != first
|
37
|
+
end
|
38
|
+
|
39
|
+
if bool
|
40
|
+
x = 5
|
41
|
+
else
|
42
|
+
x = 6
|
43
|
+
end
|
44
|
+
Trepan::ISeq.goto_between(cm, first, last)
|
45
|
+
end
|
46
|
+
|
47
|
+
def no_branching
|
48
|
+
cm = Rubinius::VM.backtrace(0, true)[0].method
|
49
|
+
last = cm.lines.last
|
50
|
+
first = 0
|
51
|
+
0.upto((cm.lines.last+1)/2) do |i|
|
52
|
+
first = cm.lines[i*2]
|
53
|
+
break if -1 != first
|
54
|
+
end
|
55
|
+
Trepan::ISeq.goto_between(cm, first, last)
|
56
|
+
end
|
57
|
+
|
58
|
+
last, return_ips = single_return
|
59
|
+
assert_equal([last-1], return_ips)
|
60
|
+
assert_equal(-2, no_branching)
|
61
|
+
assert_equal(2, branching(true).size)
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|