ruby-debug 0.10.5.rc1 → 0.10.5.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +54 -0
- data/Rakefile +34 -239
- metadata +15 -182
- data/test/base/base.rb +0 -77
- data/test/base/binding.rb +0 -22
- data/test/base/catchpoint.rb +0 -19
- data/test/base/load.rb +0 -44
- data/test/base/reload_bug.rb +0 -8
- data/test/cli/commands/catchpoint_test.rb +0 -24
- data/test/cli/commands/unit/regexp.rb +0 -36
- data/test/config.yaml +0 -8
- data/test/data/annotate.cmd +0 -29
- data/test/data/annotate.right +0 -139
- data/test/data/at-exit.cmd +0 -4
- data/test/data/at-exit.right +0 -12
- data/test/data/break_bad.cmd +0 -16
- data/test/data/break_bad.right +0 -26
- data/test/data/break_loop_bug.cmd +0 -5
- data/test/data/break_loop_bug.right +0 -15
- data/test/data/break_tracelines.cmd +0 -9
- data/test/data/break_tracelines.right +0 -17
- data/test/data/breakpoints-basename.cmd +0 -2
- data/test/data/breakpoints-basename.right +0 -10
- data/test/data/breakpoints.cmd +0 -37
- data/test/data/breakpoints.right +0 -96
- data/test/data/brkpt-class-bug.cmd +0 -9
- data/test/data/brkpt-class-bug.right +0 -18
- data/test/data/catch.cmd +0 -18
- data/test/data/catch.right +0 -41
- data/test/data/condition.cmd +0 -29
- data/test/data/condition.right +0 -67
- data/test/data/continue_bad.cmd +0 -4
- data/test/data/continue_bad.right +0 -9
- data/test/data/ctrl.cmd +0 -23
- data/test/data/ctrl.right +0 -70
- data/test/data/display.cmd +0 -24
- data/test/data/display.right +0 -44
- data/test/data/dollar-0.right +0 -3
- data/test/data/dollar-0a.right +0 -3
- data/test/data/dollar-0b.right +0 -3
- data/test/data/edit.cmd +0 -12
- data/test/data/edit.right +0 -19
- data/test/data/emacs_basic.cmd +0 -10
- data/test/data/emacs_basic.right +0 -24
- data/test/data/enable.cmd +0 -20
- data/test/data/enable.right +0 -36
- data/test/data/except-bug1.cmd +0 -7
- data/test/data/except-bug1.right +0 -13
- data/test/data/file-with-space.cmd +0 -7
- data/test/data/file-with-space.right +0 -9
- data/test/data/finish.cmd +0 -16
- data/test/data/finish.right +0 -31
- data/test/data/frame.cmd +0 -29
- data/test/data/frame.right +0 -62
- data/test/data/help.cmd +0 -20
- data/test/data/help.right +0 -21
- data/test/data/history.right +0 -7
- data/test/data/info-file-break.cmd +0 -4
- data/test/data/info-file-break.right +0 -11
- data/test/data/info-thread.cmd +0 -13
- data/test/data/info-thread.right +0 -37
- data/test/data/info-var-bug2.cmd +0 -5
- data/test/data/info-var-bug2.right +0 -10
- data/test/data/info-var.cmd +0 -23
- data/test/data/info-var.right +0 -52
- data/test/data/info.cmd +0 -21
- data/test/data/info.right +0 -80
- data/test/data/linetrace-jruby.right +0 -23
- data/test/data/linetrace.cmd +0 -6
- data/test/data/linetrace.right +0 -32
- data/test/data/linetracep.cmd +0 -7
- data/test/data/linetracep.right +0 -25
- data/test/data/list.cmd +0 -19
- data/test/data/list.right +0 -127
- data/test/data/method.cmd +0 -10
- data/test/data/method.right +0 -21
- data/test/data/methodsig.cmd +0 -10
- data/test/data/methodsig.right +0 -20
- data/test/data/noquit.right +0 -1
- data/test/data/output.cmd +0 -6
- data/test/data/output.right +0 -31
- data/test/data/pm-bug.cmd +0 -7
- data/test/data/pm-bug.right +0 -12
- data/test/data/post-mortem-next.cmd +0 -8
- data/test/data/post-mortem-next.right +0 -14
- data/test/data/post-mortem-osx.right +0 -32
- data/test/data/post-mortem.cmd +0 -13
- data/test/data/post-mortem.right +0 -32
- data/test/data/quit.cmd +0 -6
- data/test/data/quit.right +0 -9
- data/test/data/raise-jruby.right +0 -26
- data/test/data/raise.cmd +0 -11
- data/test/data/raise.right +0 -26
- data/test/data/save.cmd +0 -34
- data/test/data/save.right +0 -61
- data/test/data/setshow.cmd +0 -46
- data/test/data/setshow.right +0 -80
- data/test/data/source.cmd +0 -5
- data/test/data/source.right +0 -15
- data/test/data/stepping.cmd +0 -21
- data/test/data/stepping.right +0 -50
- data/test/data/test-init-cygwin.right +0 -7
- data/test/data/test-init-osx.right +0 -4
- data/test/data/test-init.right +0 -5
- data/test/data/trace-jruby.right +0 -14
- data/test/data/trace.right +0 -23
- data/test/example/a/example.rb +0 -1
- data/test/example/at-exit.rb +0 -3
- data/test/example/b/example.rb +0 -1
- data/test/example/bp_loop_issue.rb +0 -3
- data/test/example/breakpoints-basename.rb +0 -2
- data/test/example/brkpt-class-bug.rb +0 -8
- data/test/example/classes.rb +0 -11
- data/test/example/dollar-0.rb +0 -6
- data/test/example/except-bug1.rb +0 -4
- data/test/example/file with space.rb +0 -1
- data/test/example/gcd.rb +0 -18
- data/test/example/info-var-bug.rb +0 -47
- data/test/example/info-var-bug2.rb +0 -2
- data/test/example/null.rb +0 -1
- data/test/example/output.rb +0 -2
- data/test/example/pm-bug.rb +0 -3
- data/test/example/pm.rb +0 -11
- data/test/example/raise.rb +0 -3
- data/test/gcd-dbg-nox.rb +0 -31
- data/test/gcd-dbg.rb +0 -30
- data/test/helper.rb +0 -167
- data/test/pm-base.rb +0 -22
- data/test/rdebug-save.1 +0 -7
- data/test/tdebug.rb +0 -252
- data/test/test-annotate.rb +0 -13
- data/test/test-at-exit.rb +0 -13
- data/test/test-break-bad.rb +0 -25
- data/test/test-breakpoints.rb +0 -24
- data/test/test-brkpt-class-bug.rb +0 -13
- data/test/test-catch.rb +0 -13
- data/test/test-condition.rb +0 -13
- data/test/test-ctrl.rb +0 -55
- data/test/test-display.rb +0 -14
- data/test/test-dollar-0.rb +0 -33
- data/test/test-edit.rb +0 -14
- data/test/test-emacs-basic.rb +0 -13
- data/test/test-enable.rb +0 -13
- data/test/test-except-bug1.rb +0 -16
- data/test/test-file-with-space.rb +0 -18
- data/test/test-finish.rb +0 -22
- data/test/test-frame.rb +0 -28
- data/test/test-help.rb +0 -60
- data/test/test-hist.rb +0 -64
- data/test/test-info-thread.rb +0 -24
- data/test/test-info-var.rb +0 -30
- data/test/test-info.rb +0 -27
- data/test/test-init.rb +0 -49
- data/test/test-list.rb +0 -14
- data/test/test-method.rb +0 -20
- data/test/test-output.rb +0 -13
- data/test/test-pm.rb +0 -37
- data/test/test-quit.rb +0 -13
- data/test/test-raise.rb +0 -13
- data/test/test-save.rb +0 -22
- data/test/test-setshow.rb +0 -13
- data/test/test-source.rb +0 -13
- data/test/test-stepping.rb +0 -14
- data/test/test-trace.rb +0 -40
- data/test/thread1.rb +0 -26
- data/test/trunc-call.rb +0 -31
data/test/test-info-thread.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test simple thread commands
|
5
|
-
class TestInfoThread < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname='info-thread'
|
10
|
-
filter = Proc.new{|got_lines, correct_lines|
|
11
|
-
[got_lines, correct_lines].each do |a|
|
12
|
-
a.each do |s|
|
13
|
-
s.gsub!(/Thread:0x[0-9a-f]+/, 'Thread:0x12345678')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
got_lines.each do |s|
|
17
|
-
s.gsub!(/run>[ \t]+.*gcd.rb:4/, "run> gcd.rb:4")
|
18
|
-
end
|
19
|
-
}
|
20
|
-
script = File.join('data', testname + '.cmd')
|
21
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5",
|
22
|
-
:filter => filter))
|
23
|
-
end
|
24
|
-
end
|
data/test/test-info-var.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test info variables command
|
5
|
-
class TestInfoVar < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_info_variables
|
9
|
-
filter = Proc.new{|got_lines, correct_lines|
|
10
|
-
[got_lines[13-1], correct_lines[13-1]].each do |s|
|
11
|
-
s.sub!(/Mine:0x[0-9,a-f]+/, 'Mine:')
|
12
|
-
end
|
13
|
-
[got_lines, correct_lines].each do |a|
|
14
|
-
a.each do |s|
|
15
|
-
s.sub!(/Lousy_inspect:0x[0-9,a-f]+/, 'Lousy_inspect:')
|
16
|
-
s.sub!(/UnsuspectingClass:0x[0-9,a-f]+/, 'UnsuspectingClass:')
|
17
|
-
end
|
18
|
-
end
|
19
|
-
}
|
20
|
-
|
21
|
-
testname='info-var'
|
22
|
-
script = File.join('data', testname + '.cmd')
|
23
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/info-var-bug.rb",
|
24
|
-
:filter => filter))
|
25
|
-
|
26
|
-
testname='info-var-bug2'
|
27
|
-
script = File.join('data', testname + '.cmd')
|
28
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/info-var-bug2.rb"))
|
29
|
-
end
|
30
|
-
end
|
data/test/test-info.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test info commands
|
5
|
-
class TestInfo < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
# Test commands in info.rb
|
9
|
-
def test_basic
|
10
|
-
testname='info'
|
11
|
-
filter = Proc.new{|got_lines, correct_lines|
|
12
|
-
got_lines.each do |s|
|
13
|
-
s.gsub!(/Line 4 of ".*gcd.rb"/, 'Line 4 of "gcd.rb"')
|
14
|
-
end
|
15
|
-
}
|
16
|
-
|
17
|
-
script = File.join('data', testname + '.cmd')
|
18
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5",
|
19
|
-
:filter => filter))
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_file_break
|
23
|
-
testname='info-file-break'
|
24
|
-
script = File.join('data', testname + '.cmd')
|
25
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5"))
|
26
|
-
end unless defined?(JRUBY_VERSION) # JRuby doesn't yet support tracelines
|
27
|
-
end
|
data/test/test-init.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'test/unit'
|
3
|
-
require 'rbconfig'
|
4
|
-
|
5
|
-
ROOT_DIR=File.dirname(__FILE__)
|
6
|
-
require File.join(ROOT_DIR, 'helper.rb')
|
7
|
-
|
8
|
-
# begin require 'rubygems' rescue LoadError end
|
9
|
-
# require 'ruby-debug'; Debugger.start
|
10
|
-
|
11
|
-
# Test Debugger.init and setting up ruby-debug variables
|
12
|
-
class TestDebuggerInit < Test::Unit::TestCase
|
13
|
-
@@SRC_DIR = File.dirname(__FILE__) unless
|
14
|
-
defined?(@@SRC_DIR)
|
15
|
-
def test_basic
|
16
|
-
unless File.exist?(File.join(ROOT_DIR, 'ext'))
|
17
|
-
puts "Skipping test #{__FILE__}"
|
18
|
-
return
|
19
|
-
end
|
20
|
-
debugger_output = 'test-init.out'
|
21
|
-
Dir.chdir(@@SRC_DIR) do
|
22
|
-
old_emacs = ENV['EMACS']
|
23
|
-
old_columns = ENV['COLUMNS']
|
24
|
-
ENV['EMACS'] = nil
|
25
|
-
ENV['COLUMNS'] = '120'
|
26
|
-
ruby = "#{TestHelper.load_ruby} #{TestHelper.load_params}"
|
27
|
-
IO.popen("#{ruby} ./gcd-dbg.rb 5 >#{debugger_output}", 'w') do |pipe|
|
28
|
-
pipe.puts 'p Debugger::PROG_SCRIPT'
|
29
|
-
pipe.puts 'show args'
|
30
|
-
pipe.puts 'quit unconditionally'
|
31
|
-
end
|
32
|
-
lines = File.open(debugger_output).readlines
|
33
|
-
ENV['EMACS'] = old_emacs
|
34
|
-
ENV['COLUMNS'] = old_columns
|
35
|
-
|
36
|
-
right_file = case Config::CONFIG['host_os']
|
37
|
-
when /^darwin/
|
38
|
-
'test-init-osx.right'
|
39
|
-
when /^cygwin/
|
40
|
-
'test-init-cygwin.right'
|
41
|
-
else
|
42
|
-
'test-init.right'
|
43
|
-
end
|
44
|
-
expected = File.open(File.join('data', right_file)).readlines
|
45
|
-
assert_equal(expected, lines)
|
46
|
-
File.delete(debugger_output) if expected == lines
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
data/test/test-list.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test List commands
|
5
|
-
class TestList < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
# Test commands in list.rb
|
9
|
-
def test_basic
|
10
|
-
testname='list'
|
11
|
-
script = File.join('data', testname + '.cmd')
|
12
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5"))
|
13
|
-
end
|
14
|
-
end
|
data/test/test-method.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
class TestMethod < Test::Unit::TestCase
|
5
|
-
include TestHelper
|
6
|
-
|
7
|
-
def test_basic
|
8
|
-
testname='method'
|
9
|
-
script = File.join('data', testname + '.cmd')
|
10
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/classes.rb"))
|
11
|
-
begin
|
12
|
-
require 'methodsig'
|
13
|
-
testname='methodsig'
|
14
|
-
script = File.join('data', testname + '.cmd')
|
15
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/classes.rb"))
|
16
|
-
rescue LoadError
|
17
|
-
puts "Skipping method sig test"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/test/test-output.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test 'starting' annotation.
|
5
|
-
class TestStartingAnnotate < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname='output'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
assert(run_debugger(testname, "-A 3 --script #{script} -- ./example/output.rb"))
|
12
|
-
end
|
13
|
-
end
|
data/test/test-pm.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test Post-mortem command
|
5
|
-
class TestPM < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
# Test post-mortem handling
|
9
|
-
def test_basic
|
10
|
-
# filter = Proc.new{|got_lines, correct_lines|
|
11
|
-
# [got_lines[0], correct_lines[0]].each do |s|
|
12
|
-
# s.sub!(/tdebug.rb:\d+/, 'rdebug:999')
|
13
|
-
# end
|
14
|
-
# }
|
15
|
-
ENV['COLUMNS'] = '80'
|
16
|
-
testname='post-mortem'
|
17
|
-
script = File.join('data', testname + '.cmd')
|
18
|
-
testname += '-osx' if Config::CONFIG['host_os'] =~ /^darwin/
|
19
|
-
assert(run_debugger(testname, "--script #{script} --post-mortem ./example/pm.rb"))
|
20
|
-
end
|
21
|
-
|
22
|
-
# Test post-mortem handling
|
23
|
-
def test_pm_next
|
24
|
-
ENV['COLUMNS'] = '80'
|
25
|
-
testname='post-mortem-next'
|
26
|
-
script = File.join('data', testname + '.cmd')
|
27
|
-
assert(run_debugger(testname, "--script #{script} --post-mortem ./example/pm.rb"))
|
28
|
-
end
|
29
|
-
|
30
|
-
# Test Tracker #22118 post-mortem giving an error in show internal variables
|
31
|
-
def test_pm_iv_bug
|
32
|
-
ENV['COLUMNS'] = '80'
|
33
|
-
testname='pm-bug'
|
34
|
-
script = File.join('data', testname + '.cmd')
|
35
|
-
assert(run_debugger(testname, "--script #{script} --post-mortem example/pm-bug.rb"))
|
36
|
-
end
|
37
|
-
end unless defined?(JRUBY_VERSION) # post-mortem not yet supported on JRuby
|
data/test/test-quit.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test Quit command
|
5
|
-
class TestQuit < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname='quit'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb"))
|
12
|
-
end
|
13
|
-
end
|
data/test/test-raise.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test Debugger.load handles uncaught exceptions in the debugged program.
|
5
|
-
class TestRaise < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname='raise'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/raise.rb"))
|
12
|
-
end
|
13
|
-
end
|
data/test/test-save.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
class TestSave < Test::Unit::TestCase
|
5
|
-
include TestHelper
|
6
|
-
|
7
|
-
# Test initial variables and setting/getting state.
|
8
|
-
def test_basic
|
9
|
-
testname='save'
|
10
|
-
filter = Proc.new{|got_lines, correct_lines|
|
11
|
-
got_lines.each do |s|
|
12
|
-
s.gsub!(/(\d+) file .*gcd.rb/, '\1 file gcd.rb')
|
13
|
-
end
|
14
|
-
got_lines.each do |s|
|
15
|
-
s.gsub!(/break .*gcd.rb:10/, "break gcd.rb:10")
|
16
|
-
end
|
17
|
-
}
|
18
|
-
script = File.join('data', testname + '.cmd')
|
19
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5",
|
20
|
-
:filter => filter))
|
21
|
-
end
|
22
|
-
end
|
data/test/test-setshow.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
class TestSetShow < Test::Unit::TestCase
|
5
|
-
include TestHelper
|
6
|
-
|
7
|
-
# Test initial variables and setting/getting state.
|
8
|
-
def test_basic
|
9
|
-
testname='setshow'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5"))
|
12
|
-
end
|
13
|
-
end
|
data/test/test-source.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test 'source' command handling.
|
5
|
-
class TestSource < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname='source'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5"))
|
12
|
-
end
|
13
|
-
end
|
data/test/test-stepping.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test that linetracing does something.
|
5
|
-
class TestStepping < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
# Test commands in stepping.rb
|
9
|
-
def test_basic
|
10
|
-
testname='stepping'
|
11
|
-
script = File.join('data', testname + '.cmd')
|
12
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5"))
|
13
|
-
end
|
14
|
-
end
|
data/test/test-trace.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
class TestTrace < Test::Unit::TestCase
|
5
|
-
include TestHelper
|
6
|
-
|
7
|
-
def test_trace_option
|
8
|
-
filter = Proc.new{|got_lines, correct_lines|
|
9
|
-
got_lines.collect!{|l| l =~ /gcd\.rb:/? l : nil}.compact!
|
10
|
-
got_lines.each do |s|
|
11
|
-
s.gsub!(/:.*gcd.rb:/, ':gcd.rb:')
|
12
|
-
end
|
13
|
-
}
|
14
|
-
|
15
|
-
assert(run_debugger("trace", "-nx --trace ./example/gcd.rb 3 5",
|
16
|
-
:filter => filter))
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_linetrace_command
|
20
|
-
filter = Proc.new{|got_lines, correct_lines|
|
21
|
-
got_lines.reject! {|l| l =~ /:(rdbg|linecache)\.rb:/ }
|
22
|
-
}
|
23
|
-
|
24
|
-
testname = 'linetrace'
|
25
|
-
script = File.join('data', testname + '.cmd')
|
26
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5",
|
27
|
-
:filter => filter))
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_linetrace_plus_command
|
31
|
-
filter = Proc.new{|got_lines, correct_lines|
|
32
|
-
got_lines.reject! {|l| l =~ /:(rdbg|linecache)\.rb:/ }
|
33
|
-
}
|
34
|
-
|
35
|
-
testname = 'linetracep'
|
36
|
-
script = File.join('data', testname + '.cmd')
|
37
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5",
|
38
|
-
:filter => filter))
|
39
|
-
end
|
40
|
-
end
|
data/test/thread1.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# Adapted from Programming Ruby 2nd Ed. p. 138
|
3
|
-
require 'rubygems'
|
4
|
-
|
5
|
-
unless defined?(Debugger)
|
6
|
-
puts "This program has to be called from the debugger"
|
7
|
-
exit 1
|
8
|
-
end
|
9
|
-
|
10
|
-
def fn(count, i)
|
11
|
-
sleep(rand(0.1))
|
12
|
-
if 4 == i
|
13
|
-
debugger
|
14
|
-
end
|
15
|
-
Thread.current['mycount'] = count
|
16
|
-
end
|
17
|
-
|
18
|
-
count = 0
|
19
|
-
threads = []
|
20
|
-
5.times do |i|
|
21
|
-
threads[i] = Thread.new do
|
22
|
-
fn(count, i)
|
23
|
-
count += 1
|
24
|
-
end
|
25
|
-
end
|
26
|
-
threads.each {|t| t.join }
|
data/test/trunc-call.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This program is used to test that 'restart' works when we didn't call
|
3
|
-
# the debugger initially.
|
4
|
-
|
5
|
-
TOP_SRC_DIR = File.join(File.expand_path(File.dirname(__FILE__), "..")) unless
|
6
|
-
defined?(TOP_SRC_DIR)
|
7
|
-
|
8
|
-
$:.unshift File.join(TOP_SRC_DIR, "ext")
|
9
|
-
$:.unshift File.join(TOP_SRC_DIR, "lib")
|
10
|
-
$:.unshift File.join(TOP_SRC_DIR, "cli")
|
11
|
-
require 'ruby-debug'
|
12
|
-
|
13
|
-
# GCD. We assume positive numbers
|
14
|
-
def gcd(a, b)
|
15
|
-
# Make: a <= b
|
16
|
-
if a > b
|
17
|
-
a, b = [b, a]
|
18
|
-
end
|
19
|
-
if a==3
|
20
|
-
Debugger.debugger
|
21
|
-
end
|
22
|
-
|
23
|
-
return nil if a <= 0
|
24
|
-
|
25
|
-
if a == 1 or b-a == 0
|
26
|
-
return a
|
27
|
-
end
|
28
|
-
return gcd(b-a, a)
|
29
|
-
end
|
30
|
-
|
31
|
-
gcd(13,8)
|