rb8-trepanning 0.1.3-universal-ruby-1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/CHANGES +34 -0
- data/ChangeLog +875 -0
- data/README.textile +59 -0
- data/Rakefile +215 -0
- data/app/.gitignore +1 -0
- data/app/cmd_parse.kpeg +241 -0
- data/app/cmd_parse.rb +212 -0
- data/app/cmd_parser.rb +1948 -0
- data/app/complete.rb +79 -0
- data/app/default.rb +90 -0
- data/app/display.rb +148 -0
- data/app/eventbuffer.rb +147 -0
- data/app/frame.rb +166 -0
- data/app/irb.rb +114 -0
- data/app/options.rb +200 -0
- data/app/run.rb +74 -0
- data/app/util.rb +65 -0
- data/bin/.gitignore +1 -0
- data/bin/trepan8 +115 -0
- data/data/.gitignore +1 -0
- data/data/irbrc +41 -0
- data/interface/.gitignore +1 -0
- data/interface/base_intf.rb +109 -0
- data/interface/client.rb +82 -0
- data/interface/comcodes.rb +20 -0
- data/interface/script.rb +110 -0
- data/interface/server.rb +147 -0
- data/interface/user.rb +165 -0
- data/io/base_io.rb +148 -0
- data/io/input.rb +158 -0
- data/io/null_output.rb +46 -0
- data/io/string_array.rb +156 -0
- data/io/tcpclient.rb +129 -0
- data/io/tcpfns.rb +33 -0
- data/io/tcpserver.rb +141 -0
- data/lib/debugger.rb +8 -0
- data/lib/trepanning.rb +283 -0
- data/processor/.gitignore +1 -0
- data/processor/command-ruby-debug/breakpoints.rb +155 -0
- data/processor/command-ruby-debug/catchpoint.rb +55 -0
- data/processor/command-ruby-debug/condition.rb +49 -0
- data/processor/command-ruby-debug/control.rb +31 -0
- data/processor/command-ruby-debug/display.rb +120 -0
- data/processor/command-ruby-debug/enable.rb +202 -0
- data/processor/command-ruby-debug/frame.rb +199 -0
- data/processor/command-ruby-debug/help.rb +63 -0
- data/processor/command-ruby-debug/info.rb +359 -0
- data/processor/command-ruby-debug/method.rb +84 -0
- data/processor/command-ruby-debug/reload.rb +40 -0
- data/processor/command-ruby-debug/save.rb +90 -0
- data/processor/command-ruby-debug/set.rb +237 -0
- data/processor/command-ruby-debug/show.rb +251 -0
- data/processor/command-ruby-debug/source.rb +36 -0
- data/processor/command-ruby-debug/threads.rb +189 -0
- data/processor/command-ruby-debug/trace.rb +57 -0
- data/processor/command-ruby-debug/variables.rb +199 -0
- data/processor/command.rb +270 -0
- data/processor/command/.gitignore +1 -0
- data/processor/command/alias.rb +54 -0
- data/processor/command/backtrace.rb +123 -0
- data/processor/command/base/cmd.rb +177 -0
- data/processor/command/base/subcmd.rb +230 -0
- data/processor/command/base/submgr.rb +188 -0
- data/processor/command/base/subsubcmd.rb +128 -0
- data/processor/command/base/subsubmgr.rb +199 -0
- data/processor/command/break.rb +114 -0
- data/processor/command/catch.rb +71 -0
- data/processor/command/complete.rb +39 -0
- data/processor/command/continue.rb +57 -0
- data/processor/command/directory.rb +50 -0
- data/processor/command/disable.rb +85 -0
- data/processor/command/display.rb +78 -0
- data/processor/command/down.rb +54 -0
- data/processor/command/edit.rb +79 -0
- data/processor/command/enable.rb +48 -0
- data/processor/command/eval.rb +90 -0
- data/processor/command/exit.rb +66 -0
- data/processor/command/finish.rb +59 -0
- data/processor/command/frame.rb +97 -0
- data/processor/command/help.rb +230 -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/info.rb +28 -0
- data/processor/command/info_subcmd/.gitignore +1 -0
- data/processor/command/info_subcmd/args.rb +39 -0
- data/processor/command/info_subcmd/breakpoints.rb +80 -0
- data/processor/command/info_subcmd/catch.rb +36 -0
- data/processor/command/info_subcmd/files.rb +39 -0
- data/processor/command/info_subcmd/globals.rb +64 -0
- data/processor/command/info_subcmd/line.rb +30 -0
- data/processor/command/info_subcmd/locals.rb +69 -0
- data/processor/command/info_subcmd/macro.rb +62 -0
- data/processor/command/info_subcmd/program.rb +51 -0
- data/processor/command/info_subcmd/ruby.rb +57 -0
- data/processor/command/info_subcmd/source.rb +74 -0
- data/processor/command/info_subcmd/stack.rb +25 -0
- data/processor/command/info_subcmd/threads.rb +75 -0
- data/processor/command/kill.rb +78 -0
- data/processor/command/list.rb +117 -0
- data/processor/command/macro.rb +68 -0
- data/processor/command/next.rb +79 -0
- data/processor/command/parsetree.rb +56 -0
- data/processor/command/pp.rb +40 -0
- data/processor/command/pr.rb +37 -0
- data/processor/command/ps.rb +40 -0
- data/processor/command/restart.rb +86 -0
- data/processor/command/save.rb +58 -0
- data/processor/command/set.rb +47 -0
- data/processor/command/set_subcmd/.gitignore +1 -0
- data/processor/command/set_subcmd/abbrev.rb +25 -0
- data/processor/command/set_subcmd/auto.rb +27 -0
- data/processor/command/set_subcmd/auto_subcmd/.gitignore +1 -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/callstyle.rb +46 -0
- data/processor/command/set_subcmd/confirm.rb +24 -0
- data/processor/command/set_subcmd/debug.rb +47 -0
- data/processor/command/set_subcmd/different.rb +61 -0
- data/processor/command/set_subcmd/highlight.rb +43 -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/reload.rb +42 -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/buffer.rb +42 -0
- data/processor/command/set_subcmd/trace_subcmd/print.rb +41 -0
- data/processor/command/shell.rb +139 -0
- data/processor/command/show.rb +39 -0
- data/processor/command/show_subcmd/.gitignore +1 -0
- data/processor/command/show_subcmd/abbrev.rb +20 -0
- data/processor/command/show_subcmd/alias.rb +46 -0
- data/processor/command/show_subcmd/args.rb +34 -0
- data/processor/command/show_subcmd/auto.rb +28 -0
- data/processor/command/show_subcmd/auto_subcmd/eval.rb +27 -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/callstyle.rb +22 -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/directories.rb +22 -0
- data/processor/command/show_subcmd/highlight.rb +24 -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/reload.rb +18 -0
- data/processor/command/show_subcmd/timer.rb +18 -0
- data/processor/command/show_subcmd/trace.rb +29 -0
- data/processor/command/show_subcmd/trace_subcmd/buffer.rb +65 -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 +134 -0
- data/processor/command/step.rb +81 -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 +72 -0
- data/processor/default.rb +56 -0
- data/processor/display.rb +17 -0
- data/processor/eval.rb +113 -0
- data/processor/eventbuf.rb +105 -0
- data/processor/frame.rb +172 -0
- data/processor/help.rb +92 -0
- data/processor/helper.rb +76 -0
- data/processor/hook.rb +134 -0
- data/processor/load_cmds.rb +258 -0
- data/processor/location.rb +174 -0
- data/processor/main.rb +455 -0
- data/processor/mock.rb +136 -0
- data/processor/msg.rb +61 -0
- data/processor/processor.rb +674 -0
- data/processor/running.rb +168 -0
- data/processor/stepping.rb +18 -0
- data/processor/subcmd.rb +161 -0
- data/processor/validate.rb +355 -0
- data/processor/virtual.rb +34 -0
- data/test/data/.gitignore +1 -0
- data/test/data/break_bad.cmd +19 -0
- data/test/data/break_bad.right +29 -0
- data/test/data/break_loop_bug.cmd +5 -0
- data/test/data/break_loop_bug.right +15 -0
- data/test/data/dollar-0.right +2 -0
- data/test/data/dollar-0a.right +2 -0
- data/test/data/dollar-0b.right +2 -0
- data/test/data/edit.cmd +14 -0
- data/test/data/edit.right +24 -0
- data/test/data/file-with-space.cmd +6 -0
- data/test/data/file-with-space.right +4 -0
- data/test/data/printvar.cmd +17 -0
- data/test/data/printvar.right +31 -0
- data/test/data/raise.cmd +11 -0
- data/test/data/raise.right +19 -0
- data/test/data/source.cmd +5 -0
- data/test/data/source.right +18 -0
- data/test/data/stepping-1.9.right +50 -0
- data/test/data/stepping.cmd +21 -0
- data/test/data/stepping.right +48 -0
- data/test/data/trepan8-save.1 +6 -0
- data/test/example/bp_loop_issue.rb +3 -0
- data/test/example/break-bug.rb +7 -0
- data/test/example/brkpt-class-bug.rb +8 -0
- data/test/example/classes.rb +11 -0
- data/test/example/dollar-0.rb +5 -0
- data/test/example/except-bug1.rb +4 -0
- data/test/example/except-bug2.rb +7 -0
- data/test/example/file with space.rb +1 -0
- data/test/example/gcd.rb +18 -0
- data/test/example/info-var-bug.rb +47 -0
- data/test/example/info-var-bug2.rb +2 -0
- data/test/example/null.rb +1 -0
- data/test/example/pm-bug.rb +3 -0
- data/test/example/pm.rb +11 -0
- data/test/example/raise.rb +3 -0
- data/test/integration/.gitignore +4 -0
- data/test/integration/config.yaml +8 -0
- data/test/integration/helper.rb +154 -0
- data/test/integration/test-break_bad.rb +26 -0
- data/test/integration/test-dollar-0.rb +31 -0
- data/test/integration/test-edit.rb +17 -0
- data/test/integration/test-file-with-space.rb +26 -0
- data/test/integration/test-printvar.rb +17 -0
- data/test/integration/test-raise.rb +21 -0
- data/test/integration/test-source.rb +16 -0
- data/test/integration/test-stepping.rb +24 -0
- data/test/unit/.gitignore +1 -0
- data/test/unit/cmd-helper.rb +52 -0
- data/test/unit/mock-helper.rb +12 -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-frame.rb +32 -0
- data/test/unit/test-app-options.rb +92 -0
- data/test/unit/test-app-run.rb +14 -0
- data/test/unit/test-app-util.rb +44 -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 +23 -0
- data/test/unit/test-base-subsubcmd.rb +17 -0
- data/test/unit/test-cmd-alias.rb +48 -0
- data/test/unit/test-cmd-exit.rb +27 -0
- data/test/unit/test-cmd-help.rb +104 -0
- data/test/unit/test-cmd-kill.rb +46 -0
- data/test/unit/test-cmd-source.rb +34 -0
- data/test/unit/test-completion.rb +42 -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-hook.rb +30 -0
- data/test/unit/test-proc-load_cmds.rb +50 -0
- data/test/unit/test-proc-location.rb +79 -0
- data/test/unit/test-subcmd-help.rb +44 -0
- data/trepan8.gemspec +58 -0
- metadata +388 -0
@@ -0,0 +1 @@
|
|
1
|
+
puts 'Ha!'
|
data/test/example/gcd.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
class Lousy_inspect
|
2
|
+
attr_accessor :var
|
3
|
+
def inspect # An unhelpful inspect
|
4
|
+
throw "Foo" # Raises an exception
|
5
|
+
end
|
6
|
+
def initialize
|
7
|
+
@var = 'initialized'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
class Lousy_inspect_and_to_s
|
11
|
+
attr_accessor :var
|
12
|
+
def inspect # An unhelpful inspect
|
13
|
+
throw "Foo" # Raises an exception
|
14
|
+
end
|
15
|
+
def to_s # An unhelpful to_s
|
16
|
+
throw "bar" # Raises an exception
|
17
|
+
end
|
18
|
+
def initialize
|
19
|
+
@var = 'initialized' # Something to inspect
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Something that will be passed objects with
|
24
|
+
# bad inspect or to_s methods
|
25
|
+
class UnsuspectingClass
|
26
|
+
@@Const = 'A constant'
|
27
|
+
@@var = 'a class variable'
|
28
|
+
def initialize(a)
|
29
|
+
@a = a # "info locals" will try to use
|
30
|
+
# inspect or to_s here
|
31
|
+
@b = 5
|
32
|
+
end
|
33
|
+
end
|
34
|
+
def test_Lousy_inspect
|
35
|
+
x = Lousy_inspect.new
|
36
|
+
return x
|
37
|
+
end
|
38
|
+
def test_lousy_inspect_and_to_s
|
39
|
+
x = Lousy_inspect_and_to_s.new
|
40
|
+
return x
|
41
|
+
end
|
42
|
+
x = test_Lousy_inspect
|
43
|
+
y = test_lousy_inspect_and_to_s
|
44
|
+
UnsuspectingClass.new(10)
|
45
|
+
UnsuspectingClass.new(x)
|
46
|
+
UnsuspectingClass.new(y)
|
47
|
+
y = 2
|
@@ -0,0 +1 @@
|
|
1
|
+
# Nothing here. Move along.
|
data/test/example/pm.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# Do not commit personal changes here back to the repository. Create
|
2
|
+
# config.private.yaml which, if exists, is preferred to this one.
|
3
|
+
|
4
|
+
# either should be on the $PATH or use full path
|
5
|
+
ruby: ruby
|
6
|
+
|
7
|
+
# possibility to specify interpreter parameters
|
8
|
+
#ruby_params: -w
|
@@ -0,0 +1,154 @@
|
|
1
|
+
# Some common routines used in testing.
|
2
|
+
require 'test/unit'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'yaml'
|
5
|
+
# require 'diff/lcs'
|
6
|
+
# require 'diff/lcs/hunk'
|
7
|
+
|
8
|
+
# begin require 'rubygems' rescue LoadError end
|
9
|
+
# require 'ruby-debug'; Debugger.start
|
10
|
+
|
11
|
+
module TestHelper
|
12
|
+
|
13
|
+
module_function
|
14
|
+
def common_setup(file, testname=nil)
|
15
|
+
@srcdir = File.dirname(file)
|
16
|
+
@testname = testname || File.basename(file, '.rb').split(/-/)[1]
|
17
|
+
@script = File.join(%W(.. data #{@testname}.cmd))
|
18
|
+
@prefix = "--script #{@script} --nx --basename -- "
|
19
|
+
end
|
20
|
+
|
21
|
+
# FIXME: turn args into a hash.
|
22
|
+
def run_debugger(testname, args='', outfile=nil, filter=nil, old_code=false,
|
23
|
+
debug_pgm='tdebug.rb', rightfile=nil)
|
24
|
+
rightfile ||= File.join(%W(.. data #{testname}.right))
|
25
|
+
|
26
|
+
outfile = "#{testname}.out" unless outfile
|
27
|
+
|
28
|
+
if File.exists?(outfile)
|
29
|
+
FileUtils.rm(outfile)
|
30
|
+
end
|
31
|
+
|
32
|
+
ENV['TREPAN8'] = debug_pgm
|
33
|
+
ENV['TERM'] = ''
|
34
|
+
|
35
|
+
# The EMACS environment variable(s) cause output to
|
36
|
+
# get prefaced with null which will mess up file compares.
|
37
|
+
# So turn off EMACS output processing.
|
38
|
+
ENV['EMACS'] = ENV['INSIDE_EMACS'] = nil
|
39
|
+
|
40
|
+
cmd = "#{load_ruby} #{load_params} " +
|
41
|
+
"../../bin/trepan8 #{args} >#{outfile}"
|
42
|
+
puts "'#{cmd}'" if $DEBUG
|
43
|
+
output = `#{cmd}`
|
44
|
+
|
45
|
+
got_lines = File.read(outfile).split(/\n/)
|
46
|
+
correct_lines = File.read(rightfile).split(/\n/)
|
47
|
+
filter.call(got_lines, correct_lines) if filter
|
48
|
+
if cheap_diff(got_lines, correct_lines)
|
49
|
+
FileUtils.rm(outfile)
|
50
|
+
return true
|
51
|
+
end
|
52
|
+
return false
|
53
|
+
end
|
54
|
+
|
55
|
+
def cheap_diff(got_lines, correct_lines)
|
56
|
+
if $DEBUG
|
57
|
+
got_lines.each_with_index do |line, i|
|
58
|
+
printf "%3d %s\n", i+1, line
|
59
|
+
end
|
60
|
+
end
|
61
|
+
correct_lines.each_with_index do |line, i|
|
62
|
+
correct_lines[i].chomp!
|
63
|
+
if got_lines[i] != correct_lines[i]
|
64
|
+
puts "difference found at line #{i+1}"
|
65
|
+
puts "got : #{got_lines[i]}"
|
66
|
+
puts "need: #{correct_lines[i]}"
|
67
|
+
return false
|
68
|
+
end
|
69
|
+
end
|
70
|
+
if correct_lines.size != got_lines.size
|
71
|
+
puts("difference in number of lines: " +
|
72
|
+
"#{correct_lines.size} vs. #{got_lines.size}")
|
73
|
+
return false
|
74
|
+
end
|
75
|
+
return true
|
76
|
+
end
|
77
|
+
|
78
|
+
# FIXME: using this causes the same test to get run several times
|
79
|
+
# and some tests fail probably because of a lack of environment isolation.
|
80
|
+
# Many tests follow a basic pattern: run the debugger with a given
|
81
|
+
# debugger script and compare output produced. The following creates
|
82
|
+
# this kind of test.
|
83
|
+
def add_test(base_name, src_dir, script_name=nil, cmd=nil, test_name=nil)
|
84
|
+
puts "+++ Adding #{base_name} ++++" if $DEBUG
|
85
|
+
test_name = File.join('.', 'example', base_name) unless test_name
|
86
|
+
script_name = File.join(%W(.. data ../#{test_name}.cmd)) unless script_name
|
87
|
+
p script_name
|
88
|
+
cmd = 'gcd.rb 3 5' unless cmd
|
89
|
+
eval <<-EOF
|
90
|
+
def test_#{test_name}
|
91
|
+
Dir.chdir(\"#{src_dir}\") do
|
92
|
+
assert_equal(true,
|
93
|
+
run_debugger(\"#{base_name}\",
|
94
|
+
\"--script #{script_name} -- #{cmd}\"))
|
95
|
+
end
|
96
|
+
end
|
97
|
+
EOF
|
98
|
+
end
|
99
|
+
module_function :add_test
|
100
|
+
|
101
|
+
# Adapted from the Ruby Cookbook, Section 6.10: Comparing two files.
|
102
|
+
# def diff_as_string(rightfile, checkfile, format=:unified, context_lines=3)
|
103
|
+
# right_data = File.read(rightfile)
|
104
|
+
# check_data = File.read(checkfile)
|
105
|
+
# output = ''
|
106
|
+
# diffs = Diff::LCS.diff(right_data, check_data)
|
107
|
+
# return output if diffs.empty?
|
108
|
+
# oldhunk = hunk = nil
|
109
|
+
# file_length_difference = 0
|
110
|
+
# diffs.each do |piece|
|
111
|
+
# begin
|
112
|
+
# hunk = Diff::LCS::Hunk.new(right_data, check_data, piece,
|
113
|
+
# context_lines, file_length_difference)
|
114
|
+
# next unless oldhunk
|
115
|
+
#
|
116
|
+
# # Hunks may overlap, which is why we need to be careful when our
|
117
|
+
# # diff includes lines of context. Otherwise, we might print
|
118
|
+
# # redundant lines.
|
119
|
+
# if (context_lines > 0) and hunk.overlaps?(oldhunk)
|
120
|
+
# hunk.unshift(oldhunk)
|
121
|
+
# else
|
122
|
+
# output << oldhunk.diff(format)
|
123
|
+
# end
|
124
|
+
# ensure
|
125
|
+
# oldhunk = hunk
|
126
|
+
# output << '\n'
|
127
|
+
# end
|
128
|
+
# end
|
129
|
+
|
130
|
+
# # Handle the last remaining hunk
|
131
|
+
# output << oldhunk.diff(format) << '\n'
|
132
|
+
# end
|
133
|
+
|
134
|
+
# Loads key from the _config_._yaml_ file.
|
135
|
+
def config_load(key, may_be_nil=false, default_value='')
|
136
|
+
conf = File.join('config.private.yaml') # try private first
|
137
|
+
conf = File.join('config.yaml') unless File.exists?(conf)
|
138
|
+
value = YAML.load_file(conf)[key]
|
139
|
+
assert_not_nil(value, "#{key} is set in config.yaml") unless may_be_nil
|
140
|
+
value || default_value
|
141
|
+
end
|
142
|
+
module_function :config_load
|
143
|
+
|
144
|
+
def load_ruby
|
145
|
+
config_load('ruby', true)
|
146
|
+
end
|
147
|
+
module_function :load_ruby
|
148
|
+
|
149
|
+
def load_params
|
150
|
+
config_load('ruby_params', true)
|
151
|
+
end
|
152
|
+
module_function :load_params
|
153
|
+
end
|
154
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'; require 'require_relative'
|
3
|
+
# require_relative '../../lib/trepanning'
|
4
|
+
require_relative 'helper'
|
5
|
+
|
6
|
+
# Test (mostly) invalid breakpoint commands
|
7
|
+
class TestBadBreak < Test::Unit::TestCase
|
8
|
+
include TestHelper
|
9
|
+
def test_basic
|
10
|
+
common_setup(__FILE__)
|
11
|
+
Dir.chdir(@srcdir) do
|
12
|
+
assert_equal(true,
|
13
|
+
run_debugger(@testname, @prefix + '../example/gcd.rb 3 5'))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_break_loop
|
18
|
+
common_setup(__FILE__, 'break_loop_bug')
|
19
|
+
Dir.chdir(@srcdir) do
|
20
|
+
assert_equal(true,
|
21
|
+
run_debugger(@testname, @prefix +
|
22
|
+
'../example/bp_loop_issue.rb'))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'; require 'require_relative'
|
3
|
+
# require_relative '../../lib/trepanning'
|
4
|
+
require_relative 'helper'
|
5
|
+
|
6
|
+
# Test --no-stop and $0 setting.
|
7
|
+
class TestDollar0 < Test::Unit::TestCase
|
8
|
+
include TestHelper
|
9
|
+
def test_basic
|
10
|
+
common_setup(__FILE__)
|
11
|
+
Dir.chdir(@srcdir) do
|
12
|
+
home_save = ENV['HOME']
|
13
|
+
ENV['HOME'] = '.'
|
14
|
+
filter = Proc.new{|got_lines, correct_lines|
|
15
|
+
[got_lines, correct_lines].flatten.each do |s|
|
16
|
+
s.gsub!(/.*dollar-0.rb$/, 'dollar-0.rb')
|
17
|
+
end
|
18
|
+
}
|
19
|
+
|
20
|
+
@prefix = '--nx --basename --no-stop '
|
21
|
+
%w(dollar-0 dollar-0a dollar-0b).each do |testname|
|
22
|
+
assert_equal(true,
|
23
|
+
run_debugger(testname,
|
24
|
+
@prefix +
|
25
|
+
File.join(%w(.. example dollar-0.rb)),
|
26
|
+
nil, filter, false, '../bin/trepan8'))
|
27
|
+
end
|
28
|
+
ENV['HOME'] = home_save
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'; require 'require_relative'
|
3
|
+
# require_relative '../../lib/trepanning'
|
4
|
+
require_relative 'helper'
|
5
|
+
|
6
|
+
# Test 'edit' command handling.
|
7
|
+
class TestEdit < Test::Unit::TestCase
|
8
|
+
include TestHelper
|
9
|
+
def test_basic
|
10
|
+
common_setup(__FILE__)
|
11
|
+
Dir.chdir(@srcdir) do
|
12
|
+
ENV['EDITOR']='echo FAKE-EDITOR '
|
13
|
+
assert_equal(true,
|
14
|
+
run_debugger(@testname, @prefix + '../example/gcd.rb 3 5'))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'; require 'require_relative'
|
3
|
+
# require_relative '../../lib/trepanning'
|
4
|
+
require_relative 'helper'
|
5
|
+
|
6
|
+
# Test Running a program wiht an embedded space
|
7
|
+
class TestFileWithSpace < Test::Unit::TestCase
|
8
|
+
include TestHelper
|
9
|
+
|
10
|
+
def test_basic
|
11
|
+
testname='file-with-space'
|
12
|
+
common_setup(__FILE__)
|
13
|
+
Dir.chdir(@srcdir) do
|
14
|
+
script = File.join(%W(.. data #{testname}.cmd))
|
15
|
+
# filter = Proc.new{|got_lines, correct_lines|
|
16
|
+
# [got_lines[0], correct_lines[0]].each do |s|
|
17
|
+
# s.sub!(/tdebug.rb:\d+/, 'rdebug:999')
|
18
|
+
# end
|
19
|
+
# }
|
20
|
+
assert_equal(true,
|
21
|
+
run_debugger(testname,
|
22
|
+
"--script #{script} --nx --basename -- " +
|
23
|
+
"'../example/file with space.rb'"))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'; require 'require_relative'
|
3
|
+
# require_relative '../../lib/trepanning'
|
4
|
+
require_relative 'helper'
|
5
|
+
|
6
|
+
# Test printing (evaluation) of variables
|
7
|
+
class TestPrintVar < Test::Unit::TestCase
|
8
|
+
include TestHelper
|
9
|
+
# Test commands in stepping.rb
|
10
|
+
def test_basic
|
11
|
+
common_setup(__FILE__)
|
12
|
+
Dir.chdir(@srcdir) do
|
13
|
+
assert_equal(true,
|
14
|
+
run_debugger(@testname, @prefix + '../example/gcd.rb 3 5'))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'; require 'require_relative'
|
3
|
+
# require_relative '../../lib/trepanning'
|
4
|
+
require_relative 'helper'
|
5
|
+
|
6
|
+
# begin require 'rubygems' rescue LoadError end
|
7
|
+
# require 'ruby-debug'; Debugger.start
|
8
|
+
|
9
|
+
# Test Debugger.load handles uncaught exceptions in the debugged program.
|
10
|
+
class TestRaise < Test::Unit::TestCase
|
11
|
+
include TestHelper
|
12
|
+
def test_basic
|
13
|
+
skip "We get a SEGV here on an unpatched 1.9.2" if
|
14
|
+
RUBY_VERSION =~ /1.9/
|
15
|
+
common_setup(__FILE__)
|
16
|
+
Dir.chdir(@srcdir) do
|
17
|
+
assert_equal(true,
|
18
|
+
run_debugger(@testname, @prefix + '../example/raise.rb'))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|