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.
Files changed (134) hide show
  1. checksums.yaml +7 -0
  2. data/ChangeLog +491 -55
  3. data/LICENSE +1 -1
  4. data/NEWS +18 -14
  5. data/README.md +5 -22
  6. data/Rakefile +22 -1
  7. data/app/breakpoint.rb +5 -3
  8. data/app/core.rb +147 -179
  9. data/app/default.rb +47 -46
  10. data/app/file.rb +6 -7
  11. data/app/frame.rb +183 -176
  12. data/app/markdown.rb +2 -9
  13. data/app/options.rb +1 -1
  14. data/app/run.rb +71 -37
  15. data/interface/script.rb +8 -8
  16. data/io.rb +19 -20
  17. data/lib/trepanning.rb +292 -297
  18. data/processor.rb +332 -344
  19. data/processor/breakpoint.rb +98 -96
  20. data/processor/command/base/submgr.rb +9 -9
  21. data/processor/command/break.rb +40 -38
  22. data/processor/command/continue.rb +15 -10
  23. data/processor/command/debug.rb +6 -25
  24. data/processor/command/delete.rb +21 -12
  25. data/processor/command/directory.rb +15 -13
  26. data/processor/command/disable.rb +12 -9
  27. data/processor/command/disassemble.rb +80 -74
  28. data/processor/command/display.rb +15 -12
  29. data/processor/command/down.rb +8 -3
  30. data/processor/command/edit.rb +37 -23
  31. data/processor/command/enable.rb +11 -8
  32. data/processor/command/eval.rb +24 -22
  33. data/processor/command/finish.rb +50 -48
  34. data/processor/command/help.rb +1 -1
  35. data/processor/command/info_subcmd/breakpoints.rb +7 -7
  36. data/processor/command/info_subcmd/files.rb +195 -196
  37. data/processor/command/info_subcmd/frame.rb +7 -4
  38. data/processor/command/info_subcmd/locals.rb +29 -12
  39. data/processor/command/info_subcmd/program.rb +48 -39
  40. data/processor/command/info_subcmd/registers_subcmd/ep.rb +46 -0
  41. data/processor/command/info_subcmd/registers_subcmd/helper.rb +32 -35
  42. data/processor/command/info_subcmd/registers_subcmd/sp.rb +29 -23
  43. data/processor/command/info_subcmd/return.rb +28 -10
  44. data/processor/command/info_subcmd/variables_subcmd/class.rb +3 -3
  45. data/processor/command/info_subcmd/variables_subcmd/constants.rb +77 -0
  46. data/processor/command/info_subcmd/variables_subcmd/globals.rb +7 -7
  47. data/processor/command/info_subcmd/variables_subcmd/instance.rb +68 -22
  48. data/processor/command/info_subcmd/variables_subcmd/locals.rb +148 -67
  49. data/processor/command/list.rb +14 -8
  50. data/processor/command/macro.rb +1 -1
  51. data/processor/command/next.rb +1 -0
  52. data/processor/command/set_subcmd/auto.rb +3 -3
  53. data/processor/command/set_subcmd/different.rb +30 -29
  54. data/processor/command/set_subcmd/events.rb +74 -48
  55. data/processor/command/set_subcmd/max_subcmd/list.rb +12 -5
  56. data/processor/command/set_subcmd/max_subcmd/width.rb +28 -19
  57. data/processor/command/set_subcmd/register.rb +37 -0
  58. data/processor/command/set_subcmd/register_subcmd/pc.rb +67 -0
  59. data/processor/command/set_subcmd/register_subcmd/sp.rb +75 -0
  60. data/processor/command/set_subcmd/reload.rb +12 -10
  61. data/processor/command/set_subcmd/return.rb +68 -44
  62. data/processor/command/shell.rb +3 -2
  63. data/processor/command/show_subcmd/different.rb +17 -14
  64. data/processor/command/show_subcmd/events.rb +25 -25
  65. data/processor/default.rb +1 -1
  66. data/processor/eval.rb +14 -15
  67. data/processor/frame.rb +43 -36
  68. data/processor/help.rb +5 -5
  69. data/processor/hook.rb +26 -29
  70. data/processor/location.rb +54 -51
  71. data/processor/mock.rb +4 -3
  72. data/processor/running.rb +113 -103
  73. data/processor/validate.rb +401 -373
  74. data/test/data/debug.cmd +8 -0
  75. data/test/data/debug.right +13 -0
  76. data/test/data/debugger-stop.right +6 -4
  77. data/test/data/fname-with-blank.cmd +1 -1
  78. data/test/data/fname-with-blank.right +5 -0
  79. data/test/data/pc.cmd +8 -0
  80. data/test/data/pc.right +10 -0
  81. data/test/data/quit.right +3 -1
  82. data/test/data/trace.cmd +2 -2
  83. data/test/data/trace.right +41 -20
  84. data/test/example/assign.rb +6 -0
  85. data/test/functional/fn_helper.rb +11 -17
  86. data/test/functional/test-break-long.rb +15 -16
  87. data/test/functional/test-break.rb +6 -8
  88. data/test/functional/test-condition.rb +8 -10
  89. data/test/functional/test-debugger-call-bug.rb +21 -22
  90. data/test/functional/test-delete.rb +57 -59
  91. data/test/functional/test-eval.rb +101 -103
  92. data/test/functional/test-finish.rb +24 -33
  93. data/test/functional/test-immediate-step-bug.rb +6 -10
  94. data/test/functional/test-next.rb +64 -65
  95. data/test/functional/test-raise.rb +63 -64
  96. data/test/functional/test-recursive-bt.rb +81 -76
  97. data/test/functional/test-remap.rb +6 -7
  98. data/test/functional/test-return.rb +44 -38
  99. data/test/functional/test-step.rb +55 -53
  100. data/test/functional/test-stepbug.rb +6 -9
  101. data/test/functional/test-watchg.rb +40 -39
  102. data/test/integration/test-debug.rb +12 -0
  103. data/test/integration/test-debugger-stop.rb +7 -7
  104. data/test/integration/test-pc.rb +24 -0
  105. data/test/integration/test-trace.rb +1 -1
  106. data/test/unit/cmd-helper.rb +0 -1
  107. data/test/unit/test-app-brkpt.rb +21 -21
  108. data/test/unit/test-app-brkptmgr.rb +7 -8
  109. data/test/unit/test-app-display.rb +3 -4
  110. data/test/unit/test-app-frame.rb +4 -5
  111. data/test/unit/test-base-subsubcmd.rb +2 -2
  112. data/test/unit/test-cmd-break.rb +6 -6
  113. data/test/unit/test-cmd-endisable.rb +7 -6
  114. data/test/unit/test-cmd-parse_list_cmd.rb +24 -24
  115. data/test/unit/test-io-tcpserver.rb +39 -35
  116. data/test/unit/test-proc-default.rb +23 -22
  117. data/test/unit/test-proc-eval.rb +1 -2
  118. data/test/unit/test-proc-frame.rb +8 -9
  119. data/test/unit/test-proc-list.rb +1 -1
  120. data/test/unit/test-proc-location.rb +2 -2
  121. data/test/unit/test-proc-main.rb +10 -10
  122. data/test/unit/test-proc-validate.rb +11 -13
  123. data/test/unit/test-subcmd-help.rb +1 -2
  124. data/trepanning.gemspec +8 -13
  125. metadata +44 -95
  126. data/COPYING +0 -57
  127. data/data/custom_require.rb +0 -44
  128. data/data/perldb.bindings +0 -17
  129. data/data/prelude.rb +0 -38
  130. data/processor/command/info_subcmd/variables_subcmd/constant.rb +0 -41
  131. data/processor/command/raise.rb +0 -48
  132. data/processor/command/set_subcmd/pc.rb +0 -62
  133. data/processor/command/set_subcmd/sp.rb +0 -67
  134. data/processor/eventbuf.rb +0 -133
@@ -0,0 +1,8 @@
1
+ # ***************************************************
2
+ # Test debug command. To be used with gcd.rb
3
+ # ***************************************************
4
+ next
5
+ debug gcd(2,2)
6
+ info locals
7
+ quit!
8
+ quit!
@@ -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
- -- debugger-stop.rb:14 @1955)
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
- -- debugger-stop.rb:10 @1954)
5
- 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...
@@ -3,4 +3,4 @@
3
3
  # *******************************************************************
4
4
  set basename off
5
5
  continue
6
-
6
+ quit!
@@ -1 +1,6 @@
1
1
  -> (fname with blank.rb:1 @0)
2
+ puts "Ha!"
3
+ basename is off.
4
+ Ha!
5
+ Program terminated, type q to quit
6
+ trepan: That's all, folks...
@@ -0,0 +1,8 @@
1
+ # ********************************************************
2
+ # This tests the set register pc command.
3
+ # ********************************************************
4
+ info reg pc
5
+ set register pc 13
6
+ step
7
+ info reg pc
8
+ quit!
@@ -0,0 +1,10 @@
1
+ -> (null.rb:1 @0)
2
+ va = 1
3
+ VM pc = 2
4
+ Old value was: 2
5
+ New value is: 13
6
+ line (assign.rb:5 @19)
7
+ vd = 4
8
+ VM pc = 19
9
+ D=> 3
10
+ trepan: That's all, folks...
@@ -1 +1,3 @@
1
- -> (null.rb:1 @0)
1
+ line (null.rb:2 @2)
2
+ x = 1
3
+ trepan: That's all, folks...
@@ -1,6 +1,6 @@
1
1
  # ***************************************************
2
- # This file is not used, but is here to make it
2
+ # This file is not used, but is here to make it
3
3
  # easy for the helper function.
4
4
  # ***************************************************
5
5
  continue
6
-
6
+ quit!
@@ -1,37 +1,58 @@
1
- -- (gcd.rb:4 @2)
1
+ line (gcd.rb:4 @2)
2
2
  def gcd(a, b)
3
- -- (gcd.rb:18 @2)
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
- -- (gcd.rb:18 @2)
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
- <= (gcd.rb:18 @11)
15
+ b_call (gcd.rb:18 @2)
8
16
  a, b = ARGV[0..1].map {|arg| arg.to_i}
9
- -- (gcd.rb:19 @45)
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
- -- (gcd.rb:6 @4)
24
+ line (gcd.rb:6 @4)
12
25
  if a > b
13
- -- (gcd.rb:12 @40)
26
+ line (gcd.rb:12 @39)
14
27
  if a == 1 or b-a == 0
15
- METHOD Object#gcd(a, b)
16
- -> (gcd.rb:4 @2)
17
- def gcd(a, b)
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
- -- (gcd.rb:15 @71)
32
+ line (gcd.rb:15 @68)
21
33
  return gcd(b-a, a)
22
- -- (gcd.rb:6 @4)
34
+ line (gcd.rb:6 @4)
23
35
  if a > b
24
- -- (gcd.rb:12 @40)
36
+ line (gcd.rb:12 @39)
25
37
  if a == 1 or b-a == 0
26
- <- (gcd.rb:13 @68)
38
+ return (gcd.rb:13 @65)
27
39
  R=> 1
28
40
  return a
29
- <- (gcd.rb:16 @88)
41
+ return (gcd.rb:16 @81)
30
42
  R=> 1
31
43
  end
32
- <- (gcd.rb:16 @88)
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
- end
35
- The GCD of 3 and 5 is 1
36
- <= (gcd.rb:19 @73)
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)]
@@ -0,0 +1,6 @@
1
+ # Some simple assignment statements.
2
+ va = 1
3
+ vb = 2
4
+ va = 3
5
+ vd = 4
6
+ ve = 5
@@ -1,14 +1,8 @@
1
- require 'thread_frame'
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] = {:step_events => TEST_STEP_EVENT_MASK}
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.current.prev.source_location[0]
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
- require 'trace'
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
- 'xx ',
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
- 'xx ',
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
- 'xx ',
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 # line + 9
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
- "xx ",
40
+ "brkpt ",
41
41
  "x = 11 # line + 11",
42
- "xx ",
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
- "xx ",
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
- def test_debugger_call_bug
8
- $calls = []
9
- mydbgr = nil
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