trepanning 1.93.35 → 2.15.33

Sign up to get free protection for your applications and to get access to all the features.
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,74 +1,72 @@
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
 
7
6
  class TestDelete < Test::Unit::TestCase
8
7
 
9
- include FnTestHelper
8
+ include FnTestHelper
10
9
 
11
- def test_delete
10
+ def test_delete
12
11
 
13
- # See that when we can delete a breakpoint.
14
- cmds = ['set basename on',
15
- 'break ' + (__LINE__ + 9).to_s,
16
- 'delete 1',
17
- 'continue',
18
- ]
19
- d = strarray_setup(cmds)
20
- d.start
21
- ########### b1 ###############
22
- va = 1
23
- vb = 2
24
- vc = 3
25
- vd = 4
26
- ve = 5
27
- ##############################
28
- d.stop
29
- out = ['-- ',
30
- 'va = 1',
31
- 'basename is on.',
32
- "Breakpoint 1 set at VM offset 55 of instruction sequence \"test_delete\",
12
+ # See that when we can delete a breakpoint.
13
+ cmds = ['set basename on',
14
+ 'break ' + (__LINE__ + 9).to_s,
15
+ 'delete 1',
16
+ 'continue',
17
+ ]
18
+ d = strarray_setup(cmds)
19
+ d.start(true)
20
+ ########### b1 ###############
21
+ va = 1
22
+ vb = 2
23
+ vc = 3
24
+ vd = 4
25
+ ve = 5
26
+ ##############################
27
+ d.stop
28
+ out = ['line ',
29
+ 'va = 1',
30
+ 'basename is on.',
31
+ "Breakpoint 1 set at VM offset 55 of instruction sequence \"test_delete\",
33
32
  \tline 55 in file foo.rb",
34
- "Deleted breakpoint 1."]
35
- compare_output(out, d, cmds)
33
+ "Deleted breakpoint 1."]
34
+ compare_output(out, d, cmds)
36
35
 
37
- # See that when we can delete a breakpoint but get to the next one.
38
- cmds = ['set basename on',
39
- 'set autoeval on',
40
- 'break ' + (__LINE__ + 11).to_s,
41
- 'break ' + (__LINE__ + 12).to_s,
42
- 'delete 1',
43
- 'continue',
44
- 'va',
45
- 'continue',
46
- ]
47
- d = strarray_setup(cmds)
48
- d.start
49
- ########### b1 ###############
50
- va = 1
51
- vb = 2
52
- va = 3
53
- vd = 4
54
- ve = 5
55
- ##############################
56
- d.stop
57
- out = ["-- ",
58
- "va = 1",
59
- "basename is on.",
60
- "Evaluation of unrecognized debugger commands is on.",
61
- "Breakpoint 1 set at VM offset 55 of instruction sequence \"test_delete\",
36
+ # See that when we can delete a breakpoint but get to the next one.
37
+ cmds = ['set basename on',
38
+ 'set autoeval on',
39
+ 'break ' + (__LINE__ + 12).to_s,
40
+ 'break ' + (__LINE__ + 13).to_s,
41
+ 'delete 1',
42
+ 'continue',
43
+ 'va',
44
+ 'continue',
45
+ ]
46
+ d = strarray_setup(cmds)
47
+ d.start(true)
48
+ ########### b1 ###############
49
+ va = 1
50
+ vb = 2
51
+ va = 3
52
+ vd = 4
53
+ ve = 5
54
+ ##############################
55
+ d.stop
56
+ out = ["line ",
57
+ "va = 1",
58
+ "basename is on.",
59
+ "Evaluation of unrecognized debugger commands is on.",
60
+ "Breakpoint 1 set at VM offset 55 of instruction sequence \"test_delete\",
62
61
  \tline 55 in file foo.rb",
63
- "Breakpoint 2 set at VM offset 55 of instruction sequence \"test_delete\",
62
+ "Breakpoint 2 set at VM offset 55 of instruction sequence \"test_delete\",
64
63
  \tline 55 in file foo.rb",
65
- "Deleted breakpoint 1.",
66
- "xx ",
67
- "vd = 4",
68
- "D=> 3"]
69
- compare_output(out, d, cmds)
64
+ "Deleted breakpoint 1.",
65
+ "brkpt ",
66
+ "ve = 5",
67
+ "D=> 3"]
68
+ compare_output(out, d, cmds)
70
69
 
71
- end
72
-
73
- end
70
+ end
74
71
 
72
+ end
@@ -4,112 +4,110 @@ require_relative 'fn_helper'
4
4
 
5
5
  class TestEval < Test::Unit::TestCase
6
6
 
7
- include FnTestHelper
7
+ include FnTestHelper
8
8
 
9
- def test_eval_questionmark
9
+ def test_eval_questionmark
10
10
 
11
- # See that eval? strips 'if'
12
- cmds = %w(eval? continue)
13
- d = strarray_setup(cmds)
14
- d.start
15
- if 3 > 5
16
- assert false
17
- end
18
- d.stop
19
- out = ['-- ', 'if 3 > 5', 'eval: 3 > 5', 'false']
20
- compare_output(out, d, cmds)
21
-
22
- # See that eval? strips 'if' and 'then'
23
- cmds = %w(eval? continue)
24
- d = strarray_setup(cmds)
25
- d.start
26
- if 3 > 5 then
27
- assert false
28
- end
29
- d.stop
30
- out = ['-- ', 'if 3 > 5 then', 'eval: 3 > 5', 'false']
31
- compare_output(out, d, cmds)
32
-
33
- # See that eval? strips 'unless'
34
- cmds = %w(eval? continue)
35
- d = strarray_setup(cmds)
36
- d.start
37
- unless 3 < 5
38
- assert false
39
- end
40
- d.stop
41
- out = ['-- ', 'unless 3 < 5', 'eval: 3 < 5', 'true']
42
- compare_output(out, d, cmds)
43
-
44
- # See that eval? strips 'unless' and 'then
45
- cmds = %w(eval? continue)
46
- d = strarray_setup(cmds)
47
- d.start
48
- unless 3 < 5 then
49
- assert false
50
- end
51
- d.stop
52
- out = ['-- ', 'unless 3 < 5 then', 'eval: 3 < 5', 'true']
53
- compare_output(out, d, cmds)
54
-
55
- # See that eval? strips 'while'
56
- cmds = %w(eval? continue)
57
- d = strarray_setup(cmds)
58
- d.start
59
- while nil
60
- assert false
61
- end
62
- d.stop
63
- out = ['-- ', 'while nil', 'eval: nil', 'nil']
64
- compare_output(out, d, cmds)
65
-
66
- # See that eval? strips 'while' and 'do'
67
- cmds = %w(eval? continue)
68
- d = strarray_setup(cmds)
69
- d.start
70
- while nil do
71
- assert false
72
- end
73
- d.stop
74
- out = ['-- ', 'while nil do', 'eval: nil', 'nil']
75
- compare_output(out, d, cmds)
76
-
77
- # See that eval? strips 'until' and 'do'
78
- cmds = %w(eval? continue)
79
- d = strarray_setup(cmds)
80
- d.start
81
- until true do
82
- assert false
83
- end
84
- d.stop
85
- out = ['-- ', 'until true do', 'eval: true', 'true']
86
- compare_output(out, d, cmds)
11
+ # See that eval? strips 'if'
12
+ cmds = %w(eval? continue)
13
+ d = strarray_setup(cmds)
14
+ d.start(true)
15
+ if 3 > 5
16
+ assert false
17
+ end
18
+ d.stop
19
+ out = ['line ', 'if 3 > 5', 'eval: 3 > 5', 'false']
20
+ compare_output(out, d, cmds)
87
21
 
88
- # See that eval? strips 'until'
89
- cmds = %w(eval? continue)
90
- d = strarray_setup(cmds)
91
- d.start
92
- until true
93
- assert false
94
- end
95
- d.stop
96
- out = ['-- ', 'until true', 'eval: true', 'true']
97
- compare_output(out, d, cmds)
22
+ # See that eval? strips 'if' and 'then'
23
+ cmds = %w(eval? continue)
24
+ d = strarray_setup(cmds)
25
+ d.start(true)
26
+ if 3 > 5 then
27
+ assert false
28
+ end
29
+ d.stop
30
+ out = ['line ', 'if 3 > 5 then', 'eval: 3 > 5', 'false']
31
+ compare_output(out, d, cmds)
98
32
 
99
- # See that eval? strips 'return'
100
- def five
101
- return 5
102
- end
103
- cmds = %w(step step eval? continue)
104
- d = strarray_setup(cmds)
105
- d.start
106
- five
107
- d.stop
108
- out = ['-- ', 'five', "METHOD TestEval#five()",
109
- '-> ', 'def five', '-- ', 'return 5', 'eval: 5', '5']
110
- compare_output(out, d, cmds)
111
- end
112
-
113
- end
33
+ # See that eval? strips 'unless'
34
+ cmds = %w(eval? continue)
35
+ d = strarray_setup(cmds)
36
+ d.start(true)
37
+ unless 3 < 5
38
+ assert false
39
+ end
40
+ d.stop
41
+ out = ['line ', 'unless 3 < 5', 'eval: 3 < 5', 'true']
42
+ compare_output(out, d, cmds)
43
+
44
+ # See that eval? strips 'unless' and 'then
45
+ cmds = %w(eval? continue)
46
+ d = strarray_setup(cmds)
47
+ d.start(true)
48
+ unless 3 < 5 then
49
+ assert false
50
+ end
51
+ d.stop
52
+ out = ['line ', 'unless 3 < 5 then', 'eval: 3 < 5', 'true']
53
+ compare_output(out, d, cmds)
54
+
55
+ # See that eval? strips 'while'
56
+ cmds = %w(eval? continue)
57
+ d = strarray_setup(cmds)
58
+ d.start(true)
59
+ while nil
60
+ assert false
61
+ end
62
+ d.stop
63
+ out = ['line ', 'while nil', 'eval: nil', 'nil']
64
+ compare_output(out, d, cmds)
114
65
 
66
+ # See that eval? strips 'while' and 'do'
67
+ cmds = %w(eval? continue)
68
+ d = strarray_setup(cmds)
69
+ d.start(true)
70
+ while nil do
71
+ assert false
72
+ end
73
+ d.stop
74
+ out = ['line ', 'while nil do', 'eval: nil', 'nil']
75
+ compare_output(out, d, cmds)
115
76
 
77
+ # See that eval? strips 'until' and 'do'
78
+ cmds = %w(eval? continue)
79
+ d = strarray_setup(cmds)
80
+ d.start(true)
81
+ until true do
82
+ assert false
83
+ end
84
+ d.stop
85
+ out = ['line ', 'until true do', 'eval: true', 'true']
86
+ compare_output(out, d, cmds)
87
+
88
+ # See that eval? strips 'until'
89
+ cmds = %w(eval? continue)
90
+ d = strarray_setup(cmds)
91
+ d.start(true)
92
+ until true
93
+ assert false
94
+ end
95
+ d.stop
96
+ out = ['line ', 'until true', 'eval: true', 'true']
97
+ compare_output(out, d, cmds)
98
+
99
+ # FIXME
100
+ # # See that eval? strips 'return'
101
+ # def five
102
+ # return 5
103
+ # end
104
+ # cmds = %w(step step eval? continue)
105
+ # d = strarray_setup(cmds)
106
+ # d.start(true)
107
+ # five
108
+ # d.stop
109
+ # out = ['line ', 'five', 'call', 'return 5', 'return',
110
+ # '-> ', 'def five', 'line ', 'return 5', 'eval: 5', '5']
111
+ # compare_output(out, d, cmds)
112
+ end
113
+ 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 TestFinish < Test::Unit::TestCase
@@ -8,37 +7,29 @@ class TestFinish < Test::Unit::TestCase
8
7
  include FnTestHelper
9
8
 
10
9
  def test_finish_between_fn
11
-
12
- # Finish over functions
13
- def fact(x)
14
- return 1 if x <= 1
15
- x = x * fact(x-1)
16
- return x
17
- end
18
- cmds = %w(step finish) + ['24 == x', 'continue']
19
- d = strarray_setup(cmds)
20
- d.start
21
- ##############################
22
- x = fact(4)
23
- y = 5
24
- ##############################
25
- d.stop # ({:remove => true})
26
- out = ['-- ',
27
- 'x = fact(4)',
28
- 'METHOD TestFinish#fact(x)',
29
- '-> ',
30
- 'def fact(x)',
31
- '<- ',
32
- 'R=> 24',
33
- 'end',
34
- 'D=> true']
35
- compare_output(out, d, cmds)
10
+ # Finish over functions
11
+ def fact(x)
12
+ return 1 if x <= 1
13
+ x = x * fact(x-1)
14
+ return x
15
+ end
16
+ cmds = %w(step finish) + ['24 == x', 'continue']
17
+ d = strarray_setup(cmds)
18
+ d.start(true)
19
+ ##############################
20
+ x = fact(4)
21
+ y = 5
22
+ ##############################
23
+ d.stop # ({:remove => true})
24
+ out = ['line ',
25
+ 'x = fact(4)',
26
+ 'call ',
27
+ 'return 1 if x <= 1',
28
+ 'return ',
29
+ 'R=> 24',
30
+ 'end',
31
+ 'D=> true']
32
+ compare_output(out, d, cmds)
36
33
  end
37
-
38
- end
39
-
40
-
41
-
42
-
43
-
44
34
 
35
+ end
@@ -1,34 +1,30 @@
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
-
11
8
  def test_step_same_level
12
9
 
13
- puts "FIXME test_step_same_level"
14
- assert true
15
- return
10
+ skip "FIXME test_step_same_level"
11
+
16
12
  # See that we can step with parameter which is the same as 'step 1'
17
13
  cmds = ['next', 'next', 'continue', 'continue']
18
14
  d = strarray_setup(cmds)
19
15
  d.core.step_events = TEST_STEP_EVENT_MASK
20
16
 
21
17
  ########### immediate bug1 ###############
22
- 2.times do
18
+ 2.times do
23
19
  x = 1
24
20
  d.debugger(:immediate => true)
25
21
  y = 2
26
22
  end
27
23
  ##############################
28
24
  d.stop
29
- out = [':o ', 'd.debugger(:immediate => true)',
30
- '-- ', 'y = 2',
31
- '-- ', 'x = 1',
25
+ out = [':o ', 'd.debugger(:immediate => true)',
26
+ 'line ', 'y = 2',
27
+ 'line ', 'x = 1',
32
28
  ':o ', 'd.debugger(:immediate => true)']
33
29
  compare_output(out, d, cmds)
34
30
  end