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
@@ -1,77 +1,76 @@
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 TestNext < Test::Unit::TestCase
7
6
 
8
- include FnTestHelper
9
-
10
- def test_next_same_level
11
-
12
- # See that we can next with parameter which is the same as 'next 1'
13
- cmds = %w(next continue)
14
- d = strarray_setup(cmds)
15
- d.start
16
- x = 5
17
- y = 6
18
- d.stop
19
- out = ['-- ', 'x = 5', '-- ', 'y = 6']
20
- compare_output(out, d, cmds)
21
-
22
- # See that we can next with a computed count value
23
- cmds = ['next 5-3', 'continue']
24
- d = strarray_setup(cmds)
25
- d.start
26
- ########### t1 ###############
27
- x = 5
28
- y = 6
29
- z = 7
30
- ##############################
31
- d.stop # ({'remove': true})
32
- out = ['-- ', 'x = 5', '-- ', 'z = 7']
33
- compare_output(out, d, cmds)
34
- end
35
-
36
- def test_next_between_fn
37
-
38
- # Next over functions
39
- cmds = ['next 2', 'continue']
40
- d = strarray_setup(cmds)
41
- d.start
42
- ########### t2 ###############
43
- def fact(x)
44
- return 1 if x <= 1
45
- return fact(x-1)
46
- end
47
- x = fact(4)
48
- y = 5
49
- ##############################
50
- d.stop # ({:remove => true})
51
- out = ['-- ', 'def fact(x)', '-- ', 'y = 5']
52
- compare_output(out, d, cmds)
53
- end
54
-
55
- def test_next_in_exception
56
- cmds = %w(next! continue)
57
- d = strarray_setup(cmds)
58
- d.start
59
- ########### t2 ###############
60
- begin
61
- got_boom = false
62
- x = 4/0
63
- rescue
64
- got_boom = true
65
- end
66
- ##############################
67
- d.stop # ({:remove => true})
68
- out = ['-- ', 'begin', "#<ZeroDivisionError: divided by 0>", "!! ", "x = 4/0"]
69
- compare_output(out, d, cmds)
70
- end
71
- end
7
+ include FnTestHelper
72
8
 
9
+ def test_next_same_level
73
10
 
11
+ # See that we can next with parameter which is the same as 'next 1'
12
+ cmds = %w(next continue)
13
+ d = strarray_setup(cmds)
14
+ d.start(true)
15
+ x = 5
16
+ y = 6
17
+ d.stop
18
+ out = ['line ', 'x = 5', 'line ', 'y = 6']
19
+ compare_output(out, d, cmds)
74
20
 
21
+ # See that we can next with a computed count value
22
+ cmds = ['next 5-3', 'continue']
23
+ d = strarray_setup(cmds)
24
+ d.start(true)
25
+ ########### t1 ###############
26
+ x = 5
27
+ y = 6
28
+ z = 7
29
+ ##############################
30
+ d.stop # ({'remove': true})
31
+ out = ['line ', 'x = 5', 'line ', 'z = 7']
32
+ compare_output(out, d, cmds)
33
+ end
75
34
 
35
+ def test_next_between_fn
76
36
 
37
+ # Next over functions
38
+ cmds = ['next 2', 'continue']
39
+ d = strarray_setup(cmds)
40
+ ########### t2 ###############
41
+ def fact(x)
42
+ return 1 if x <= 1
43
+ return fact(x-1)
44
+ end
45
+ d.start(true)
46
+ x = fact(4)
47
+ y = 5
48
+ ##############################
49
+ d.stop
50
+ out = ['line ', 'x = fact(4)', 'line ', 'd.stop']
51
+ compare_output(out, d, cmds)
52
+ end
77
53
 
54
+ def test_next_in_exception
55
+ skip "Triggers a bug I need to find"
56
+ cmds = %w(next! continue)
57
+ d = strarray_setup(cmds)
58
+ d.start(true)
59
+ ########### t2 ###############
60
+ begin
61
+ got_boom = false
62
+ x = 4/0
63
+ rescue
64
+ got_boom = true
65
+ end
66
+ ##############################
67
+ d.stop # ({:remove => true})
68
+ out = ['line ',
69
+ 'got_boom = false',
70
+ 'raise ',
71
+ 'ZeroDivisionError: divided by 0',
72
+ 'line ',
73
+ 'x = 4/0']
74
+ compare_output(out, d, cmds)
75
+ end
76
+ end
@@ -1,76 +1,75 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'test/unit'
3
3
  require 'rbconfig'
4
- require 'trace'
5
4
  require_relative 'fn_helper'
6
5
 
7
6
  class TestRaise < Test::Unit::TestCase
7
+ include FnTestHelper
8
8
 
9
- include FnTestHelper
9
+ def test_raise
10
+ skip "We don't support a debugger 'raise' command on 2.1.5"
10
11
 
11
- def test_raise
12
+ skip "FIXME on mingw" if
13
+ RbConfig::CONFIG['target_os'].start_with?('mingw')
14
+ cmds = [
15
+ 'step',
16
+ 'step',
17
+ 'raise',
18
+ 'pr "hi"',
19
+ ]
20
+ d = strarray_setup(cmds)
21
+ d.start(true)
22
+ ##############################
23
+ begin
24
+ x = 1
25
+ y = 2
26
+ z = 3
27
+ rescue RuntimeError
28
+ d.stop
29
+ assert 'We are cool with RuntimeError'
30
+ else
31
+ d.stop
32
+ assert false, 'Should have got RuntimeError'
33
+ end
34
+ ##############################
35
+ out = ['line ', 'begin',
36
+ 'line ', 'x = 1',
37
+ 'line ', 'y = 2',
38
+ 'line ', 'd.stop',
39
+ '"hi"']
40
+ compare_output(out, d, cmds)
12
41
 
13
- skip "FIXME on mingw" if
14
- RbConfig::CONFIG['target_os'].start_with?('mingw')
15
- cmds = [
16
- 'step',
17
- 'step',
18
- 'raise',
19
- 'pr "hi"',
20
- ]
21
- d = strarray_setup(cmds)
22
- d.start
23
- ##############################
24
- begin
25
- x = 1
26
- y = 2
27
- z = 3
28
- rescue RuntimeError
29
- d.stop
30
- assert 'We are cool with RuntimeError'
31
- else
32
- d.stop
33
- assert false, 'Should have got RuntimeError'
42
+ # Try with explicit Exception name
43
+ cmds = [
44
+ 'next',
45
+ 'raise [5]',
46
+ 'raise NotanError',
47
+ 'step',
48
+ 'raise TypeError',
49
+ ]
50
+ d = strarray_setup(cmds)
51
+ d.start
52
+ ##############################
53
+ begin
54
+ x = 1
55
+ y = 2
56
+ z = 3
57
+ rescue TypeError
58
+ d.stop
59
+ assert 'We are cool with TypeError'
60
+ else
61
+ d.stop
62
+ assert false, 'Should have got TypeError'
63
+ end
64
+ ##############################
65
+ d.stop # ({:remove => true})
66
+ out = ['line ', 'begin',
67
+ 'line ', 'x = 1',
68
+ '** "[5]" does not inherit Exception.',
69
+ '** "NotanError" does not inherit Exception.',
70
+ 'line ', 'y = 2',
71
+ 'line ', 'd.stop']
72
+ compare_output(out, d, cmds)
34
73
  end
35
- ##############################
36
- out = ['-- ', 'begin',
37
- '-- ', 'x = 1',
38
- '-- ', 'y = 2',
39
- '-- ', 'd.stop',
40
- '"hi"']
41
- compare_output(out, d, cmds)
42
74
 
43
- # Try with explicit Exception name
44
- cmds = [
45
- 'next',
46
- 'raise [5]',
47
- 'raise NotanError',
48
- 'step',
49
- 'raise TypeError',
50
- ]
51
- d = strarray_setup(cmds)
52
- d.start
53
- ##############################
54
- begin
55
- x = 1
56
- y = 2
57
- z = 3
58
- rescue TypeError
59
- d.stop
60
- assert 'We are cool with TypeError'
61
- else
62
- d.stop
63
- assert false, 'Should have got TypeError'
64
- end
65
- ##############################
66
- d.stop # ({:remove => true})
67
- out = ['-- ', 'begin',
68
- '-- ', 'x = 1',
69
- '** "[5]" does not inherit Exception.',
70
- '** "NotanError" does not inherit Exception.',
71
- '-- ', 'y = 2',
72
- '-- ', 'd.stop']
73
- compare_output(out, d, cmds)
74
- end
75
-
76
75
  end
@@ -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
 
6
5
  class TestRecursiveBt < Test::Unit::TestCase
@@ -9,28 +8,29 @@ class TestRecursiveBt < Test::Unit::TestCase
9
8
 
10
9
  def test_recursive_backtrace
11
10
 
12
- cmds = [
13
- 'set events line',
14
- 'set basename on',
15
- 'step',
16
- 'bt 1',
17
- 'step',
18
- 'step',
19
- 'bt 2',
20
- 'step',
21
- 'step',
22
- 'bt 3',
23
- 'step',
24
- 'step',
25
- 'step',
26
- 'bt 5',
27
- 'step',
28
- 'step',
29
- 'step',
30
- 'bt 7',
11
+ cmds = [
12
+ 'set max width 300',
13
+ 'set different off',
14
+ 'set events line',
15
+ 'step',
16
+ 'bt 2',
17
+ 'step',
18
+ 'step',
19
+ 'bt 3',
20
+ 'step',
21
+ 'step',
22
+ 'step',
23
+ 'bt 4',
24
+ 'step',
25
+ 'step',
26
+ 'step',
27
+ 'bt 5',
28
+ 'step',
29
+ 'step',
30
+ 'step',
31
+ 'bt 7',
31
32
  ]
32
33
  d = strarray_setup(cmds)
33
- d.start
34
34
  ##############################
35
35
  def factorial(n)
36
36
  if n > 0
@@ -39,64 +39,69 @@ class TestRecursiveBt < Test::Unit::TestCase
39
39
  return 1
40
40
  end
41
41
  end
42
+ d.start(true)
42
43
  z = factorial(5)
43
44
  ##############################
44
45
  d.stop
45
- out =
46
- ["-- ",
47
- "def factorial(n)",
48
- "Trace events we may stop on:",
49
- "\tbrkpt, line",
50
- "basename is on.",
51
- "-- ",
52
- "z = factorial(5)",
53
- "--> #0 METHOD TestRecursiveBt#test_recursive_backtrace() in file test-recursive-bt.rb at line 42",
54
- "(More stack frames follow...)",
55
- "-- ",
56
- "if n > 0",
57
- "-- ",
58
- "return n * factorial(n-1)",
59
- "--> #0 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
60
- " #1 METHOD TestRecursiveBt#test_recursive_backtrace() in file test-recursive-bt.rb at line 42",
61
- "(More stack frames follow...)",
62
- "-- ",
63
- "if n > 0",
64
- "-- ",
65
- "return n * factorial(n-1)",
66
- "--> #0 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
67
- " #1 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
68
- " #2 METHOD TestRecursiveBt#test_recursive_backtrace() in file test-recursive-bt.rb at line 42",
69
- "(More stack frames follow...)",
70
- "-- ",
71
- "if n > 0",
72
- "-- ",
73
- "return n * factorial(n-1)",
74
- "-- ",
75
- "if n > 0",
76
- "--> #0 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 36",
77
- " #1 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
78
- "... above line repeated 2 times",
79
- " #4 METHOD TestRecursiveBt#test_recursive_backtrace() in file test-recursive-bt.rb at line 42",
80
- "(More stack frames follow...)",
81
- "-- ",
82
- "return n * factorial(n-1)",
83
- "-- ",
84
- "if n > 0",
85
- "-- ",
86
- "return n * factorial(n-1)",
87
- "--> #0 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
88
- " #1 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
89
- "... above line repeated 3 times",
90
- " #5 METHOD TestRecursiveBt#test_recursive_backtrace() in file test-recursive-bt.rb at line 42",
91
- " #6 METHOD TestRecursiveBt#run(runner) in file unit.rb at line xxx",
92
- "(More stack frames follow...)",
93
- "-- ",
94
- "if n > 0",
95
- "-- ",
96
- "return 1",
97
- "-- ",
98
- "d.stop"]
99
- d.intf[-1].output.output[-8].sub!(/at line \d+$/, 'at line xxx')
46
+ out =
47
+ ["line ",
48
+ "z = factorial(5)",
49
+ "max width is 300.",
50
+ "different is off.",
51
+ "Trace events we may stop on:\n----------------------------",
52
+ " line",
53
+ "line ",
54
+ "if n > 0",
55
+ "--> #0 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 36",
56
+ " #1 METHOD TestRecursiveBt#test_recursive_backtrace() in file test-recursive-bt.rb at line 43",
57
+ "(More stack frames follow...)",
58
+ "line ",
59
+ "return n * factorial(n-1)",
60
+ "line ",
61
+ "if n > 0",
62
+ "--> #0 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 36",
63
+ " #1 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
64
+ " #2 METHOD TestRecursiveBt#test_recursive_backtrace() in file test-recursive-bt.rb at line 43",
65
+ "(More stack frames follow...)",
66
+ "line ",
67
+ "return n * factorial(n-1)",
68
+ "line ",
69
+ "if n > 0",
70
+ "line ",
71
+ "return n * factorial(n-1)",
72
+ "--> #0 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
73
+ " #1 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
74
+ "... above line repeated 1 times",
75
+ " #3 METHOD TestRecursiveBt#test_recursive_backtrace() in file test-recursive-bt.rb at line 43",
76
+ "(More stack frames follow...)",
77
+ "line ",
78
+ "if n > 0",
79
+ "line ",
80
+ "return n * factorial(n-1)",
81
+ "line ",
82
+ "if n > 0",
83
+ "--> #0 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 36",
84
+ " #1 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
85
+ "(More stack frames follow...)",
86
+ "line ",
87
+ "return n * factorial(n-1)",
88
+ "line ",
89
+ "if n > 0",
90
+ "line ",
91
+ "return 1",
92
+ "--> #0 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 39",
93
+ " #1 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
94
+ "... above line repeated 4 times",
95
+ " #6 METHOD TestRecursiveBt#test_recursive_backtrace() in file test-recursive-bt.rb at line 43",
96
+ "(More stack frames follow...)",
97
+ "line ",
98
+ "d.stop",
99
+ "line ",
100
+ "RubyVM::Frame::get.trace_off = true"]
101
+
102
+ d.intf[-1].output.output.each do |line|
103
+ line.sub!(/in file .*test-recursive-bt.rb/, 'in file test-recursive-bt.rb')
104
+ end
100
105
  compare_output(out, d, cmds)
101
106
 
102
107
  end