rbx-trepanning 0.0.5-universal-rubinius-1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +2002 -0
- data/LICENSE +25 -0
- data/NEWS +31 -0
- data/README.textile +34 -0
- data/Rakefile +165 -0
- data/THANKS +14 -0
- data/app/breakpoint.rb +219 -0
- data/app/breakpoint.rbc +3551 -0
- data/app/brkptmgr.rb +140 -0
- data/app/brkptmgr.rbc +2903 -0
- data/app/client.rb +61 -0
- data/app/client.rbc +1225 -0
- data/app/complete.rb +52 -0
- data/app/complete.rbc +1288 -0
- data/app/default.rb +71 -0
- data/app/default.rbc +1132 -0
- data/app/display.rb +148 -0
- data/app/display.rbc +2578 -0
- data/app/frame.rb +98 -0
- data/app/frame.rbc +1808 -0
- data/app/irb.rb +111 -0
- data/app/irb.rbc +2094 -0
- data/app/iseq.rb +117 -0
- data/app/iseq.rbc +2192 -0
- data/app/llvm.rbc +2478 -0
- data/app/method.rb +173 -0
- data/app/method.rbc +2492 -0
- data/app/method_name.rbc +2467 -0
- data/app/mock.rb +13 -0
- data/app/mock.rbc +398 -0
- data/app/options.rb +137 -0
- data/app/options.rbc +2898 -0
- data/app/rbx-llvm.rb +165 -0
- data/app/rbx-llvm.rbc +2478 -0
- data/app/run.rb +86 -0
- data/app/run.rbc +1244 -0
- data/app/util.rb +49 -0
- data/app/util.rbc +1146 -0
- data/app/validate.rb +30 -0
- data/app/validate.rbc +676 -0
- data/bin/trepan.compiled.rbc +1043 -0
- data/bin/trepanx +69 -0
- data/bin/trepanx.compiled.rbc +1049 -0
- data/data/irbrc +41 -0
- data/data/irbrc.compiled.rbc +640 -0
- data/interface/base_intf.rb +105 -0
- data/interface/base_intf.rbc +1899 -0
- data/interface/client.rb +80 -0
- data/interface/client.rbc +1072 -0
- data/interface/comcodes.rb +20 -0
- data/interface/comcodes.rbc +385 -0
- data/interface/script.rb +104 -0
- data/interface/script.rbc +1642 -0
- data/interface/server.rb +143 -0
- data/interface/server.rbc +2213 -0
- data/interface/user.rb +150 -0
- data/interface/user.rbc +2867 -0
- data/io/base_io.rb +148 -0
- data/io/base_io.rbc +2111 -0
- data/io/input.rb +135 -0
- data/io/input.rbc +2528 -0
- data/io/null_output.rb +42 -0
- data/io/null_output.rbc +730 -0
- data/io/string_array.rb +156 -0
- data/io/string_array.rbc +2466 -0
- data/io/tcpclient.rb +129 -0
- data/io/tcpclient.rbc +2419 -0
- data/io/tcpfns.rb +33 -0
- data/io/tcpfns.rbc +694 -0
- data/io/tcpserver.rb +141 -0
- data/io/tcpserver.rbc +2638 -0
- data/lib/trepanning.rb +474 -0
- data/lib/trepanning.rbc +7705 -0
- data/lib/trepanning2.rb +441 -0
- data/processor/breakpoint.rb +164 -0
- data/processor/command/alias.rb +55 -0
- data/processor/command/backtrace.rb +76 -0
- data/processor/command/base/cmd.rb +173 -0
- data/processor/command/base/subcmd.rb +229 -0
- data/processor/command/base/submgr.rb +182 -0
- data/processor/command/base/subsubcmd.rb +103 -0
- data/processor/command/base/subsubmgr.rb +195 -0
- data/processor/command/break.rb +100 -0
- data/processor/command/complete.rb +37 -0
- data/processor/command/continue.rb +91 -0
- data/processor/command/delete.rb +30 -0
- data/processor/command/directory.rb +51 -0
- data/processor/command/disassemble.rb +145 -0
- data/processor/command/display.rb +82 -0
- data/processor/command/down.rb +54 -0
- data/processor/command/eval.rb +51 -0
- data/processor/command/exit.rb +62 -0
- data/processor/command/finish.rb +80 -0
- data/processor/command/frame.rb +89 -0
- data/processor/command/help.rb +251 -0
- data/processor/command/info.rb +28 -0
- data/processor/command/info_subcmd/breakpoints.rb +73 -0
- data/processor/command/info_subcmd/files.rb +209 -0
- data/processor/command/info_subcmd/line.rb +86 -0
- data/processor/command/info_subcmd/method.rb +71 -0
- data/processor/command/info_subcmd/program.rb +49 -0
- data/processor/command/info_subcmd/ruby.rb +62 -0
- data/processor/command/info_subcmd/variables.rb +48 -0
- data/processor/command/irb.rb +128 -0
- data/processor/command/kill.rb +70 -0
- data/processor/command/list.rb +300 -0
- data/processor/command/macro.rb +76 -0
- data/processor/command/next.rb +66 -0
- data/processor/command/nexti.rb +59 -0
- data/processor/command/pr.rb +38 -0
- data/processor/command/ps.rb +40 -0
- data/processor/command/restart.rb +60 -0
- data/processor/command/server.rb +72 -0
- data/processor/command/set.rb +47 -0
- data/processor/command/set_subcmd/auto.rb +27 -0
- data/processor/command/set_subcmd/auto_subcmd/dis.rb +33 -0
- data/processor/command/set_subcmd/auto_subcmd/eval.rb +54 -0
- data/processor/command/set_subcmd/auto_subcmd/irb.rb +34 -0
- data/processor/command/set_subcmd/auto_subcmd/list.rb +34 -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/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 +59 -0
- data/processor/command/set_subcmd/hidelevel.rb +62 -0
- data/processor/command/set_subcmd/highlight.rb +33 -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/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/substitute.rb +24 -0
- data/processor/command/set_subcmd/substitute_subcmd/path.rb +56 -0
- data/processor/command/set_subcmd/trace.rb +36 -0
- data/processor/command/set_subcmd/trace_subcmd/print.rb +57 -0
- data/processor/command/show.rb +38 -0
- data/processor/command/show_subcmd/alias.rb +42 -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/dis.rb +37 -0
- data/processor/command/show_subcmd/auto_subcmd/eval.rb +28 -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/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/hidelevel.rb +41 -0
- data/processor/command/show_subcmd/highlight.rb +24 -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/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/trace.rb +27 -0
- data/processor/command/show_subcmd/trace_subcmd/print.rb +38 -0
- data/processor/command/show_subcmd/version.rb +23 -0
- data/processor/command/source.rb +126 -0
- data/processor/command/step.rb +84 -0
- data/processor/command/tbreak.rb +19 -0
- data/processor/command/unalias.rb +44 -0
- data/processor/command/undisplay.rb +59 -0
- data/processor/command/up.rb +86 -0
- data/processor/default.rb +58 -0
- data/processor/disassemble.rb +46 -0
- data/processor/display.rb +18 -0
- data/processor/eval.rb +96 -0
- data/processor/frame.rb +211 -0
- data/processor/help.rb +72 -0
- data/processor/hook.rb +133 -0
- data/processor/load_cmds.rb +185 -0
- data/processor/location.rb +137 -0
- data/processor/main.rb +412 -0
- data/processor/mock.rb +144 -0
- data/processor/msg.rb +43 -0
- data/processor/running.rb +234 -0
- data/processor/stepping.rb +114 -0
- data/processor/subcmd.rb +161 -0
- data/processor/validate.rb +355 -0
- data/sample/list-terminal-colors.rb +139 -0
- data/sample/list-terminal-colors.rbc +2318 -0
- data/sample/rocky-dot-trepanxrc +14 -0
- data/sample/rocky-trepanx-colors.rb +47 -0
- data/sample/rocky-trepanx-colors.rbc +530 -0
- data/test/data/enable.right +36 -0
- data/test/data/fname-with-blank.cmd +6 -0
- data/test/data/fname-with-blank.right +4 -0
- data/test/data/inline-call.cmd +6 -0
- data/test/data/inline-call.right +13 -0
- data/test/data/quit-Xdebug.right +3 -0
- data/test/data/quit.cmd +5 -0
- data/test/data/quit.right +2 -0
- data/test/data/quit2.cmd +6 -0
- data/test/data/quit2.right +3 -0
- data/test/data/step-bug.cmd +11 -0
- data/test/data/step-bug.right +3 -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/inline-call.rb +23 -0
- data/test/example/null.rb +1 -0
- data/test/example/step-bug.rb +14 -0
- data/test/example/thread1.rb +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 +51 -0
- data/test/functional/test-finish.rb +70 -0
- data/test/functional/test-fn_helper.rb +43 -0
- data/test/functional/test-list.rb +55 -0
- data/test/functional/test-next-bug.rb +49 -0
- data/test/functional/test-next.rb +101 -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/file-diff.rb +89 -0
- data/test/integration/helper.rb +78 -0
- data/test/integration/skip-test-step-bug.rb +17 -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/cmd-helper.rb +50 -0
- data/test/unit/mock-helper.rb +10 -0
- data/test/unit/test-app-brkpt.rb +29 -0
- data/test/unit/test-app-brkptmgr.rb +51 -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 +82 -0
- data/test/unit/test-app-run.rb +16 -0
- data/test/unit/test-app-util.rb +27 -0
- data/test/unit/test-app-validate.rb +18 -0
- data/test/unit/test-base-cmd.rb +47 -0
- data/test/unit/test-base-subcmd.rb +61 -0
- data/test/unit/test-base-submgr.rb +24 -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 +22 -0
- data/test/unit/test-cmd-exit.rb +27 -0
- data/test/unit/test-cmd-finish.rb +27 -0
- data/test/unit/test-cmd-help.rb +104 -0
- data/test/unit/test-cmd-kill.rb +47 -0
- data/test/unit/test-cmd-source.rb +34 -0
- data/test/unit/test-cmd-step.rb +29 -0
- data/test/unit/test-completion.rb +38 -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 +36 -0
- data/test/unit/test-proc-frame.rb +79 -0
- data/test/unit/test-proc-help.rb +16 -0
- data/test/unit/test-proc-hook.rb +30 -0
- data/test/unit/test-proc-load_cmds.rb +50 -0
- data/test/unit/test-proc-location.rb +53 -0
- data/test/unit/test-proc-main.rb +99 -0
- data/test/unit/test-proc-validate.rb +91 -0
- data/test/unit/test-subcmd-help.rb +47 -0
- metadata +398 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative 'fn_helper'
|
5
|
+
|
6
|
+
class TestStep2 < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include FnTestHelper
|
9
|
+
|
10
|
+
def test_step_out_of_fn
|
11
|
+
|
12
|
+
# See that handle stepping out of a function properly.
|
13
|
+
cmds = ['step', 'step', 'continue']
|
14
|
+
d = strarray_setup(cmds)
|
15
|
+
|
16
|
+
def echo(x)
|
17
|
+
return x
|
18
|
+
end
|
19
|
+
|
20
|
+
d.start
|
21
|
+
########### t1 ###############
|
22
|
+
x = echo("hi")
|
23
|
+
y = 3
|
24
|
+
##############################
|
25
|
+
d.stop
|
26
|
+
out = ['-- ',
|
27
|
+
'x = echo("hi")',
|
28
|
+
'-> ',
|
29
|
+
'return x',
|
30
|
+
'-- ',
|
31
|
+
'x = echo("hi")']
|
32
|
+
compare_output(out, d, cmds)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative 'fn_helper'
|
5
|
+
|
6
|
+
class TestTBreak < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include FnTestHelper
|
9
|
+
|
10
|
+
def foo
|
11
|
+
a = 3
|
12
|
+
b = 4
|
13
|
+
c = 5
|
14
|
+
d = 6
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_basic
|
18
|
+
# Check that temporary breaks are, well, temporary.
|
19
|
+
# The last "continue" below isn't used. It to make sure we finish
|
20
|
+
# the test even when the breakpoint isn't temporary.
|
21
|
+
cmds = ['tbreak TestTBreak#foo', 'continue', 'continue', 'continue']
|
22
|
+
d = strarray_setup(cmds)
|
23
|
+
d.start
|
24
|
+
##############################
|
25
|
+
2.times do
|
26
|
+
foo
|
27
|
+
end
|
28
|
+
##############################
|
29
|
+
d.stop # ({:remove => true})
|
30
|
+
out = ['-- ',
|
31
|
+
'2.times do ',
|
32
|
+
'Set temporary breakpoint 1: foo.rb:55 (@3)',
|
33
|
+
"x1 ",
|
34
|
+
'a = 3'
|
35
|
+
]
|
36
|
+
compare_output(out, d, cmds)
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
|
@@ -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,78 @@
|
|
1
|
+
require 'diff/lcs'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../../app/run' # for ruby_path
|
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 =
|
37
|
+
if opts[:xdebug]
|
38
|
+
"%s -Xdebug '%s' %s >%s 2>&1 <%s" %
|
39
|
+
[Trepanning::ruby_path, programfile, opts[:args], outfile, cmdfile]
|
40
|
+
elsif opts[:standalone]
|
41
|
+
"%s %s %s >%s 2>&1" %
|
42
|
+
[Trepanning::ruby_path, programfile, opts[:args], outfile]
|
43
|
+
else
|
44
|
+
"%s %s --nx --command %s %s '%s' %s >%s 2>&1" %
|
45
|
+
[Trepanning::ruby_path, dbgr_path, cmdfile, opts[:dbgr],
|
46
|
+
programfile, opts[:args], outfile]
|
47
|
+
end
|
48
|
+
|
49
|
+
system(cmd)
|
50
|
+
return false unless 0 == $?.exitstatus
|
51
|
+
if opts[:do_diff]
|
52
|
+
expected_lines = File.open(rightfile).readlines()
|
53
|
+
got_lines = File.open(outfile).readlines()
|
54
|
+
opts[:filter].call(got_lines, expected_lines) if opts[:filter]
|
55
|
+
|
56
|
+
# Seems to be a bug in LCS in that it will return a diff even if two
|
57
|
+
# files are the same.
|
58
|
+
return true if expected_lines == got_lines
|
59
|
+
|
60
|
+
sdiffs = Diff::LCS.sdiff(expected_lines, got_lines)
|
61
|
+
|
62
|
+
if sdiffs.empty?
|
63
|
+
FileUtils.rm(outfile)
|
64
|
+
else
|
65
|
+
puts cmd
|
66
|
+
sdiffs.each do |diff|
|
67
|
+
p diff
|
68
|
+
end
|
69
|
+
end
|
70
|
+
return sdiffs.empty?
|
71
|
+
else
|
72
|
+
return true # We already tested for false above
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
if __FILE__ == $0
|
77
|
+
run_debugger('testing', 'gcd1.rb')
|
78
|
+
end
|
@@ -0,0 +1,17 @@
|
|
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
|
+
|
8
|
+
def NO__test_it
|
9
|
+
name = File.basename(__FILE__, '.rb')[5..-1]
|
10
|
+
no_error = run_debugger(name, 'step-bug.rb')
|
11
|
+
assert_equal(true, no_error)
|
12
|
+
if no_error
|
13
|
+
outfile = File.join(File.dirname(__FILE__), 'step-bug.out')
|
14
|
+
FileUtils.rm(outfile)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
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 '../../app/core'
|
4
|
+
require_relative '../../processor/mock'
|
5
|
+
require_relative '../../processor/main' # Have to include before frame!
|
6
|
+
# FIXME
|
7
|
+
require_relative '../../processor/frame'
|
8
|
+
|
9
|
+
|
10
|
+
module UnitHelper
|
11
|
+
|
12
|
+
def common_setup
|
13
|
+
@dbg = MockDebugger::MockDebugger.new(:nx => true)
|
14
|
+
@cmdproc = Trepan::CmdProcessor.new(@dbg)
|
15
|
+
@cmdproc.frame_initialize
|
16
|
+
@cmdproc.dbgr = @dbg
|
17
|
+
@cmds = @cmdproc.commands
|
18
|
+
|
19
|
+
def @cmdproc.errmsg(message, opts={})
|
20
|
+
@errmsgs << message
|
21
|
+
end
|
22
|
+
def @cmdproc.errmsgs
|
23
|
+
@errmsgs
|
24
|
+
end
|
25
|
+
def @cmdproc.msg(message, opts={})
|
26
|
+
@msgs << message
|
27
|
+
end
|
28
|
+
def @cmdproc.msgs
|
29
|
+
@msgs
|
30
|
+
end
|
31
|
+
def @cmdproc.section(message, opts={})
|
32
|
+
@msgs << message
|
33
|
+
end
|
34
|
+
reset_cmdproc_vars
|
35
|
+
end
|
36
|
+
module_function :common_setup
|
37
|
+
|
38
|
+
def reset_cmdproc_vars
|
39
|
+
@cmdproc.instance_variable_set('@msgs', [])
|
40
|
+
@cmdproc.instance_variable_set('@errmsgs', [])
|
41
|
+
end
|
42
|
+
module_function :reset_cmdproc_vars
|
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,29 @@
|
|
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?)
|
15
|
+
# assert_equal(1, b1.hits)
|
16
|
+
# assert_equal(b1.source_container, tf.source_container)
|
17
|
+
b1.enabled = false
|
18
|
+
assert_equal('b', b1.icon_char)
|
19
|
+
# assert_raises TypeError do
|
20
|
+
# Trepan::Breakpoint.new(iseq, iseq.iseq_size, :temp => true)
|
21
|
+
# end
|
22
|
+
# assert_raises TypeError do
|
23
|
+
# Trepan::Breakpoint.new(0, 5)
|
24
|
+
# end
|
25
|
+
# require_relative '../../lib/trepanning.rb'
|
26
|
+
b2 = Trepan::Breakpoint.new('temp brkpt', method, 2, 3, 0, :temp => true)
|
27
|
+
assert_equal('t', b2.icon_char)
|
28
|
+
end
|
29
|
+
end
|