trepanning 0.1.0 → 0.1.1

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 (181) hide show
  1. data/.gitignore +4 -0
  2. data/ChangeLog +1279 -235
  3. data/Makefile +13 -0
  4. data/NEWS +30 -0
  5. data/Rakefile +50 -14
  6. data/app/.gitignore +1 -0
  7. data/app/breakpoint.rb +7 -2
  8. data/app/brkptmgr.rb +12 -0
  9. data/app/cmd_parse.citrus +167 -0
  10. data/app/cmd_parse.kpeg +221 -0
  11. data/app/cmd_parse.rb +201 -0
  12. data/app/cmd_parser.rb +1914 -0
  13. data/app/complete.rb +79 -0
  14. data/app/condition.rb +1 -1
  15. data/app/core.rb +7 -11
  16. data/app/default.rb +1 -1
  17. data/app/disassemble.rb +3 -2
  18. data/app/file.rb +12 -36
  19. data/app/frame.rb +3 -2
  20. data/app/irb.rb +9 -5
  21. data/app/iseq.rb +46 -0
  22. data/app/options.rb +6 -30
  23. data/app/run.rb +5 -2
  24. data/app/util.rb +1 -2
  25. data/app/yarv.rb +11 -1
  26. data/bin/.gitignore +1 -0
  27. data/bin/trepan +6 -6
  28. data/data/.gitignore +1 -0
  29. data/interface/.gitignore +1 -0
  30. data/interface/base_intf.rb +9 -5
  31. data/interface/comcodes.rb +10 -8
  32. data/interface/user.rb +76 -17
  33. data/io/.gitignore +1 -0
  34. data/io/input.rb +39 -15
  35. data/io/tcpclient.rb +7 -1
  36. data/io/tcpfns.rb +5 -3
  37. data/io/tcpserver.rb +13 -10
  38. data/lib/.gitignore +1 -0
  39. data/lib/trepanning.rb +50 -13
  40. data/processor/.gitignore +1 -0
  41. data/processor/Makefile +7 -0
  42. data/processor/breakpoint.rb +7 -2
  43. data/processor/command/.gitignore +1 -0
  44. data/processor/command/Makefile +7 -0
  45. data/processor/command/alias.rb +2 -2
  46. data/processor/command/backtrace.rb +4 -0
  47. data/processor/command/base/cmd.rb +45 -2
  48. data/processor/command/base/subcmd.rb +4 -2
  49. data/processor/command/base/submgr.rb +23 -19
  50. data/processor/command/base/subsubcmd.rb +23 -1
  51. data/processor/command/base/subsubmgr.rb +13 -0
  52. data/processor/command/break.rb +34 -29
  53. data/processor/command/complete.rb +37 -0
  54. data/processor/command/condition.rb +2 -0
  55. data/processor/command/continue.rb +15 -18
  56. data/processor/command/disassemble.rb +5 -0
  57. data/processor/command/down.rb +1 -1
  58. data/processor/command/eval.rb +70 -0
  59. data/processor/command/exit.rb +4 -1
  60. data/processor/command/finish.rb +6 -4
  61. data/processor/command/frame.rb +6 -3
  62. data/processor/command/help.rb +97 -54
  63. data/processor/command/help/.gitignore +1 -0
  64. data/processor/command/help/README +10 -0
  65. data/processor/command/help/command.txt +48 -0
  66. data/processor/command/help/filename.txt +40 -0
  67. data/processor/command/help/location.txt +37 -0
  68. data/processor/command/info_subcmd/.gitignore +1 -0
  69. data/processor/command/info_subcmd/breakpoints.rb +9 -9
  70. data/processor/command/info_subcmd/{file.rb → files.rb} +92 -27
  71. data/processor/command/info_subcmd/frame.rb +41 -15
  72. data/processor/command/info_subcmd/iseq.rb +39 -17
  73. data/processor/command/info_subcmd/program.rb +2 -8
  74. data/processor/command/info_subcmd/registers.rb +12 -10
  75. data/processor/command/info_subcmd/registers_subcmd/.gitignore +1 -0
  76. data/processor/command/info_subcmd/ruby.rb +60 -0
  77. data/processor/command/irb.rb +26 -3
  78. data/processor/command/kill.rb +21 -10
  79. data/processor/command/list.rb +1 -1
  80. data/processor/command/macro.rb +37 -23
  81. data/processor/command/pr.rb +1 -1
  82. data/processor/command/reload.rb +4 -0
  83. data/processor/command/reload_subcmd/.gitignore +1 -0
  84. data/processor/command/restart.rb +9 -9
  85. data/processor/command/save.rb +29 -36
  86. data/processor/command/set_subcmd/.gitignore +1 -0
  87. data/processor/command/set_subcmd/auto_subcmd/.gitignore +1 -0
  88. data/processor/command/set_subcmd/confirm.rb +23 -0
  89. data/processor/command/set_subcmd/debug_subcmd/.gitignore +1 -0
  90. data/processor/command/set_subcmd/different.rb +2 -0
  91. data/processor/command/set_subcmd/events.rb +2 -0
  92. data/processor/command/set_subcmd/max.rb +9 -12
  93. data/processor/command/set_subcmd/max_subcmd/.gitignore +1 -0
  94. data/processor/command/set_subcmd/substitute_subcmd/.gitignore +1 -0
  95. data/processor/command/set_subcmd/trace.rb +7 -13
  96. data/processor/command/set_subcmd/trace_subcmd/.gitignore +1 -0
  97. data/processor/command/set_subcmd/trace_subcmd/buffer.rb +12 -27
  98. data/processor/command/set_subcmd/trace_subcmd/print.rb +10 -8
  99. data/processor/command/set_subcmd/trace_subcmd/var.rb +6 -10
  100. data/processor/command/show.rb +12 -1
  101. data/processor/command/show_subcmd/.gitignore +1 -0
  102. data/processor/command/show_subcmd/alias.rb +11 -15
  103. data/processor/command/show_subcmd/auto_subcmd/.gitignore +1 -0
  104. data/processor/command/show_subcmd/basename.rb +1 -9
  105. data/processor/command/show_subcmd/confirm.rb +25 -0
  106. data/processor/command/show_subcmd/debug_subcmd/.gitignore +1 -0
  107. data/processor/command/show_subcmd/macro.rb +32 -14
  108. data/processor/command/show_subcmd/max_subcmd/.gitignore +1 -0
  109. data/processor/command/show_subcmd/trace_subcmd/.gitignore +1 -0
  110. data/processor/command/show_subcmd/trace_subcmd/buffer.rb +11 -31
  111. data/processor/command/show_subcmd/trace_subcmd/print.rb +4 -20
  112. data/processor/command/source.rb +7 -1
  113. data/processor/command/up.rb +7 -4
  114. data/processor/default.rb +3 -1
  115. data/processor/eval.rb +13 -0
  116. data/processor/eventbuf.rb +3 -2
  117. data/processor/frame.rb +19 -0
  118. data/processor/help.rb +20 -0
  119. data/processor/load_cmds.rb +143 -24
  120. data/processor/location.rb +61 -10
  121. data/processor/main.rb +30 -11
  122. data/processor/mock.rb +5 -3
  123. data/processor/msg.rb +17 -0
  124. data/processor/running.rb +1 -1
  125. data/processor/subcmd.rb +3 -2
  126. data/processor/validate.rb +173 -185
  127. data/sample/.gitignore +1 -0
  128. data/sample/list-terminal-colors.rb +139 -0
  129. data/sample/rocky-dot-trepanrc +14 -0
  130. data/sample/rocky-trepan-colors.rb +47 -0
  131. data/test/Makefile +7 -0
  132. data/test/data/.gitignore +1 -0
  133. data/test/data/debugger-stop.cmd +3 -0
  134. data/test/data/debugger-stop.right +5 -0
  135. data/test/data/fname-with-blank.right +0 -3
  136. data/test/data/quit.right +0 -1
  137. data/test/data/quit2.cmd +6 -0
  138. data/test/data/quit2.right +3 -0
  139. data/test/data/testing.cmd +1 -0
  140. data/test/example/.gitignore +1 -0
  141. data/test/example/debugger-stop.rb +14 -0
  142. data/test/functional/.gitignore +2 -0
  143. data/test/functional/fn_helper.rb +7 -9
  144. data/test/functional/test-break-long.rb +7 -7
  145. data/test/functional/test-break.rb +7 -7
  146. data/test/functional/test-condition.rb +4 -4
  147. data/test/functional/test-delete.rb +6 -5
  148. data/test/functional/test-eval.rb +115 -0
  149. data/test/functional/test-raise.rb +1 -1
  150. data/test/functional/test-return.rb +1 -1
  151. data/test/integration/.gitignore +2 -0
  152. data/test/integration/helper.rb +6 -3
  153. data/test/integration/test-debugger-stop.rb +22 -0
  154. data/test/integration/test-quit.rb +8 -0
  155. data/test/unit/.gitignore +1 -0
  156. data/test/unit/Makefile +7 -0
  157. data/test/unit/test-app-brkpt.rb +0 -1
  158. data/test/unit/test-app-cmd_parse.rb +107 -0
  159. data/test/unit/test-app-cmd_parser.rb +22 -0
  160. data/test/unit/test-app-complete.rb +38 -0
  161. data/test/unit/test-app-condition.rb +20 -0
  162. data/test/unit/test-app-iseq.rb +31 -0
  163. data/test/unit/test-app-options.rb +9 -1
  164. data/test/unit/test-app-util.rb +0 -1
  165. data/test/unit/test-base-cmd.rb +46 -0
  166. data/test/unit/test-base-subcmd.rb +11 -2
  167. data/test/unit/test-base-submgr.rb +23 -0
  168. data/test/unit/test-base-subsubcmd.rb +20 -0
  169. data/test/unit/test-cmd-break.rb +22 -23
  170. data/test/unit/test-cmd-help.rb +4 -0
  171. data/test/unit/test-completion.rb +43 -0
  172. data/test/unit/test-io-tcpclient.rb +3 -2
  173. data/test/unit/test-proc-load_cmds.rb +10 -1
  174. data/test/unit/test-proc-location.rb +39 -0
  175. data/test/unit/test-proc-main.rb +1 -1
  176. data/test/unit/test-proc-validate.rb +47 -31
  177. data/trepanning.gemspec +45 -0
  178. metadata +247 -179
  179. data/app/core.rb-consider +0 -198
  180. data/test/functional/tmp/b3.rb +0 -5
  181. data/test/functional/tmp/immediate-bug1.rb +0 -9
data/sample/.gitignore ADDED
@@ -0,0 +1 @@
1
+ /*~
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env ruby
2
+ # Run this program in a terminal window to see a list of terminal colors
3
+ # the assignments are the defaults as of Jan 18, 2011, but you may want to
4
+ # double check.
5
+ require 'rubygems'
6
+ require 'coderay'
7
+ require 'term/ansicolor'
8
+
9
+ TOKEN_COLORS = {
10
+ :annotation => '35',
11
+ :attribute_name => '33',
12
+ :attribute_name_fat => '33',
13
+ :attribute_value => '31',
14
+ :attribute_value_fat => '31',
15
+ :bin => '1;35',
16
+ :char => {:self => '36', :delimiter => '34'},
17
+ :class => '1;35',
18
+ :class_variable => '36',
19
+ :color => '32',
20
+ :comment => '37',
21
+ :complex => '34',
22
+ :constant => ['34', '4'],
23
+ :decoration => '35',
24
+ :definition => '1;32',
25
+ :directive => ['32', '4'],
26
+ :doc => '46',
27
+ :doctype => '1;30',
28
+ :doc_string => ['31', '4'],
29
+ :entity => '33',
30
+ :error => ['1;33', '41'],
31
+ :exception => '1;31',
32
+ :float => '1;35',
33
+ :function => '1;34',
34
+ :global_variable => '42',
35
+ :hex => '1;36',
36
+ :important => '1;31',
37
+ :include => '33',
38
+ :integer => '1;34',
39
+ :interpreted => '1;35',
40
+ :key => '35',
41
+ :label => '1;4',
42
+ :local_variable => '33',
43
+ :oct => '1;35',
44
+ :operator_name => '1;29',
45
+ :pre_constant => '1;36',
46
+ :pre_type => '1;30',
47
+ :predefined => ['4', '1;34'],
48
+ :preprocessor => '36',
49
+ :pseudo_class => '34',
50
+ :regexp => {
51
+ :content => '31',
52
+ :delimiter => '1;29',
53
+ :modifier => '35',
54
+ :function => '1;29'
55
+ },
56
+ :reserved => '1;31',
57
+ :shell => {
58
+ :self => '42',
59
+ :content => '1;29',
60
+ :delimiter => '37',
61
+ },
62
+ :string => {
63
+ :self => '32',
64
+ :modifier => '1;32',
65
+ :escape => '1;36',
66
+ :delimiter => '1;32',
67
+ },
68
+ :symbol => '1;32',
69
+ :tag => '34',
70
+ :tag_fat => '1;34',
71
+ :tag_special => ['34', '4'],
72
+ :type => '1;34',
73
+ :value => '36',
74
+ :variable => '34',
75
+ :insert => '42',
76
+ :delete => '41',
77
+ :change => '44',
78
+ :head => '45',
79
+ }
80
+ TOKEN_COLORS[:keyword] = TOKEN_COLORS[:reserved]
81
+ TOKEN_COLORS[:method] = TOKEN_COLORS[:function]
82
+ TOKEN_COLORS[:imaginary] = TOKEN_COLORS[:complex]
83
+ TOKEN_COLORS[:open] = TOKEN_COLORS[:close] = TOKEN_COLORS[:nesting_delimiter] = TOKEN_COLORS[:escape] = TOKEN_COLORS[:delimiter]
84
+
85
+ # require 'trepanning'; debugger
86
+ %w(annotation
87
+ attribute_name
88
+ attribute_name_fat
89
+ attribute_value
90
+ attribute_value_fat
91
+ bin
92
+ class
93
+ class_variable
94
+ color
95
+ comment
96
+ complex
97
+ constant
98
+ decoration
99
+ definition
100
+ doc
101
+ doctype
102
+ entity
103
+ exception
104
+ float
105
+ function
106
+ global_variable
107
+ hex
108
+ important
109
+ include
110
+ integer
111
+ interpreted
112
+ key
113
+ label
114
+ local_variable
115
+ oct
116
+ operator_name
117
+ pre_constant
118
+ pre_type
119
+ predefined
120
+ preprocessor
121
+ pseudo_class
122
+ reserved
123
+ symbol
124
+ tag
125
+ tag_fat
126
+ type
127
+ value
128
+ variable
129
+ insert
130
+ delete
131
+ change
132
+ head
133
+ ).each do |name|
134
+ puts "\e[#{TOKEN_COLORS[name.to_sym]}m#{name} - #{TOKEN_COLORS[name.to_sym].inspect}\e[0m"
135
+ end
136
+ %w(bold italic underline).each do |name|
137
+ attrib=Term::ANSIColor.send(name)
138
+ puts "#{attrib}#{name} - #{attrib.inspect}\e[0m"
139
+ end
@@ -0,0 +1,14 @@
1
+ # Rocky's trepanx profile for Rubinius.
2
+
3
+ # Place where I have Rubinius source (in rvm)
4
+ dir /home/rocky-rvm/.rvm/src/rbx-head/
5
+
6
+ set autoeval on # Is default, but just in case
7
+ # set highlight on # turn on syntax highlight by default
8
+
9
+ # My customization to the default syntax coloring
10
+ load "#{ENV['HOME']}/.trepanx-colors.rb"
11
+
12
+ # let me know that this ran...
13
+ puts "Rocky's .trepanxrc loaded"
14
+
@@ -0,0 +1,47 @@
1
+ # Terminal color settings I use. I doubt terminal colors are
2
+ # standardized let alone what colors you want for the various
3
+ # syntax elements. So you should adjust as desired.
4
+
5
+ # Values are either a number string, e.g. '36' or a pair of number
6
+ # semicolon and number, e.g. '3;36'.
7
+ #
8
+ # The first number before a semicolon is a font modifier from the
9
+ # following table:
10
+ #
11
+ # 1 - bold
12
+ # 3 - italic
13
+ # 4 - underline
14
+
15
+ require 'rubygems'
16
+ require 'coderay'
17
+ require 'coderay/encoders/term'
18
+ TERM_TOKEN_COLORS = {
19
+ :comment => '3;37', # sienna #8b4726
20
+ :constant => '1;34', # Bold Midnight Blue #191970
21
+ :class => '1;2', #
22
+ :doctype => '1;2', #
23
+ :global_variable => '36', # yellow brownish
24
+ :integer => '29', # black #00000
25
+ :label => '4', # black underline
26
+ :method => '34', # blue #0000FF
27
+ :pre_constant => '3;33', # goldenrod4 #8b6914
28
+ :regexp => {
29
+ :content => '36', # dark cyan #008b8b
30
+ :delimiter => '1;29', # bold black
31
+ :modifier => '35',
32
+ :function => '1;29'
33
+ },
34
+ :string => {
35
+ :content => '1;37', # ivory4 (grey) #8b8b83
36
+ :delimiter => '1;29', # bold black
37
+ },
38
+ :reserved => '1;32', # bold dark olive green #556b2f RGB: 85, 107, 47
39
+ :symbol => '35', # purple4 #551A8B RGB: 85, 26, 139
40
+ }
41
+ module CodeRay::Encoders
42
+ class Term < Encoder
43
+ TERM_TOKEN_COLORS.each_pair do |key, value|
44
+ TOKEN_COLORS[key] = value
45
+ end
46
+ end
47
+ end
data/test/Makefile ADDED
@@ -0,0 +1,7 @@
1
+ # Whatever it is you want to do, it should be forwarded to the
2
+ # to top-level irectories
3
+ PHONY=check all
4
+ all: check
5
+
6
+ %:
7
+ $(MAKE) -C .. $@
@@ -0,0 +1 @@
1
+ /*~
@@ -0,0 +1,3 @@
1
+ continue
2
+
3
+
@@ -0,0 +1,5 @@
1
+ -- debugger-stop.rb:14 @1955)
2
+ Foo::five
3
+ (trepan): Program stop event: line; PC offset 100 <top debugger-stop.rb>
4
+ -- debugger-stop.rb:10 @1954)
5
+ 5
@@ -1,4 +1 @@
1
1
  -> (fname with blank.rb:1 @0)
2
- puts "Ha!"
3
- basename is off.
4
- Ha!
data/test/data/quit.right CHANGED
@@ -1,2 +1 @@
1
1
  -> (null.rb:1 @0)
2
- x = 1
@@ -0,0 +1,6 @@
1
+ # ***************************************************
2
+ # This tests the quit via "set confirm off"
3
+ # ***************************************************
4
+ # FIXME need to test --no-quit.
5
+ set confirm off
6
+ quit
@@ -0,0 +1,3 @@
1
+ -> (null.rb:1 @0)
2
+ # Nothing here. Move along.
3
+ confirm is off.
@@ -0,0 +1 @@
1
+ continue
@@ -0,0 +1 @@
1
+ /*~
@@ -0,0 +1,14 @@
1
+ # !/usr/bin/env ruby
2
+ # Bug in debugger stopping where we were inside debugger was stopping
3
+ # inside itself because multiple debugger names in the presence of modules
4
+ #
5
+ require_relative '../../lib/trepanning'
6
+ module Foo
7
+ module_function
8
+ def five
9
+ debugger # Resolves to Module#debugger not Kernel#debugger
10
+ 5
11
+ end
12
+ end
13
+ debugger(:nx=>true)
14
+ Foo::five
@@ -0,0 +1,2 @@
1
+ /*~
2
+ /tmp
@@ -84,21 +84,19 @@ module FnTestHelper
84
84
 
85
85
  # Canonicalize breakpoint messages.
86
86
  # For example:
87
- # Set breakpoint 1: test/functional/test-tbreak.rb:10 (@0)
87
+ # Breakpoint 1 set at VM offset 10
88
88
  # becomes :
89
- # Set breakpoint 1: foo.rb:55 (@3)
89
+ # Breakpoint 1 set at VM offset 55
90
90
  a3 = a2.map do |s|
91
- s.gsub(/^Breakpoint (\d+) set at line (\d+) in file .+,/,
92
- 'Breakpoint \1 set at line 55 in file foo.rb,')
91
+ s.gsub(/^Breakpoint (\d+) set at VM offset (\d+)/,
92
+ 'Breakpoint \1 set at VM offset 55')
93
93
  end
94
94
 
95
- # Remove VM offset locations.
96
- # For example:
97
- # VM offset 2 of instruction sequence "block in compare_output".
95
+ # line 14 in file test/functional/test-break.rb.
98
96
  # becomes
99
- # VM offset 55 of instruction sequence "block in compare_output".
97
+ # line 55 of file foo.rb
100
98
  a4 = a3.map do |s|
101
- s.gsub(/VM offset \d+/, 'VM offset 55')
99
+ s.gsub(/line (\d+) in file .+/, 'line 55 in file foo.rb')
102
100
  end
103
101
  return a4
104
102
  end
@@ -4,7 +4,7 @@ require 'trace'
4
4
  require_relative 'fn_helper'
5
5
  require_relative '../../app/breakpoint'
6
6
 
7
- class TestBreak < Test::Unit::TestCase
7
+ class TestBreakLong < Test::Unit::TestCase
8
8
 
9
9
  include FnTestHelper
10
10
 
@@ -29,8 +29,8 @@ class TestBreak < Test::Unit::TestCase
29
29
  out = ['-- ',
30
30
  'x = 5',
31
31
  'basename is on.',
32
- "Breakpoint 1 set at line 55 in file foo.rb,
33
- \tVM offset 55 of instruction sequence \"test_break_same_level\".",
32
+ "Breakpoint 1 set at VM offset 55 of instruction sequence \"test_break_same_level\",
33
+ \tline 55 in file foo.rb",
34
34
  'xx ',
35
35
  'z = 7']
36
36
  compare_output(out, d, cmds)
@@ -52,10 +52,10 @@ class TestBreak < Test::Unit::TestCase
52
52
  out = ['-- ',
53
53
  'x = 7',
54
54
  "basename is on.",
55
- "Breakpoint 1 set at line 55 in file foo.rb,
56
- \tVM offset 55 of instruction sequence \"test_break_same_level\".",
57
- "Breakpoint 2 set at line 55 in file foo.rb,
58
- \tVM offset 55 of instruction sequence \"test_break_same_level\".",
55
+ "Breakpoint 1 set at VM offset 55 of instruction sequence \"test_break_same_level\",
56
+ \tline 55 in file foo.rb",
57
+ "Breakpoint 2 set at VM offset 55 of instruction sequence \"test_break_same_level\",
58
+ \tline 55 in file foo.rb",
59
59
  "Breakpoint 1 disabled.",
60
60
  'xx ',
61
61
  'z = 8+1']
@@ -2,7 +2,7 @@
2
2
  require 'test/unit'
3
3
  require_relative 'fn_helper'
4
4
 
5
- class TestBreak2 < Test::Unit::TestCase
5
+ class TestBreak < Test::Unit::TestCase
6
6
 
7
7
  include FnTestHelper
8
8
 
@@ -31,12 +31,12 @@ class TestBreak2 < Test::Unit::TestCase
31
31
  d.stop # ({:remove => true})
32
32
  out = ["-- ",
33
33
  "1.times do # line + 10",
34
- "Breakpoint 1 set at line 55 in file foo.rb,
35
- \tVM offset 55 of instruction sequence \"test_line_only_break\".",
36
- "Breakpoint 2 set at line 55 in file foo.rb,
37
- \tVM offset 55 of instruction sequence \"block (2 levels) in test_line_only_break\".",
38
- "Breakpoint 3 set at line 55 in file foo.rb,
39
- \tVM offset 55 of instruction sequence \"block in test_line_only_break\".",
34
+ "Breakpoint 1 set at VM offset 55 of instruction sequence \"test_line_only_break\",
35
+ \tline 55 in file foo.rb",
36
+ "Breakpoint 2 set at VM offset 55 of instruction sequence \"block (2 levels) in test_line_only_break\",
37
+ \tline 55 in file foo.rb",
38
+ "Breakpoint 3 set at VM offset 55 of instruction sequence \"block in test_line_only_break\",
39
+ \tline 55 in file foo.rb",
40
40
  "xx ",
41
41
  "x = 11 # line + 11",
42
42
  "xx ",
@@ -27,8 +27,8 @@ class TestBreak < Test::Unit::TestCase
27
27
  out = ['-- ',
28
28
  'x = 6',
29
29
  'basename is on.',
30
- "Breakpoint 1 set at line 55 in file foo.rb,
31
- \tVM offset 55 of instruction sequence \"test_condition\"."]
30
+ "Breakpoint 1 set at VM offset 55 of instruction sequence \"test_condition\",
31
+ \tline 55 in file foo.rb"]
32
32
  compare_output(out, d, cmds)
33
33
 
34
34
  # Try a condition that fails
@@ -47,8 +47,8 @@ class TestBreak < Test::Unit::TestCase
47
47
  out = ["-- ",
48
48
  "x = 6",
49
49
  "basename is on.",
50
- "Breakpoint 1 set at line 55 in file foo.rb,
51
- \tVM offset 55 of instruction sequence \"test_condition\".",
50
+ "Breakpoint 1 set at VM offset 55 of instruction sequence \"test_condition\",
51
+ \tline 55 in file foo.rb",
52
52
  "xx ",
53
53
  "y = 7"]
54
54
  compare_output(out, d, cmds)
@@ -29,7 +29,8 @@ class TestDelete < Test::Unit::TestCase
29
29
  out = ['-- ',
30
30
  'va = 1',
31
31
  'basename is on.',
32
- "Breakpoint 1 set at line 55 in file foo.rb,\n\tVM offset 55 of instruction sequence \"test_delete\".",
32
+ "Breakpoint 1 set at VM offset 55 of instruction sequence \"test_delete\",
33
+ \tline 55 in file foo.rb",
33
34
  "Deleted breakpoint 1."]
34
35
  compare_output(out, d, cmds)
35
36
 
@@ -57,10 +58,10 @@ class TestDelete < Test::Unit::TestCase
57
58
  "va = 1",
58
59
  "basename is on.",
59
60
  "Evaluation of unrecognized debugger commands is on.",
60
- "Breakpoint 1 set at line 55 in file foo.rb,
61
- \tVM offset 55 of instruction sequence \"test_delete\".",
62
- "Breakpoint 2 set at line 55 in file foo.rb,
63
- \tVM offset 55 of instruction sequence \"test_delete\".",
61
+ "Breakpoint 1 set at VM offset 55 of instruction sequence \"test_delete\",
62
+ \tline 55 in file foo.rb",
63
+ "Breakpoint 2 set at VM offset 55 of instruction sequence \"test_delete\",
64
+ \tline 55 in file foo.rb",
64
65
  "Deleted breakpoint 1.",
65
66
  "xx ",
66
67
  "vd = 4",
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+ require_relative 'fn_helper'
4
+
5
+ class TestEval < Test::Unit::TestCase
6
+
7
+ include FnTestHelper
8
+
9
+ def test_eval_questionmark
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)
87
+
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)
98
+
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
114
+
115
+