trepanning 1.93.35 → 2.15.33
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.
- 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
data/test/data/debug.cmd
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
line (gcd.rb:4 @2)
|
2
|
+
def gcd(a, b)
|
3
|
+
line (gcd.rb:18 @15)
|
4
|
+
a, b = ARGV[0..1].map {|arg| arg.to_i}
|
5
|
+
ENTERING NESTED DEBUGGER
|
6
|
+
------------------------
|
7
|
+
call (gcd.rb:6 @2)
|
8
|
+
if a > b
|
9
|
+
Local variables for METHOD Object#gcd(a, b):
|
10
|
+
--------------------------------------------
|
11
|
+
2: b = 2 (Fixnum)
|
12
|
+
3: a = 2 (Fixnum)
|
13
|
+
trepan: That's all, folks...
|
@@ -1,6 +1,8 @@
|
|
1
|
-
|
1
|
+
line debugger-stop.rb:14 @1955)
|
2
|
+
require_relative '../../lib/trepanning'
|
3
|
+
line debugger-stop.rb:10 @1954
|
2
4
|
Foo::five
|
3
5
|
(trepan): Program stop event: line; PC offset 100 <top debugger-stop.rb>
|
4
|
-
|
5
|
-
|
6
|
-
trepan: That's all, folks...
|
6
|
+
Program terminated, type q to quit
|
7
|
+
post-mortem
|
8
|
+
(trepan:pm): trepan: That's all, folks...
|
data/test/data/pc.cmd
ADDED
data/test/data/pc.right
ADDED
data/test/data/quit.right
CHANGED
data/test/data/trace.cmd
CHANGED
data/test/data/trace.right
CHANGED
@@ -1,37 +1,58 @@
|
|
1
|
-
|
1
|
+
line (gcd.rb:4 @2)
|
2
2
|
def gcd(a, b)
|
3
|
-
|
3
|
+
c_return (address 0xdeadbeef via gcd.rb:4)
|
4
|
+
R=> nil
|
5
|
+
def gcd(a, b)
|
6
|
+
c_call (address 0xdeadbeef via gcd.rb:18)
|
7
|
+
a, b = ARGV[0..1].map {|arg| arg.to_i}
|
8
|
+
c_call (address 0xdeadbeef via gcd.rb:18)
|
9
|
+
a, b = ARGV[0..1].map {|arg| arg.to_i}
|
10
|
+
line (gcd.rb:18 @4)
|
4
11
|
a, b = ARGV[0..1].map {|arg| arg.to_i}
|
5
|
-
|
12
|
+
c_return (address 0xdeadbeef via gcd.rb:18)
|
13
|
+
R=> 3
|
6
14
|
a, b = ARGV[0..1].map {|arg| arg.to_i}
|
7
|
-
|
15
|
+
b_call (gcd.rb:18 @2)
|
8
16
|
a, b = ARGV[0..1].map {|arg| arg.to_i}
|
9
|
-
|
17
|
+
c_call (address 0xdeadbeef via gcd.rb:18)
|
18
|
+
a, b = ARGV[0..1].map {|arg| arg.to_i}
|
19
|
+
b_return (gcd.rb:18 @10)
|
20
|
+
R=> 5
|
21
|
+
a, b = ARGV[0..1].map {|arg| arg.to_i}
|
22
|
+
line (gcd.rb:19 @37)
|
10
23
|
puts "The GCD of %d and %d is %d" % [a, b, gcd(a, b)]
|
11
|
-
|
24
|
+
line (gcd.rb:6 @4)
|
12
25
|
if a > b
|
13
|
-
|
26
|
+
line (gcd.rb:12 @39)
|
14
27
|
if a == 1 or b-a == 0
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
-- (gcd.rb:10 @24)
|
28
|
+
call (gcd.rb:6 @2)
|
29
|
+
if a > b
|
30
|
+
line (gcd.rb:10 @24)
|
19
31
|
return nil if a <= 0
|
20
|
-
|
32
|
+
line (gcd.rb:15 @68)
|
21
33
|
return gcd(b-a, a)
|
22
|
-
|
34
|
+
line (gcd.rb:6 @4)
|
23
35
|
if a > b
|
24
|
-
|
36
|
+
line (gcd.rb:12 @39)
|
25
37
|
if a == 1 or b-a == 0
|
26
|
-
|
38
|
+
return (gcd.rb:13 @65)
|
27
39
|
R=> 1
|
28
40
|
return a
|
29
|
-
|
41
|
+
return (gcd.rb:16 @81)
|
30
42
|
R=> 1
|
31
43
|
end
|
32
|
-
|
44
|
+
c_return (address 0xdeadbeef via gcd.rb:19)
|
45
|
+
R=> "The GCD of 3 and 5 is 1"
|
46
|
+
puts "The GCD of %d and %d is %d" % [a, b, gcd(a, b)]
|
47
|
+
c_call (address 0xdeadbeef via gcd.rb:19)
|
48
|
+
puts "The GCD of %d and %d is %d" % [a, b, gcd(a, b)]
|
49
|
+
The GCD of 3 and 5 is 1c_return (address 0xdeadbeef via gcd.rb:19)
|
50
|
+
R=> 23
|
51
|
+
puts "The GCD of %d and %d is %d" % [a, b, gcd(a, b)]
|
52
|
+
|
53
|
+
c_return (address 0xdeadbeef via gcd.rb:19)
|
33
54
|
R=> 1
|
34
|
-
|
35
|
-
|
36
|
-
|
55
|
+
puts "The GCD of %d and %d is %d" % [a, b, gcd(a, b)]
|
56
|
+
c_return (address 0xdeadbeef via gcd.rb:19)
|
57
|
+
R=> nil
|
37
58
|
puts "The GCD of %d and %d is %d" % [a, b, gcd(a, b)]
|
@@ -1,14 +1,8 @@
|
|
1
|
-
require '
|
2
|
-
require 'trace'
|
1
|
+
require 'rubyvm-frame'
|
3
2
|
require_relative '../../lib/trepanning'
|
4
3
|
require_relative '../../io/string_array'
|
5
4
|
|
6
5
|
module FnTestHelper
|
7
|
-
include Trace
|
8
|
-
|
9
|
-
# Synchronous events without C frames or instructions
|
10
|
-
TEST_STEP_EVENT_MASK = LINE_EVENT_MASK | CLASS_EVENT_MASK | CALL_EVENT_MASK |
|
11
|
-
RETURN_EVENT_MASK
|
12
6
|
|
13
7
|
# Common setup to create a debugger with String Array I/O attached
|
14
8
|
def strarray_setup(debugger_cmds, insn_stepping=false)
|
@@ -16,8 +10,8 @@ module FnTestHelper
|
|
16
10
|
stringout = Trepan::StringArrayOutput.open
|
17
11
|
d_opts = {:input => stringin, :output => stringout,
|
18
12
|
:nx => true}
|
19
|
-
d_opts[:core_opts] = {
|
20
|
-
d_opts[:core_opts][:step_events] ||= INSN_EVENT_MASK if insn_stepping
|
13
|
+
d_opts[:core_opts] = {}
|
14
|
+
# d_opts[:core_opts][:step_events] ||= INSN_EVENT_MASK if insn_stepping
|
21
15
|
d = Trepan.new(d_opts)
|
22
16
|
|
23
17
|
# Remove vm and switch from unmaskable events to increase predictability
|
@@ -37,7 +31,7 @@ module FnTestHelper
|
|
37
31
|
|
38
32
|
# Return the caller's line number
|
39
33
|
def get_lineno
|
40
|
-
RubyVM::Frame.
|
34
|
+
RubyVM::Frame.get(1).source_location[0]
|
41
35
|
end
|
42
36
|
|
43
37
|
def compare_output(right, d, debugger_cmds)
|
@@ -73,27 +67,27 @@ module FnTestHelper
|
|
73
67
|
s =~ TREPAN_PROMPT ? nil : s
|
74
68
|
end.compact unless show_prompt
|
75
69
|
|
76
|
-
# Remove debugger location lines.
|
77
|
-
# For example:
|
70
|
+
# Remove debugger location lines.
|
71
|
+
# For example:
|
78
72
|
# -- (/src/external-vcs/trepan/tmp/gcd.rb:4)
|
79
73
|
# becomes:
|
80
|
-
# --
|
74
|
+
# --
|
81
75
|
a2 = a.map do |s|
|
82
76
|
s =~ TREPAN_LOC ? s.gsub(/\(.+:\d+( @\d+)?\)\n/, '').chomp : s.chomp
|
83
77
|
end
|
84
78
|
|
85
|
-
# Canonicalize breakpoint messages.
|
86
|
-
# For example:
|
79
|
+
# Canonicalize breakpoint messages.
|
80
|
+
# For example:
|
87
81
|
# Breakpoint 1 set at VM offset 10
|
88
82
|
# becomes :
|
89
83
|
# Breakpoint 1 set at VM offset 55
|
90
84
|
a3 = a2.map do |s|
|
91
|
-
s.gsub(/^Breakpoint (\d+) set at VM offset (\d+)/,
|
85
|
+
s.gsub(/^Breakpoint (\d+) set at VM offset (\d+)/,
|
92
86
|
'Breakpoint \1 set at VM offset 55')
|
93
87
|
end
|
94
88
|
|
95
89
|
# line 14 in file test/functional/test-break.rb.
|
96
|
-
# becomes
|
90
|
+
# becomes
|
97
91
|
# line 55 of file foo.rb
|
98
92
|
a4 = a3.map do |s|
|
99
93
|
s.gsub(/line (\d+) in file .+/, 'line 55 in file foo.rb')
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'test/unit'
|
3
|
-
|
3
|
+
require_relative '../../app/core'
|
4
4
|
require_relative 'fn_helper'
|
5
5
|
require_relative '../../app/breakpoint'
|
6
6
|
|
@@ -16,40 +16,40 @@ class TestBreakLong < Test::Unit::TestCase
|
|
16
16
|
|
17
17
|
# See that we can stop at a breakpoint
|
18
18
|
cmds = ['set basename on',
|
19
|
-
'break ' + (__LINE__ + 7).to_s,
|
19
|
+
'break ' + (__LINE__ + 7).to_s,
|
20
20
|
'continue']
|
21
21
|
d = strarray_setup(cmds)
|
22
|
-
d.start
|
22
|
+
d.start(true)
|
23
23
|
########### b1 ###############
|
24
24
|
x = 5
|
25
25
|
y = 6
|
26
26
|
z = 7
|
27
27
|
##############################
|
28
28
|
d.stop
|
29
|
-
out = ['
|
29
|
+
out = ['line ',
|
30
30
|
'x = 5',
|
31
31
|
'basename is on.',
|
32
32
|
"Breakpoint 1 set at VM offset 55 of instruction sequence \"test_break_same_level\",
|
33
33
|
\tline 55 in file foo.rb",
|
34
|
-
'
|
34
|
+
'brkpt ',
|
35
35
|
'z = 7']
|
36
36
|
compare_output(out, d, cmds)
|
37
37
|
|
38
38
|
# Try a disabling the breakpoint
|
39
39
|
cmds = ['set basename on',
|
40
|
-
'break ' + (__LINE__ + 8).to_s,
|
41
|
-
'break ' + (__LINE__ + 8).to_s,
|
40
|
+
'break ' + (__LINE__ + 8).to_s,
|
41
|
+
'break ' + (__LINE__ + 8).to_s,
|
42
42
|
'disable 1',
|
43
43
|
'continue']
|
44
44
|
d = strarray_setup(cmds)
|
45
|
-
d.start
|
45
|
+
d.start(true)
|
46
46
|
########### b2 ###############
|
47
47
|
x = 7
|
48
48
|
y = 8
|
49
49
|
z = 8+1
|
50
50
|
##############################
|
51
51
|
d.stop
|
52
|
-
out = ['
|
52
|
+
out = ['line ',
|
53
53
|
'x = 7',
|
54
54
|
"basename is on.",
|
55
55
|
"Breakpoint 1 set at VM offset 55 of instruction sequence \"test_break_same_level\",
|
@@ -57,16 +57,16 @@ class TestBreakLong < Test::Unit::TestCase
|
|
57
57
|
"Breakpoint 2 set at VM offset 55 of instruction sequence \"test_break_same_level\",
|
58
58
|
\tline 55 in file foo.rb",
|
59
59
|
"Breakpoint 1 disabled.",
|
60
|
-
'
|
60
|
+
'brkpt ',
|
61
61
|
'z = 8+1']
|
62
62
|
compare_output(out, d, cmds)
|
63
63
|
|
64
64
|
# Stepping after a breakpoint should not stay at same location.
|
65
65
|
cmds = ['set basename on',
|
66
|
-
'continue ' + (__LINE__ + 8).to_s,
|
66
|
+
'continue ' + (__LINE__ + 8).to_s,
|
67
67
|
'continue']
|
68
68
|
dbg = strarray_setup(cmds)
|
69
|
-
dbg.start
|
69
|
+
dbg.start(true)
|
70
70
|
########### b3 ###############
|
71
71
|
a = 1
|
72
72
|
b = 2
|
@@ -75,13 +75,12 @@ class TestBreakLong < Test::Unit::TestCase
|
|
75
75
|
e = 5
|
76
76
|
##############################
|
77
77
|
dbg.stop
|
78
|
-
out = ['
|
78
|
+
out = ['line ',
|
79
79
|
'a = 1',
|
80
80
|
'basename is on.',
|
81
|
-
'
|
81
|
+
'brkpt ',
|
82
82
|
'd = 4' ]
|
83
83
|
compare_output(out, dbg, cmds)
|
84
84
|
end
|
85
|
-
|
86
|
-
end
|
87
85
|
|
86
|
+
end
|
@@ -15,12 +15,12 @@ class TestBreak < Test::Unit::TestCase
|
|
15
15
|
cmds = (cmds_pat % [line, line+11, line+14]).split(/\n/)
|
16
16
|
d = strarray_setup(cmds)
|
17
17
|
##############################
|
18
|
-
def foo # line + 4
|
18
|
+
def foo # line + 4
|
19
19
|
a = 5 # line + 5
|
20
20
|
b = 6 # line + 6
|
21
21
|
end # line + 7
|
22
|
-
1.times do # line + 8
|
23
|
-
d.start
|
22
|
+
1.times do # line + 8
|
23
|
+
d.start(true)# line + 9
|
24
24
|
1.times do # line + 10
|
25
25
|
x = 11 # line + 11
|
26
26
|
foo # line + 12
|
@@ -29,7 +29,7 @@ class TestBreak < Test::Unit::TestCase
|
|
29
29
|
end
|
30
30
|
##############################
|
31
31
|
d.stop # ({:remove => true})
|
32
|
-
out = ["
|
32
|
+
out = ["line ",
|
33
33
|
"1.times do # line + 10",
|
34
34
|
"Breakpoint 1 set at VM offset 55 of instruction sequence \"test_line_only_break\",
|
35
35
|
\tline 55 in file foo.rb",
|
@@ -37,13 +37,11 @@ class TestBreak < Test::Unit::TestCase
|
|
37
37
|
\tline 55 in file foo.rb",
|
38
38
|
"Breakpoint 3 set at VM offset 55 of instruction sequence \"block in test_line_only_break\",
|
39
39
|
\tline 55 in file foo.rb",
|
40
|
-
"
|
40
|
+
"brkpt ",
|
41
41
|
"x = 11 # line + 11",
|
42
|
-
"
|
42
|
+
"brkpt ",
|
43
43
|
"c = 14 # line + 14"]
|
44
44
|
compare_output(out, d, cmds)
|
45
45
|
end
|
46
46
|
|
47
47
|
end
|
48
|
-
|
49
|
-
|
@@ -1,6 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'test/unit'
|
3
|
-
require 'trace'
|
4
3
|
require_relative 'fn_helper'
|
5
4
|
require_relative '../../app/breakpoint'
|
6
5
|
|
@@ -13,18 +12,18 @@ class TestBreak < Test::Unit::TestCase
|
|
13
12
|
|
14
13
|
# See that we can next with parameter which is the same as 'next 1'
|
15
14
|
cmds = ['set basename on',
|
16
|
-
'break ' + (__LINE__ + 7).to_s,
|
15
|
+
'break ' + (__LINE__ + 7).to_s,
|
17
16
|
'condition 1 x < 5',
|
18
17
|
'continue']
|
19
18
|
d = strarray_setup(cmds)
|
20
|
-
d.start
|
19
|
+
d.start(true)
|
21
20
|
########### b1 ###############
|
22
21
|
x = 6
|
23
22
|
y = 7
|
24
23
|
z = 8
|
25
24
|
##############################
|
26
25
|
d.stop
|
27
|
-
out = ['
|
26
|
+
out = ['line ',
|
28
27
|
'x = 6',
|
29
28
|
'basename is on.',
|
30
29
|
"Breakpoint 1 set at VM offset 55 of instruction sequence \"test_condition\",
|
@@ -33,26 +32,25 @@ class TestBreak < Test::Unit::TestCase
|
|
33
32
|
|
34
33
|
# Try a condition that fails
|
35
34
|
cmds = ['set basename on',
|
36
|
-
'break ' + (__LINE__ + 7).to_s,
|
35
|
+
'break ' + (__LINE__ + 7).to_s,
|
37
36
|
'condition 1 x > 5',
|
38
37
|
'continue']
|
39
38
|
d = strarray_setup(cmds)
|
40
|
-
d.start
|
39
|
+
d.start(true)
|
41
40
|
########### b2 ###############
|
42
41
|
x = 6
|
43
42
|
y = 7
|
44
43
|
z = 8
|
45
44
|
##############################
|
46
45
|
d.stop
|
47
|
-
out = ["
|
46
|
+
out = ["line ",
|
48
47
|
"x = 6",
|
49
48
|
"basename is on.",
|
50
49
|
"Breakpoint 1 set at VM offset 55 of instruction sequence \"test_condition\",
|
51
50
|
\tline 55 in file foo.rb",
|
52
|
-
"
|
51
|
+
"brkpt ",
|
53
52
|
"y = 7"]
|
54
53
|
compare_output(out, d, cmds)
|
55
54
|
end
|
56
|
-
|
57
|
-
end
|
58
55
|
|
56
|
+
end
|
@@ -4,28 +4,27 @@ require_relative '../../lib/trepanning'
|
|
4
4
|
|
5
5
|
class TestTrepanCallBug < Test::Unit::TestCase
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
2.times do
|
11
|
-
x = 1
|
12
|
-
mydbgr = Trepan.new()
|
13
|
-
mydbgr.core.processor.define_singleton_method(:process_commands) do
|
14
|
-
|frame|
|
15
|
-
# p [frame.source_container, frame.source_location, @core.event].flatten
|
16
|
-
$calls << [frame.source_container, frame.source_location].flatten
|
17
|
-
end
|
18
|
-
mydbgr.debugger
|
19
|
-
y = 2
|
7
|
+
def define_singleton_method_by_proc(obj, name, block)
|
8
|
+
metaclass = class << obj; self; end
|
9
|
+
metaclass.send(:define_method, name, block)
|
20
10
|
end
|
21
|
-
mydbgr.stop
|
22
|
-
assert_equal true, $calls.size > 0, $calls
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
11
|
|
12
|
+
def test_debugger_call_bug
|
13
|
+
$calls = []
|
14
|
+
mydbgr = nil
|
15
|
+
2.times do
|
16
|
+
x = 1
|
17
|
+
mydbgr = Trepan.new
|
18
|
+
core = mydbgr.core
|
19
|
+
def core.event_processor_tp(tp)
|
20
|
+
frame = tp.frame
|
21
|
+
$calls << [frame.source_container, frame.source_location].flatten
|
22
|
+
end
|
23
|
+
mydbgr.debugger
|
24
|
+
y = 2
|
25
|
+
end
|
26
|
+
mydbgr.stop
|
27
|
+
assert_equal true, $calls.size > 0, $calls
|
28
|
+
end
|
31
29
|
|
30
|
+
end
|