rbx-trepanning 0.0.6-universal-rubinius-1.2 → 0.0.7-universal-rubinius-1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. data/.gitignore +5 -0
  2. data/ChangeLog +161 -0
  3. data/Makefile +13 -0
  4. data/NEWS +11 -0
  5. data/Rakefile +6 -5
  6. data/app/.gitignore +2 -0
  7. data/app/breakpoint.rb +53 -36
  8. data/app/brkptmgr.rb +10 -0
  9. data/app/complete.rb +29 -2
  10. data/app/condition.rb +22 -0
  11. data/app/default.rb +1 -0
  12. data/app/eventbuffer.rb +147 -0
  13. data/app/frame.rb +3 -1
  14. data/app/options.rb +2 -2
  15. data/app/run.rb +5 -3
  16. data/bin/.gitignore +2 -0
  17. data/data/.gitignore +2 -0
  18. data/doc/.gitignore +1 -0
  19. data/doc/debugger.html +108 -0
  20. data/interface/.gitignore +2 -0
  21. data/interface/user.rb +8 -7
  22. data/io/.gitignore +3 -0
  23. data/io/input.rb +14 -8
  24. data/lib/.gitignore +2 -0
  25. data/lib/trepanning.rb +25 -33
  26. data/processor/.gitignore +3 -0
  27. data/processor/Makefile +7 -0
  28. data/processor/breakpoint.rb +4 -0
  29. data/processor/command/.gitignore +2 -0
  30. data/processor/command/backtrace.rb +5 -0
  31. data/processor/command/base/.gitignore +2 -0
  32. data/processor/command/base/subcmd.rb +2 -1
  33. data/processor/command/base/subsubcmd.rb +23 -1
  34. data/processor/command/base/subsubmgr.rb +2 -1
  35. data/processor/command/complete.rb +2 -1
  36. data/processor/command/condition.rb +62 -0
  37. data/processor/command/down.rb +4 -4
  38. data/processor/command/eval.rb +14 -6
  39. data/processor/command/exit.rb +8 -7
  40. data/processor/command/frame.rb +6 -2
  41. data/processor/command/info_subcmd/.gitignore +3 -0
  42. data/processor/command/info_subcmd/breakpoints.rb +8 -0
  43. data/processor/command/info_subcmd/files.rb +1 -1
  44. data/processor/command/info_subcmd/line.rb +1 -1
  45. data/processor/command/info_subcmd/ruby.rb +1 -1
  46. data/processor/command/kill.rb +21 -10
  47. data/processor/command/macro.rb +15 -23
  48. data/processor/command/set_subcmd/.gitignore +2 -0
  49. data/processor/command/set_subcmd/auto_subcmd/.gitignore +2 -0
  50. data/processor/command/set_subcmd/debug_subcmd/.gitignore +2 -0
  51. data/processor/command/set_subcmd/different.rb +2 -0
  52. data/processor/command/set_subcmd/max_subcmd/.gitignore +2 -0
  53. data/processor/command/set_subcmd/substitute_subcmd/.gitignore +3 -0
  54. data/processor/command/set_subcmd/trace_subcmd/.gitignore +2 -0
  55. data/processor/command/set_subcmd/trace_subcmd/buffer.rb +42 -0
  56. data/processor/command/set_subcmd/trace_subcmd/print.rb +13 -29
  57. data/processor/command/show_subcmd/.gitignore +3 -0
  58. data/processor/command/show_subcmd/alias.rb +7 -3
  59. data/processor/command/show_subcmd/auto_subcmd/.gitignore +3 -0
  60. data/processor/command/show_subcmd/auto_subcmd/irb.rb +1 -1
  61. data/processor/command/show_subcmd/debug_subcmd/.gitignore +3 -0
  62. data/processor/command/show_subcmd/macro.rb +62 -0
  63. data/processor/command/show_subcmd/max_subcmd/.gitignore +2 -0
  64. data/processor/command/show_subcmd/trace_subcmd/.gitignore +2 -0
  65. data/processor/command/show_subcmd/trace_subcmd/buffer.rb +64 -0
  66. data/processor/command/show_subcmd/trace_subcmd/print.rb +5 -20
  67. data/processor/command/source.rb +7 -0
  68. data/processor/command/up.rb +12 -8
  69. data/processor/eventbuf.rb +101 -0
  70. data/processor/frame.rb +19 -1
  71. data/processor/hook.rb +2 -2
  72. data/processor/load_cmds.rb +57 -49
  73. data/processor/location.rb +40 -0
  74. data/processor/main.rb +27 -26
  75. data/processor/msg.rb +17 -0
  76. data/processor/stepping.rb +21 -1
  77. data/processor/validate.rb +1 -0
  78. data/rbx-trepanning.gemspec +40 -0
  79. data/sample/.gitignore +2 -0
  80. data/test/data/.gitignore +1 -0
  81. data/test/example/.gitignore +2 -0
  82. data/test/functional/.gitignore +3 -0
  83. data/test/functional/test-finish.rb +2 -2
  84. data/test/integration/.gitignore +3 -0
  85. data/test/unit/.gitignore +3 -0
  86. data/test/unit/cmd-helper.rb +6 -2
  87. data/test/unit/test-app-brkpt.rb +14 -12
  88. data/test/unit/test-app-complete.rb +39 -0
  89. data/test/unit/test-app-condition.rb +18 -0
  90. data/test/unit/test-app-options.rb +8 -1
  91. data/test/unit/test-base-subsubcmd.rb +21 -0
  92. data/test/unit/test-cmd-finish.rb +4 -0
  93. data/test/unit/test-completion.rb +11 -6
  94. data/test/unit/test-proc-load_cmds.rb +2 -2
  95. metadata +295 -218
  96. data/app/breakpoint.rbc +0 -3551
  97. data/app/brkptmgr.rbc +0 -2903
  98. data/app/client.rbc +0 -1225
  99. data/app/complete.rbc +0 -1288
  100. data/app/default.rbc +0 -1132
  101. data/app/display.rbc +0 -2578
  102. data/app/frame.rbc +0 -1808
  103. data/app/irb.rbc +0 -2094
  104. data/app/iseq.rbc +0 -2192
  105. data/app/llvm.rbc +0 -2478
  106. data/app/method.rbc +0 -2492
  107. data/app/method_name.rbc +0 -2467
  108. data/app/mock.rbc +0 -398
  109. data/app/options.rbc +0 -2898
  110. data/app/rbx-llvm.rbc +0 -2478
  111. data/app/run.rbc +0 -1244
  112. data/app/util.rbc +0 -1146
  113. data/app/validate.rbc +0 -676
  114. data/bin/trepan.compiled.rbc +0 -1043
  115. data/bin/trepanx.compiled.rbc +0 -1049
  116. data/data/irbrc.compiled.rbc +0 -640
  117. data/interface/base_intf.rbc +0 -1899
  118. data/interface/client.rbc +0 -1072
  119. data/interface/comcodes.rbc +0 -385
  120. data/interface/script.rbc +0 -1642
  121. data/interface/server.rbc +0 -2213
  122. data/interface/user.rbc +0 -2867
  123. data/io/base_io.rbc +0 -2111
  124. data/io/input.rbc +0 -2528
  125. data/io/null_output.rbc +0 -730
  126. data/io/string_array.rbc +0 -2466
  127. data/io/tcpclient.rbc +0 -2419
  128. data/io/tcpfns.rbc +0 -694
  129. data/io/tcpserver.rbc +0 -2638
  130. data/lib/trepanning.rbc +0 -7705
  131. data/lib/trepanning2.rb +0 -441
  132. data/sample/list-terminal-colors.rbc +0 -2318
  133. data/sample/rocky-trepanx-colors.rbc +0 -530
  134. data/test/data/step-bug.cmd +0 -11
  135. data/test/data/step-bug.right +0 -3
  136. data/test/example/step-bug.rb +0 -14
  137. data/test/integration/skip-test-step-bug.rb +0 -17
@@ -42,7 +42,7 @@ class TestFinish < Test::Unit::TestCase
42
42
  def five; 5 end
43
43
  def something(x)
44
44
  return 1 if x <= 1
45
- x =
45
+ x =
46
46
  if five > 5
47
47
  24
48
48
  else
@@ -63,7 +63,7 @@ class TestFinish < Test::Unit::TestCase
63
63
  '-> ',
64
64
  'return 1 if x <= 1',
65
65
  '<- ',
66
- '22', '22']
66
+ 'x =', '22']
67
67
  compare_output(out, d, cmds)
68
68
  end
69
69
 
@@ -0,0 +1,3 @@
1
+ /*.out
2
+ /*~
3
+ /*.rbc
@@ -0,0 +1,3 @@
1
+ /*.rbc
2
+ /*~
3
+
@@ -9,6 +9,7 @@ require_relative '../../processor/frame'
9
9
 
10
10
  module UnitHelper
11
11
 
12
+ module_function
12
13
  def common_setup
13
14
  @dbg = MockDebugger::MockDebugger.new(:nx => true)
14
15
  @cmdproc = Trepan::CmdProcessor.new(@dbg)
@@ -33,13 +34,16 @@ module UnitHelper
33
34
  end
34
35
  reset_cmdproc_vars
35
36
  end
36
- module_function :common_setup
37
+
38
+ def common_teardown
39
+ @cmdproc.finalize
40
+ end
37
41
 
38
42
  def reset_cmdproc_vars
39
43
  @cmdproc.instance_variable_set('@msgs', [])
40
44
  @cmdproc.instance_variable_set('@errmsgs', [])
41
45
  end
42
- module_function :reset_cmdproc_vars
46
+
43
47
  end
44
48
 
45
49
  if __FILE__ == $0
@@ -11,19 +11,21 @@ class TestAppBrkpt < Test::Unit::TestCase
11
11
  assert_equal(false, b1.temp?)
12
12
  assert_equal(0, b1.hits)
13
13
  assert_equal('B', b1.icon_char)
14
- # assert_equal(true, b1.condition?)
15
- # assert_equal(1, b1.hits)
16
- # assert_equal(b1.source_container, tf.source_container)
14
+ assert_equal(true, b1.condition?(binding))
15
+ assert_equal(1, b1.hits)
17
16
  b1.enabled = false
17
+ assert_equal(false, b1.active?)
18
18
  assert_equal('b', b1.icon_char)
19
- # assert_raises TypeError do
20
- # Trepan::Breakpoint.new(iseq, iseq.iseq_size, :temp => true)
21
- # end
22
- # assert_raises TypeError do
23
- # Trepan::Breakpoint.new(0, 5)
24
- # end
25
- # require_relative '../../lib/trepanning.rb'
26
- b2 = Trepan::Breakpoint.new('temp brkpt', method, 2, 3, 0, :temp => true)
27
- assert_equal('t', b2.icon_char)
19
+ assert_raises ArgumentError do
20
+ b1.activate
21
+ end
22
+
23
+ b2 = Trepan::Breakpoint.new('<start>', method, 0, 2, 0)
24
+ b2.activate
25
+ assert_equal(true, b2.active?)
26
+ b2.remove!
27
+ assert_equal(false, b2.active?)
28
+ b3 = Trepan::Breakpoint.new('temp brkpt', method, 2, 3, 0, :temp => true)
29
+ assert_equal('t', b3.icon_char)
28
30
  end
29
31
  end
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../../app/complete'
5
+
6
+ class TestAppUtil < Test::Unit::TestCase
7
+ include Trepan::Complete
8
+ def test_complete
9
+ hash = {'ab' => 1, 'aac' => 2, 'aa' => 3, 'a' => 4}
10
+ ary = hash.keys.sort
11
+ [[[], 'b'], [ary, 'a'], [%w(aa aac), 'aa'],
12
+ [ary, ''], [['ab'], 'ab'], [[], 'abc']].each do |result, prefix|
13
+ assert_equal(result, complete_token(ary, prefix),
14
+ "Trouble matching #{ary}.inspect on #{prefix.inspect}")
15
+ end
16
+ [[ary, 'a'], [%w(aa aac), 'aa'],
17
+ [['ab'], 'ab'], [[], 'abc']].each do |result_keys, prefix|
18
+ result = result_keys.map {|key| [key, hash[key]]}
19
+ assert_equal(result, complete_token_with_next(hash, prefix),
20
+ "Trouble matching #{hash}.inspect on #{prefix.inspect}")
21
+ end
22
+
23
+ end
24
+
25
+ def test_next_token
26
+ x = ' now is the time'
27
+ [[0, [ 5, 'now']],
28
+ [2, [ 5, 'now']],
29
+ [5, [ 8, 'is']],
30
+ [8, [13, 'the']],
31
+ [9, [13, 'the']],
32
+ [13, [19, 'time']],
33
+ [19, [19, '']],
34
+ ].each do |pos, expect|
35
+ assert_equal expect, next_token(x, pos)
36
+ end
37
+ end
38
+
39
+ end
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ require 'stringio'
3
+ require 'test/unit'
4
+ require 'rubygems'; require 'require_relative'
5
+ require_relative '../../app/condition'
6
+
7
+ class TestAppCondition < Test::Unit::TestCase
8
+ include Trepan::Condition
9
+
10
+ def test_basic
11
+ assert valid_condition?('1+2')
12
+ old_stderr = $stderr
13
+ new_stdout = StringIO.new
14
+ $stderr = new_stdout
15
+ assert_equal nil, valid_condition?('1+')
16
+ $stderr = old_stderr
17
+ end
18
+ end
@@ -35,13 +35,20 @@ class TestAppOptions < Test::Unit::TestCase
35
35
  end
36
36
 
37
37
  def test_binary_opts
38
- %w(nx).each do |name|
38
+ %w(nx readline).each do |name|
39
39
  setup
40
40
  o = ["--#{name}"]
41
41
  rest = @opts.parse o
42
42
  assert_equal('', @stderr.string)
43
43
  assert_equal(true, @options[name.to_sym])
44
44
  end
45
+ # --no- options
46
+ %w(readline).each do |name|
47
+ o = ["--no-#{name}"]
48
+ rest = @opts.parse o
49
+ assert_equal('', @stderr.string)
50
+ assert_equal(false, @options[name.to_sym])
51
+ end
45
52
  end
46
53
 
47
54
  def test_help_and_version_opts
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../../processor/command/base/subsubcmd'
5
+
6
+ # Mock debugger stub. FIXME: put in common helper routine.
7
+ class Trepan
8
+ end
9
+
10
+ $errors = []
11
+ class TestBaseSubCommand < Test::Unit::TestCase
12
+
13
+ def test_prefix_set
14
+ Trepanning::SubSubcommand.set_name_prefix('/tmp/show_subcmd/auto_subcmd/food.rb',
15
+ self.class)
16
+ assert_equal('food', NAME, "should have set NAME")
17
+ assert_equal('show auto food', CMD)
18
+ assert_equal(%w(show auto food), PREFIX)
19
+ end
20
+
21
+ end
@@ -11,6 +11,10 @@ class TestCommandFinish < Test::Unit::TestCase
11
11
  @name = File.basename(__FILE__, '.rb').split(/-/)[2]
12
12
  @my_cmd = @cmds[@name]
13
13
  end
14
+
15
+ def teardown
16
+ common_teardown
17
+ end
14
18
 
15
19
  def test_basic
16
20
  [
@@ -16,21 +16,26 @@ class TestCompletion < Test::Unit::TestCase
16
16
  [
17
17
  ['sh', 'sh', ['show']], # Simple single completion
18
18
  ['se', 'se', ['server', 'set']], # Simple multiple completion
19
- ['show', 'show', ['show ']], # Add a space because there is more
19
+ ['show', 'show', ['show']], # Completion when word is complete
20
20
  ['irb ', 'irb ', []], # Don't add anything - no more
21
- # ['irb ', 'irb', []], # Don't add anything - no more
21
+ ['set auto', 'auto', ['auto']], # Single completion on two words
22
22
  ['set au', 'au', ['auto']], # Single completion when there are two words
23
- ['set auto', 'auto', ['auto ']], # Add a space because there is more
24
- ['set auto ', '', ['dis', 'eval', 'irb', 'list']], # Many two-word completions
23
+ ['sho aut', 'aut', ['auto']], # Add a space because there is more
24
+ ['set auto eval ', '', ['off', 'on']], # Many 3-word completions
25
+
26
+ # Many two-word completions
27
+ ['set auto ', '', ['dis', 'eval', 'irb', 'list']],
28
+
25
29
  ['set auto e', 'e', ['eval']],
26
- ['disas', 'disas ', ['disassemble']], # Another single completion
30
+ ['disas', 'disas', ['disassemble']], # Another single completion
27
31
  ['help syn', 'syn', ['syntax']],
28
32
  ['help br', 'br', ['break', 'breakpoints']],
33
+ ['where', 'where', ['where']], # Single alias completion
29
34
  ['set basename o', 'o', ['off', 'on']],
30
35
  ].each do |line, token, expect_completion|
31
36
  assert_equal(expect_completion,
32
37
  dbgr.completion_method(token, line),
33
- "Bad completion of #{token.inspect} with #{line.inspect}")
38
+ "Bad completion on #{line.inspect} with #{token.inspect}")
34
39
  end
35
40
  assert(dbgr.completion_method('', '').size > 30,
36
41
  'Initial completion should return more than 30 commands')
@@ -20,9 +20,9 @@ class TestCmdProcessorLoadCmds < Test::Unit::TestCase
20
20
 
21
21
  def test_complete
22
22
  assert_equal(%w(delete directory disassemble display down),
23
- @proc.complete("d"),
23
+ @proc.complete('d', 'd'),
24
24
  "Failed completion of 'd' commands")
25
- assert_equal(['show debug', 'show different'], @proc.complete("sho d"),
25
+ assert_equal(['debug', 'different'], @proc.complete('sho d', 'd'),
26
26
  "Failed completion of 'sho d' subcommands")
27
27
  $errors = []
28
28
  end