trepanning 1.93.35 → 2.15.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ChangeLog +491 -55
- data/LICENSE +1 -1
- data/NEWS +18 -14
- data/README.md +5 -22
- data/Rakefile +22 -1
- data/app/breakpoint.rb +5 -3
- data/app/core.rb +147 -179
- data/app/default.rb +47 -46
- data/app/file.rb +6 -7
- data/app/frame.rb +183 -176
- data/app/markdown.rb +2 -9
- data/app/options.rb +1 -1
- data/app/run.rb +71 -37
- data/interface/script.rb +8 -8
- data/io.rb +19 -20
- data/lib/trepanning.rb +292 -297
- data/processor.rb +332 -344
- data/processor/breakpoint.rb +98 -96
- data/processor/command/base/submgr.rb +9 -9
- data/processor/command/break.rb +40 -38
- data/processor/command/continue.rb +15 -10
- data/processor/command/debug.rb +6 -25
- data/processor/command/delete.rb +21 -12
- data/processor/command/directory.rb +15 -13
- data/processor/command/disable.rb +12 -9
- data/processor/command/disassemble.rb +80 -74
- data/processor/command/display.rb +15 -12
- data/processor/command/down.rb +8 -3
- data/processor/command/edit.rb +37 -23
- data/processor/command/enable.rb +11 -8
- data/processor/command/eval.rb +24 -22
- data/processor/command/finish.rb +50 -48
- data/processor/command/help.rb +1 -1
- data/processor/command/info_subcmd/breakpoints.rb +7 -7
- data/processor/command/info_subcmd/files.rb +195 -196
- data/processor/command/info_subcmd/frame.rb +7 -4
- data/processor/command/info_subcmd/locals.rb +29 -12
- data/processor/command/info_subcmd/program.rb +48 -39
- data/processor/command/info_subcmd/registers_subcmd/ep.rb +46 -0
- data/processor/command/info_subcmd/registers_subcmd/helper.rb +32 -35
- data/processor/command/info_subcmd/registers_subcmd/sp.rb +29 -23
- data/processor/command/info_subcmd/return.rb +28 -10
- data/processor/command/info_subcmd/variables_subcmd/class.rb +3 -3
- data/processor/command/info_subcmd/variables_subcmd/constants.rb +77 -0
- data/processor/command/info_subcmd/variables_subcmd/globals.rb +7 -7
- data/processor/command/info_subcmd/variables_subcmd/instance.rb +68 -22
- data/processor/command/info_subcmd/variables_subcmd/locals.rb +148 -67
- data/processor/command/list.rb +14 -8
- data/processor/command/macro.rb +1 -1
- data/processor/command/next.rb +1 -0
- data/processor/command/set_subcmd/auto.rb +3 -3
- data/processor/command/set_subcmd/different.rb +30 -29
- data/processor/command/set_subcmd/events.rb +74 -48
- data/processor/command/set_subcmd/max_subcmd/list.rb +12 -5
- data/processor/command/set_subcmd/max_subcmd/width.rb +28 -19
- data/processor/command/set_subcmd/register.rb +37 -0
- data/processor/command/set_subcmd/register_subcmd/pc.rb +67 -0
- data/processor/command/set_subcmd/register_subcmd/sp.rb +75 -0
- data/processor/command/set_subcmd/reload.rb +12 -10
- data/processor/command/set_subcmd/return.rb +68 -44
- data/processor/command/shell.rb +3 -2
- data/processor/command/show_subcmd/different.rb +17 -14
- data/processor/command/show_subcmd/events.rb +25 -25
- data/processor/default.rb +1 -1
- data/processor/eval.rb +14 -15
- data/processor/frame.rb +43 -36
- data/processor/help.rb +5 -5
- data/processor/hook.rb +26 -29
- data/processor/location.rb +54 -51
- data/processor/mock.rb +4 -3
- data/processor/running.rb +113 -103
- data/processor/validate.rb +401 -373
- data/test/data/debug.cmd +8 -0
- data/test/data/debug.right +13 -0
- data/test/data/debugger-stop.right +6 -4
- data/test/data/fname-with-blank.cmd +1 -1
- data/test/data/fname-with-blank.right +5 -0
- data/test/data/pc.cmd +8 -0
- data/test/data/pc.right +10 -0
- data/test/data/quit.right +3 -1
- data/test/data/trace.cmd +2 -2
- data/test/data/trace.right +41 -20
- data/test/example/assign.rb +6 -0
- data/test/functional/fn_helper.rb +11 -17
- data/test/functional/test-break-long.rb +15 -16
- data/test/functional/test-break.rb +6 -8
- data/test/functional/test-condition.rb +8 -10
- data/test/functional/test-debugger-call-bug.rb +21 -22
- data/test/functional/test-delete.rb +57 -59
- data/test/functional/test-eval.rb +101 -103
- data/test/functional/test-finish.rb +24 -33
- data/test/functional/test-immediate-step-bug.rb +6 -10
- data/test/functional/test-next.rb +64 -65
- data/test/functional/test-raise.rb +63 -64
- data/test/functional/test-recursive-bt.rb +81 -76
- data/test/functional/test-remap.rb +6 -7
- data/test/functional/test-return.rb +44 -38
- data/test/functional/test-step.rb +55 -53
- data/test/functional/test-stepbug.rb +6 -9
- data/test/functional/test-watchg.rb +40 -39
- data/test/integration/test-debug.rb +12 -0
- data/test/integration/test-debugger-stop.rb +7 -7
- data/test/integration/test-pc.rb +24 -0
- data/test/integration/test-trace.rb +1 -1
- data/test/unit/cmd-helper.rb +0 -1
- data/test/unit/test-app-brkpt.rb +21 -21
- data/test/unit/test-app-brkptmgr.rb +7 -8
- data/test/unit/test-app-display.rb +3 -4
- data/test/unit/test-app-frame.rb +4 -5
- data/test/unit/test-base-subsubcmd.rb +2 -2
- data/test/unit/test-cmd-break.rb +6 -6
- data/test/unit/test-cmd-endisable.rb +7 -6
- data/test/unit/test-cmd-parse_list_cmd.rb +24 -24
- data/test/unit/test-io-tcpserver.rb +39 -35
- data/test/unit/test-proc-default.rb +23 -22
- data/test/unit/test-proc-eval.rb +1 -2
- data/test/unit/test-proc-frame.rb +8 -9
- data/test/unit/test-proc-list.rb +1 -1
- data/test/unit/test-proc-location.rb +2 -2
- data/test/unit/test-proc-main.rb +10 -10
- data/test/unit/test-proc-validate.rb +11 -13
- data/test/unit/test-subcmd-help.rb +1 -2
- data/trepanning.gemspec +8 -13
- metadata +44 -95
- data/COPYING +0 -57
- data/data/custom_require.rb +0 -44
- data/data/perldb.bindings +0 -17
- data/data/prelude.rb +0 -38
- data/processor/command/info_subcmd/variables_subcmd/constant.rb +0 -41
- data/processor/command/raise.rb +0 -48
- data/processor/command/set_subcmd/pc.rb +0 -62
- data/processor/command/set_subcmd/sp.rb +0 -67
- data/processor/eventbuf.rb +0 -133
@@ -1,21 +1,18 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'test/unit'
|
3
|
-
require 'trace'
|
4
3
|
require_relative 'fn_helper'
|
5
4
|
|
6
5
|
class TestStep < Test::Unit::TestCase
|
7
6
|
|
8
7
|
include FnTestHelper
|
9
|
-
include Trace
|
10
8
|
|
11
9
|
def test_step_through_leave
|
12
10
|
|
13
11
|
# See that we can step with parameter which is the same as 'step 1'
|
14
12
|
cmds = ['step', 'step', 'step', 'step', 'step', 'step', 'continue']
|
15
13
|
d = strarray_setup(cmds)
|
16
|
-
d.core.step_events = TEST_STEP_EVENT_MASK
|
17
14
|
|
18
|
-
d.start
|
15
|
+
d.start(true)
|
19
16
|
########### t1 ###############
|
20
17
|
x = 'class Foo
|
21
18
|
def bar
|
@@ -27,11 +24,11 @@ class TestStep < Test::Unit::TestCase
|
|
27
24
|
# f.bar
|
28
25
|
##############################
|
29
26
|
d.stop
|
30
|
-
out = ["
|
31
|
-
".. eval(x)",
|
32
|
-
".. eval(x)",
|
33
|
-
":: eval(x)",
|
34
|
-
"
|
27
|
+
out = ["line x = 'class Foo",
|
28
|
+
".. eval(x)",
|
29
|
+
".. eval(x)",
|
30
|
+
":: eval(x)",
|
31
|
+
"line eval(x)"]
|
35
32
|
# compare_output(out, d, cmds)
|
36
33
|
assert true
|
37
34
|
|
@@ -1,51 +1,52 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'test/unit'
|
3
|
-
require 'trace'
|
4
3
|
require_relative 'fn_helper'
|
5
4
|
|
6
5
|
# See that we hande "set trace var" properly
|
7
6
|
class TestWatchG < Test::Unit::TestCase
|
8
7
|
|
9
|
-
|
10
|
-
include Trace
|
8
|
+
include FnTestHelper
|
11
9
|
|
12
|
-
|
10
|
+
def test_basic
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
'watchg $my_var off',
|
18
|
-
'watchg $my_var off',
|
19
|
-
'continue']
|
20
|
-
d = strarray_setup(cmds)
|
21
|
-
d.core.step_events = TEST_STEP_EVENT_MASK
|
12
|
+
cmds = ['watchg $my_var',
|
13
|
+
'continue', 'continue']
|
14
|
+
d = strarray_setup(cmds)
|
22
15
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
out = ['-- ',
|
33
|
-
'x = 1',
|
34
|
-
'Tracing for variable $my_var set to: stop.',
|
35
|
-
'** global variable $my_var is already traced with stop.',
|
36
|
-
'trace: $my_var = 5',
|
37
|
-
'Note: we are stopped *after* the above location.',
|
38
|
-
'$V ',
|
39
|
-
'$my_var = 5',
|
40
|
-
'trace: $my_var = 6',
|
41
|
-
'Note: we are stopped *after* the above location.',
|
42
|
-
'$V ',
|
43
|
-
'$my_var = 6',
|
44
|
-
'Removed trace for variable $my_var.',
|
45
|
-
'Warning: variable $my_var is not currently marked as traced.',
|
46
|
-
'Removed trace for variable $my_var.'
|
47
|
-
]
|
48
|
-
compare_output(out, d, cmds)
|
49
|
-
end
|
16
|
+
d.start(true)
|
17
|
+
########### t1 ###############
|
18
|
+
x = 1
|
19
|
+
$my_var = 5
|
20
|
+
y = 2
|
21
|
+
$my_var = 6
|
22
|
+
z = 3
|
23
|
+
##############################
|
24
|
+
d.stop
|
50
25
|
|
26
|
+
out = ["line ",
|
27
|
+
"x = 1",
|
28
|
+
"Tracing for variable $my_var set to: stop.",
|
29
|
+
"trace: $my_var = 5",
|
30
|
+
"trace-var ",
|
31
|
+
"y = 2",
|
32
|
+
"trace: $my_var = 6",
|
33
|
+
"trace-var ",
|
34
|
+
"z = 3",
|
35
|
+
"c_return ",
|
36
|
+
"R=> nil",
|
37
|
+
"z = 3",
|
38
|
+
"line ",
|
39
|
+
"z = 3",
|
40
|
+
"line ",
|
41
|
+
"d.stop",
|
42
|
+
"call ",
|
43
|
+
# FIXME: can we get rid of the below?
|
44
|
+
"RubyVM::Frame::get.trace_off = true",
|
45
|
+
"c_call ",
|
46
|
+
"RubyVM::Frame::get.trace_off = true",
|
47
|
+
"c_call ",
|
48
|
+
"RubyVM::Frame::get.trace_off = true"
|
49
|
+
]
|
50
|
+
compare_output(out, d, cmds)
|
51
|
+
end
|
51
52
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require_relative 'helper'
|
4
|
+
require 'rbconfig'
|
5
|
+
|
6
|
+
class TestDebug < Test::Unit::TestCase
|
7
|
+
@@NAME = File.basename(__FILE__, '.rb')[5..-1]
|
8
|
+
def test_trepan_debug
|
9
|
+
opts = {:args => '3 5', :verbose=>true}
|
10
|
+
assert_equal(true, run_debugger(@@NAME, 'gcd.rb', opts))
|
11
|
+
end
|
12
|
+
end
|
@@ -5,23 +5,23 @@ require_relative 'helper'
|
|
5
5
|
|
6
6
|
class TestDebuggerStop < Test::Unit::TestCase
|
7
7
|
@@name = File.basename(__FILE__, '.rb')[5..-1]
|
8
|
-
@@name = @@name[2..-1] if
|
8
|
+
@@name = @@name[2..-1] if
|
9
9
|
(RbConfig::CONFIG['target_os'].start_with?('mingw') and
|
10
10
|
@@name =~ /^[A-Za-z]:/)
|
11
11
|
|
12
12
|
def test_it
|
13
|
-
skip "FIXME for mingw" if
|
14
|
-
RbConfig::CONFIG['target_os'].start_with?('mingw')
|
13
|
+
skip "FIXME for mingw" if
|
14
|
+
RbConfig::CONFIG['target_os'].start_with?('mingw')
|
15
15
|
opts = {}
|
16
16
|
opts[:feed_input] = "echo 'info program ;; continue ;; quit!' "
|
17
17
|
opts[:filter] = Proc.new{|got_lines, correct_lines|
|
18
|
-
got_lines[0].gsub!(/\(.*debugger-stop.rb[:]\d+ @\d+/,
|
18
|
+
got_lines[0].gsub!(/\(.*debugger-stop.rb[:]\d+ @\d+/,
|
19
19
|
'debugger-stop.rb:14 @1955')
|
20
20
|
# require_relative '../../lib/trepanning'; debugger
|
21
|
-
got_lines[2].gsub!(
|
22
|
-
"PC offset 100 <top debugger-stop.rb")
|
23
|
-
got_lines[3].gsub!(/\(.*debugger-stop.rb[:]\d+ @\d+/,
|
21
|
+
got_lines[2].gsub!(/\(.*debugger-stop.rb[:]\d+ @\d+\)/,
|
24
22
|
'debugger-stop.rb:10 @1954')
|
23
|
+
got_lines[4].gsub!(/PC offset \d+ .*<top .+debugger-stop.rb/,
|
24
|
+
"PC offset 100 <top debugger-stop.rb")
|
25
25
|
}
|
26
26
|
assert_equal(true, run_debugger(@@name, @@name + '.rb', opts))
|
27
27
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
class TestQuit < Test::Unit::TestCase
|
6
|
+
@@NAME = File.basename(__FILE__, '.rb')[5..-1]
|
7
|
+
|
8
|
+
# def test_trepanx_set_confirm_off
|
9
|
+
# opts = {}
|
10
|
+
# opts[:filter] = Proc.new{|got_lines, correct_lines|
|
11
|
+
# got_lines[0] = "-> (null.rb:1 @0)\n"
|
12
|
+
# }
|
13
|
+
# assert_equal(true, run_debugger('quit2', 'null.rb', opts))
|
14
|
+
# end
|
15
|
+
|
16
|
+
def test_trepan_pc
|
17
|
+
skip "Can't run from rake :-(" if __FILE__ != $0
|
18
|
+
opts = {}
|
19
|
+
opts[:filter] = Proc.new{|got_lines, correct_lines|
|
20
|
+
got_lines[0] = "-> (null.rb:1 @0)\n"
|
21
|
+
}
|
22
|
+
assert_equal(true, run_debugger(@@NAME, 'assign.rb', opts))
|
23
|
+
end
|
24
|
+
end
|
@@ -13,7 +13,7 @@ class TestTrace < Test::Unit::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_trepan_trace
|
16
|
-
opts = {:dbgr => '-x
|
16
|
+
opts = {:dbgr => '-x', :args => '3 5', :nocommand => true}
|
17
17
|
if RbConfig::CONFIG['target_os'].start_with?('mingw')
|
18
18
|
opts[:short_right] = 'trace-mingw'
|
19
19
|
end
|
data/test/unit/cmd-helper.rb
CHANGED
data/test/unit/test-app-brkpt.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'test/unit'
|
3
3
|
require_relative '../../app/breakpoint'
|
4
|
-
require 'thread_frame'
|
5
4
|
|
6
5
|
class TestAppBrkpt < Test::Unit::TestCase
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
7
|
+
def test_basic
|
8
|
+
tf = RubyVM::Frame.get
|
9
|
+
iseq = tf.iseq
|
10
|
+
b1 = Trepan::Breakpoint.new(iseq, 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?(tf.binding))
|
15
|
+
assert_equal(1, b1.hits)
|
16
|
+
|
17
|
+
assert_equal(b1.source_container, tf.source_container)
|
18
|
+
b1.enabled = false
|
19
|
+
assert_equal('b', b1.icon_char)
|
20
|
+
assert_raises TypeError do
|
21
|
+
Trepan::Breakpoint.new(iseq, iseq.iseq_size, :temp => true)
|
22
|
+
end
|
23
|
+
assert_raises TypeError do
|
24
|
+
Trepan::Breakpoint.new(0, 5)
|
25
|
+
end
|
26
|
+
b2 = Trepan::Breakpoint.new(iseq, 0, :temp => true)
|
27
|
+
assert_equal('t', b2.icon_char)
|
25
28
|
end
|
26
|
-
b2 = Trepan::Breakpoint.new(iseq, 0, :temp => true)
|
27
|
-
assert_equal('t', b2.icon_char)
|
28
|
-
end
|
29
29
|
end
|
@@ -2,7 +2,6 @@
|
|
2
2
|
require 'test/unit'
|
3
3
|
require_relative '../../app/brkptmgr'
|
4
4
|
require_relative '../../app/breakpoint'
|
5
|
-
require 'thread_frame'
|
6
5
|
|
7
6
|
class TestLibAppBrkptMgr < Test::Unit::TestCase
|
8
7
|
|
@@ -11,7 +10,7 @@ class TestLibAppBrkptMgr < Test::Unit::TestCase
|
|
11
10
|
end
|
12
11
|
|
13
12
|
def test_basic
|
14
|
-
tf = RubyVM::Frame.
|
13
|
+
tf = RubyVM::Frame.get
|
15
14
|
iseq = tf.iseq
|
16
15
|
offsets = iseq.offsetlines.keys
|
17
16
|
offset = offsets[0]
|
@@ -32,24 +31,24 @@ class TestLibAppBrkptMgr < Test::Unit::TestCase
|
|
32
31
|
end
|
33
32
|
|
34
33
|
def test_multiple_brkpt_per_offset
|
35
|
-
tf = RubyVM::Frame.
|
34
|
+
tf = RubyVM::Frame.get
|
36
35
|
iseq = tf.iseq
|
37
36
|
offsets = iseq.offsetlines.keys
|
38
37
|
offset = offsets[0]
|
39
38
|
b1 = @brkpts.add(iseq, offset)
|
40
39
|
b2 = @brkpts.add(iseq, offset)
|
41
40
|
assert_equal(2, @brkpts.size)
|
42
|
-
assert_equal(1, @brkpts.set.size,
|
41
|
+
assert_equal(1, @brkpts.set.size,
|
43
42
|
'Two breakpoints but only one iseq/offset')
|
44
43
|
@brkpts.delete_by_brkpt(b1)
|
45
|
-
assert_equal(1, @brkpts.size,
|
44
|
+
assert_equal(1, @brkpts.size,
|
46
45
|
'One breakpoint after 2nd breakpoint deleted')
|
47
|
-
assert_equal(1, @brkpts.set.size,
|
46
|
+
assert_equal(1, @brkpts.set.size,
|
48
47
|
'Two breakpoints, but only one iseq/offset')
|
49
48
|
@brkpts.delete_by_brkpt(b2)
|
50
|
-
assert_equal(0, @brkpts.size,
|
49
|
+
assert_equal(0, @brkpts.size,
|
51
50
|
'Both breakpoints deleted')
|
52
|
-
assert_equal(0, @brkpts.set.size,
|
51
|
+
assert_equal(0, @brkpts.set.size,
|
53
52
|
'Second breakpoint delete should delete iseq/offset')
|
54
53
|
end
|
55
54
|
|
@@ -1,19 +1,18 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'test/unit'
|
3
3
|
require_relative '../../app/display'
|
4
|
-
require 'thread_frame'
|
5
4
|
|
6
|
-
class
|
5
|
+
class TestLibAppDisplay < Test::Unit::TestCase
|
7
6
|
|
8
7
|
def test_basic
|
9
|
-
tf = RubyVM::Frame.
|
8
|
+
tf = RubyVM::Frame.get
|
10
9
|
mgr = DisplayMgr.new
|
11
10
|
x = 1
|
12
11
|
assert_equal(0, mgr.size)
|
13
12
|
disp = mgr.add(tf, 'x > 1')
|
14
13
|
assert_equal(1, mgr.max)
|
15
14
|
assert_equal(true, disp.enabled?)
|
16
|
-
|
15
|
+
|
17
16
|
mgr.enable_disable(disp.number, false)
|
18
17
|
assert_equal(false, disp.enabled?)
|
19
18
|
mgr.enable_disable(disp.number, true)
|
data/test/unit/test-app-frame.rb
CHANGED
@@ -1,26 +1,25 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'test/unit'
|
3
3
|
require_relative '../../app/frame'
|
4
|
-
require 'thread_frame'
|
5
4
|
|
6
5
|
class TestAppFrame < Test::Unit::TestCase
|
7
6
|
|
8
7
|
include Trepan::Frame
|
9
8
|
|
10
9
|
def test_app_frame
|
11
|
-
frame = RubyVM::Frame.
|
10
|
+
frame = RubyVM::Frame.get
|
12
11
|
base_count = frame.stack_size
|
13
12
|
s = format_stack_entry(frame)
|
14
13
|
pat = /^METHOD .*#test_app_frame\(\) in file .*test-app-frame.rb at line \d+/
|
15
14
|
assert(s =~ pat, "got #{s}, expected pat #{pat}")
|
16
|
-
1.times do
|
17
|
-
assert_equal(base_count+2, RubyVM::Frame.
|
15
|
+
1.times do
|
16
|
+
assert_equal(base_count+2, RubyVM::Frame.get.stack_size)
|
18
17
|
s = format_stack_entry(frame)
|
19
18
|
assert(s =~ pat, "got #{s}, expected pat #{pat}")
|
20
19
|
end
|
21
20
|
|
22
21
|
def inner_test(count)
|
23
|
-
frame = RubyVM::Frame.
|
22
|
+
frame = RubyVM::Frame.get
|
24
23
|
assert_equal(count, frame.stack_size)
|
25
24
|
|
26
25
|
s = format_stack_entry(frame)
|
@@ -3,10 +3,10 @@ require 'test/unit'
|
|
3
3
|
require_relative '../../processor/command/base/subsubcmd'
|
4
4
|
|
5
5
|
$errors = []
|
6
|
-
class
|
6
|
+
class TestBaseSubSubCommand < Test::Unit::TestCase
|
7
7
|
|
8
8
|
def test_prefix_set
|
9
|
-
Trepanning::SubSubcommand.set_name_prefix('/tmp/show_subcmd/auto_subcmd/food.rb',
|
9
|
+
Trepanning::SubSubcommand.set_name_prefix('/tmp/show_subcmd/auto_subcmd/food.rb',
|
10
10
|
self.class)
|
11
11
|
assert_equal('food', NAME, "should have set NAME")
|
12
12
|
assert_equal('show auto food', CMD)
|
data/test/unit/test-cmd-break.rb
CHANGED
@@ -8,17 +8,17 @@ class TestCommandBreak < Test::Unit::TestCase
|
|
8
8
|
common_setup
|
9
9
|
@name = File.basename(__FILE__, '.rb').split(/-/)[2]
|
10
10
|
@my_cmd = @cmds[@name]
|
11
|
-
@brkpt_set_pat = /^Breakpoint \d+ set at VM offset \d+ of instruction sequence .*,\n\tline \d+ in file .*$/
|
11
|
+
@brkpt_set_pat = /^Breakpoint \d+ set at VM offset \d+ of instruction sequence .*,\n\tline \d+ in file .*$/
|
12
12
|
end
|
13
13
|
|
14
|
-
def run_cmd(cmd, args)
|
14
|
+
def run_cmd(cmd, args)
|
15
15
|
cmd.proc.instance_variable_set('@cmd_argstr', args[1..-1].join(' '))
|
16
16
|
cmd.run(args)
|
17
17
|
end
|
18
18
|
|
19
19
|
# require_relative '../../lib/trepanning'
|
20
20
|
def test_basic
|
21
|
-
tf = RubyVM::Frame.
|
21
|
+
tf = RubyVM::Frame.get
|
22
22
|
@cmdproc.frame_setup(tf)
|
23
23
|
[
|
24
24
|
[@name, __LINE__.to_s],
|
@@ -40,7 +40,7 @@ class TestCommandBreak < Test::Unit::TestCase
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def foo
|
43
|
-
5
|
43
|
+
5
|
44
44
|
end
|
45
45
|
[[@name, 'foo', (__LINE__-3).to_s]].each_with_index do |args, i|
|
46
46
|
run_cmd(@my_cmd, args)
|
@@ -62,11 +62,11 @@ class TestCommandBreak < Test::Unit::TestCase
|
|
62
62
|
# the parent instruction sequence, i.e. the line is not in the
|
63
63
|
# current instruction sequence.
|
64
64
|
def test_parent_breakpoint
|
65
|
-
# skip "Need to add ISEQ parent link to 1.9.2 and further check of old code"
|
65
|
+
# skip "Need to add ISEQ parent link to 1.9.2 and further check of old code"
|
66
66
|
# require_relative '../../lib/trepanning'
|
67
67
|
line = __LINE__ # This is the line we set the breakpoint for.
|
68
68
|
1.times do
|
69
|
-
tf = RubyVM::Frame.
|
69
|
+
tf = RubyVM::Frame.get
|
70
70
|
@cmdproc.frame_setup(tf)
|
71
71
|
run_cmd(@my_cmd, [@name, line.to_s])
|
72
72
|
assert_equal(true, @cmdproc.errmsgs.empty?, @cmdproc.errmsgs)
|
@@ -17,13 +17,13 @@ class TestCommandEnableDisable < Test::Unit::TestCase
|
|
17
17
|
|
18
18
|
# Some simple errors in running enable/disable commands
|
19
19
|
[[@enable_cmd, ['enable', '1'], 0, 1],
|
20
|
-
[@disable_cmd, ['disable', '1'], 0, 1]].each do
|
20
|
+
[@disable_cmd, ['disable', '1'], 0, 1]].each do
|
21
21
|
|cmd, args, nmsgs, nerrs|
|
22
22
|
# No breakpoint number given
|
23
23
|
cmd.run(args[0..0])
|
24
|
-
assert_equal(nmsgs, @cmdproc.msgs.size,
|
24
|
+
assert_equal(nmsgs, @cmdproc.msgs.size,
|
25
25
|
"#{args} - msgs: #{@cmdproc.msgs.inspect}")
|
26
|
-
assert_equal(nerrs, @cmdproc.errmsgs.size,
|
26
|
+
assert_equal(nerrs, @cmdproc.errmsgs.size,
|
27
27
|
"#{args} - errmsgs: #{@cmdproc.errmsgs.inspect}")
|
28
28
|
reset_cmdproc_vars
|
29
29
|
|
@@ -34,22 +34,23 @@ class TestCommandEnableDisable < Test::Unit::TestCase
|
|
34
34
|
reset_cmdproc_vars
|
35
35
|
end
|
36
36
|
|
37
|
-
tf = RubyVM::Frame.
|
37
|
+
tf = RubyVM::Frame.get
|
38
38
|
@cmdproc.frame_setup(tf)
|
39
39
|
pc_offset = tf.pc_offset
|
40
40
|
@break_cmd.run(['break'])
|
41
|
+
p @cmdproc.errmsgs
|
41
42
|
assert_equal(true, @cmdproc.errmsgs.empty?)
|
42
43
|
assert_equal(1, @cmdproc.msgs.size)
|
43
44
|
reset_cmdproc_vars
|
44
45
|
|
45
46
|
@disable_cmd.run(['disable', '1'])
|
46
|
-
assert_equal(0,
|
47
|
+
assert_equal(0,
|
47
48
|
@cmdproc.msgs[0] =~ /^Breakpoint 1 disabled./,
|
48
49
|
@cmdproc.msgs)
|
49
50
|
reset_cmdproc_vars
|
50
51
|
|
51
52
|
@enable_cmd.run(['enable', '1'])
|
52
|
-
assert_equal(0,
|
53
|
+
assert_equal(0,
|
53
54
|
@cmdproc.msgs[0] =~ /^Breakpoint 1 enabled./,
|
54
55
|
@cmdproc.msgs)
|
55
56
|
end
|