rb8-trepanning 0.1.5 → 0.1.6

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 (52) hide show
  1. data/CHANGES +18 -4
  2. data/ChangeLog +100 -87
  3. data/Makefile +23 -4
  4. data/README.textile +3 -3
  5. data/Rakefile +26 -20
  6. data/app/complete.rb +13 -13
  7. data/app/default.rb +8 -8
  8. data/app/display.rb +7 -7
  9. data/app/frame.rb +8 -8
  10. data/app/irb.rb +15 -15
  11. data/app/options.rb +25 -25
  12. data/app/run.rb +16 -8
  13. data/app/util.rb +7 -7
  14. data/bin/trepan8 +2 -2
  15. data/check-filter.rb +21 -0
  16. data/interface.rb +4 -4
  17. data/interface/user.rb +11 -11
  18. data/io.rb +18 -19
  19. data/io/input.rb +14 -12
  20. data/lib/debugger.rb +3 -1
  21. data/lib/trepanning.rb +30 -28
  22. data/processor.rb +41 -38
  23. data/processor/command.rb +9 -9
  24. data/processor/command/alias.rb +6 -6
  25. data/processor/command/down.rb +1 -2
  26. data/processor/command/edit.rb +12 -8
  27. data/processor/command/eval.rb +7 -7
  28. data/processor/command/info_subcmd/macro.rb +6 -6
  29. data/processor/command/info_subcmd/program.rb +5 -1
  30. data/processor/command/macro.rb +6 -6
  31. data/processor/command/show_subcmd/abbrev.rb +2 -2
  32. data/processor/command/up.rb +1 -2
  33. data/processor/complete.rb +120 -0
  34. data/processor/default.rb +13 -9
  35. data/processor/load_cmds.rb +18 -97
  36. data/processor/location.rb +34 -31
  37. data/processor/msg.rb +5 -5
  38. data/processor/validate.rb +44 -35
  39. data/test/data/break_loop_bug.right +2 -2
  40. data/test/data/edit.cmd +1 -1
  41. data/test/data/edit.right +7 -1
  42. data/test/data/printvar.right +2 -2
  43. data/test/data/raise.right +0 -1
  44. data/test/data/trace-mingw.right +28 -0
  45. data/test/integration/.gitignore +1 -0
  46. data/test/integration/test-raise.rb +10 -1
  47. data/test/integration/test-trace.rb +10 -6
  48. data/test/unit/test-app-options.rb +9 -3
  49. data/test/unit/test-app-run.rb +8 -1
  50. data/test/unit/test-cmd-alias.rb +2 -2
  51. data/test/unit/test-proc-default.rb +34 -0
  52. metadata +10 -6
@@ -5,11 +5,11 @@ debugger testing is on.
5
5
  Breakpoint 1 file bp_loop_issue.rb, line 2
6
6
  + break_loop_bug.cmd line 3: cont
7
7
  Breakpoint 1 at bp_loop_issue.rb:2
8
- -- (bp_loop_issue.rb:2)
8
+ xx (bp_loop_issue.rb:2)
9
9
  sleep 0.01
10
10
  + break_loop_bug.cmd line 4: cont
11
11
  Breakpoint 1 at bp_loop_issue.rb:2
12
- -- (bp_loop_issue.rb:2)
12
+ xx (bp_loop_issue.rb:2)
13
13
  sleep 0.01
14
14
  + break_loop_bug.cmd line 5: cont
15
15
  trepan8: That's all, folks...
@@ -9,6 +9,6 @@ edit ../example/gcd.rb 5
9
9
  # File should not exist
10
10
  edit foo
11
11
  # Add space to the end of 'edit'
12
- edit
12
+ edit
13
13
  edit ../example/gcd.rb
14
14
  quit!
@@ -3,22 +3,28 @@ def gcd(a, b)
3
3
  debugger testing is on.
4
4
  + edit.cmd line 5: # Edit using current line position.
5
5
  + edit.cmd line 6: edit
6
+ *** Editor echo FAKE-EDITOR is not executable. Trying anyway...
6
7
  Running echo FAKE-EDITOR +4 "gcd.rb"...
7
8
  FAKE-EDITOR +4 gcd.rb
8
9
  + edit.cmd line 7: edit 7
10
+ *** Editor echo FAKE-EDITOR is not executable. Trying anyway...
9
11
  Running echo FAKE-EDITOR +7 "gcd.rb"...
10
12
  FAKE-EDITOR +7 gcd.rb
11
13
  + edit.cmd line 8: edit ../example/gcd.rb 5
14
+ *** Editor echo FAKE-EDITOR is not executable. Trying anyway...
12
15
  Running echo FAKE-EDITOR +5 "gcd.rb"...
13
16
  FAKE-EDITOR +5 gcd.rb
14
17
  + edit.cmd line 9: # File should not exist
15
18
  + edit.cmd line 10: edit foo
19
+ *** Editor echo FAKE-EDITOR is not executable. Trying anyway...
16
20
  *** File "foo" is not readable.
17
21
  + edit.cmd line 11: # Add space to the end of 'edit'
18
- + edit.cmd line 12: edit
22
+ + edit.cmd line 12: edit
23
+ *** Editor echo FAKE-EDITOR is not executable. Trying anyway...
19
24
  Running echo FAKE-EDITOR +4 "gcd.rb"...
20
25
  FAKE-EDITOR +4 gcd.rb
21
26
  + edit.cmd line 13: edit ../example/gcd.rb
27
+ *** Editor echo FAKE-EDITOR is not executable. Trying anyway...
22
28
  Running echo FAKE-EDITOR +1 "gcd.rb"...
23
29
  FAKE-EDITOR +1 gcd.rb
24
30
  + edit.cmd line 14: quit!
@@ -11,7 +11,7 @@ basename is on.
11
11
  Breakpoint 1 file gcd.rb, line 6
12
12
  + printvar.cmd line 10: continue
13
13
  Breakpoint 1 at gcd.rb:6
14
- -- (gcd.rb:6)
14
+ xx (gcd.rb:6)
15
15
  if a > b
16
16
  + printvar.cmd line 11: pr a
17
17
  3
@@ -19,7 +19,7 @@ if a > b
19
19
  [3, 5]
20
20
  + printvar.cmd line 13: continue
21
21
  Breakpoint 1 at gcd.rb:6
22
- -- (gcd.rb:6)
22
+ xx (gcd.rb:6)
23
23
  if a > b
24
24
  + printvar.cmd line 14: eval [a,b]
25
25
  [2, 3]
@@ -7,7 +7,6 @@ Catch exception x.
7
7
  + raise.cmd line 7: catch ZeroDivisionError
8
8
  Catch exception ZeroDivisionError.
9
9
  + raise.cmd line 8: info catch
10
- x
11
10
  ZeroDivisionError
12
11
  + raise.cmd line 9: catch 5
13
12
  Warning 5 is not known to be a Class
@@ -0,0 +1,28 @@
1
+ -- (gcd.rb:4 @2)
2
+ def gcd(a, b)
3
+ -- (gcd.rb:18 @2)
4
+ a, b = ARGV[0..1].map {|arg| arg.to_i}
5
+ -- (gcd.rb:19 @45)
6
+ puts "The GCD of %d and %d is %d" % [a, b, gcd(a, b)]
7
+ -- (gcd.rb:6 @4)
8
+ if a > b
9
+ -- (gcd.rb:12 @40)
10
+ if a == 1 or b-a == 0
11
+ METHOD Object#gcd(a, b)
12
+ -> (gcd.rb:4 @2)
13
+ def gcd(a, b)
14
+ -- (gcd.rb:10 @24)
15
+ return nil if a <= 0
16
+ -- (gcd.rb:15 @71)
17
+ return gcd(b-a, a)
18
+ -- (gcd.rb:6 @4)
19
+ if a > b
20
+ -- (gcd.rb:12 @40)
21
+ if a == 1 or b-a == 0
22
+ <- (gcd.rb:13 @68)
23
+ R=> 1
24
+ return a
25
+ <- (gcd.rb:16 @88)
26
+ R=> 1
27
+ end
28
+ The GCD of 3 and 5 is 1
@@ -2,3 +2,4 @@
2
2
  /*.out
3
3
  /*~
4
4
  /.ruby_inline
5
+ /.trepan8_hist
@@ -14,8 +14,17 @@ class TestRaise < Test::Unit::TestCase
14
14
  RUBY_VERSION =~ /1.9/
15
15
  common_setup(__FILE__)
16
16
  Dir.chdir(@srcdir) do
17
+ filter = Proc.new{|got_lines, correct_lines|
18
+ new_lines = []
19
+ got_lines.each do |s|
20
+ new_lines << s unless s == 'x'
21
+ end
22
+ got_lines[0..-1] = new_lines[0..-1]
23
+ }
17
24
  assert_equal(true,
18
- run_debugger(@testname, @prefix + '../example/raise.rb'))
25
+ run_debugger(@testname,
26
+ @prefix + '../example/raise.rb',
27
+ nil, filter))
19
28
  end
20
29
  end
21
30
  end
@@ -2,15 +2,19 @@
2
2
  require 'test/unit'
3
3
  require 'rubygems'; require 'require_relative'
4
4
  require_relative 'helper'
5
+ require 'rbconfig'
5
6
 
6
7
  class TestTrace < Test::Unit::TestCase
7
8
  include TestHelper
8
- TREPAN_LOC = /.. \(.+:\d+( @\d+)?\)/
9
+ TREPAN_LOC =
10
+ if RbConfig::CONFIG['target_os'].start_with?('mingw')
11
+ /.. \((?:[A-Za-z]:)?.+:\d+( @\d+)?\)/
12
+ else
13
+ /.. \(.+:\d+( @\d+)?\)/
14
+ end
9
15
  def test_trepan_trace
10
- skip "We may get different results on an unpatched 1.9.2" if
11
- RUBY_VERSION =~ /1.9/
12
16
  common_setup(__FILE__)
13
- Dir.chdir(@srcdir) do
17
+ Dir.chdir(@srcdir) do
14
18
  last_line = nil
15
19
  filter = Proc.new{|got_lines, correct_lines|
16
20
  got_lines.each_with_index do |line, i|
@@ -23,8 +27,8 @@ class TestTrace < Test::Unit::TestCase
23
27
  got_lines[last_line..-1] = got_lines[last_line] if last_line
24
28
  }
25
29
  rightfile = File.join(%W(.. data #{@testname}))
26
- assert_equal(true, run_debugger(@testname,
27
- "-x #{@prefix}../example/gcd.rb 3 5",
30
+ assert_equal(true, run_debugger(@testname,
31
+ "-x #{@prefix}../example/gcd.rb 3 5",
28
32
  nil, filter, nil, rightfile))
29
33
  end
30
34
  end
@@ -31,7 +31,13 @@ class TestAppOptions < Test::Unit::TestCase
31
31
  assert_equal(orig_cd, @options[:chdir])
32
32
  assert_not_equal('', @stderr.string)
33
33
  assert_equal('', @stdout.string)
34
- File.unlink tf.path
34
+ # Looks like on various MinGW systems Tempfile and tf.path and unlike don't
35
+ # work together
36
+ begin
37
+ File.unlink tf.path
38
+ rescue
39
+ end
40
+
35
41
  # FIXME: add test where directory isn't executable.
36
42
  end
37
43
 
@@ -53,7 +59,7 @@ class TestAppOptions < Test::Unit::TestCase
53
59
  end
54
60
 
55
61
  def no_test_help_and_version_opts
56
- omit unless Process.respond_to?(:fork)
62
+ omit unless Process.respond_to?(:fork)
57
63
  Process.fork {
58
64
  %w(help version).each do |name|
59
65
  setup
@@ -88,7 +94,7 @@ class TestAppOptions < Test::Unit::TestCase
88
94
  assert_equal(true, @options[:client])
89
95
  ## FIXME - reinstate
90
96
  ## assert_equal(false, @options[:server])
91
-
97
+
92
98
  end
93
99
 
94
100
  end
@@ -6,7 +6,14 @@ require_relative '../../app/run'
6
6
  class TestAppRun < Test::Unit::TestCase
7
7
  include Trepan
8
8
  def test_whence
9
- assert_equal(true, File.executable?(whence_file('irb')))
9
+ resolved_file = whence_file('irb')
10
+ if RbConfig::CONFIG['target_os'].start_with?('mingw')
11
+ assert_equal(true, File.readable?(resolved_file),
12
+ "file #{resolved_file} should be readable")
13
+ else
14
+ assert_equal(true, File.executable?(resolved_file),
15
+ "file #{resolved_file} should be executable")
16
+ end
10
17
  ng = whence_file('probably-does-not-exist')
11
18
  assert_equal(true, File.executable?(ng) || ng == 'probably-does-not-exist')
12
19
  end
@@ -33,8 +33,8 @@ class TestCommandAliasUnalias < Test::Unit::TestCase
33
33
  def alias_defined?(alias_name)
34
34
  @cmdproc.aliases.member?(alias_name)
35
35
  end
36
-
37
- def test_alias_command
36
+
37
+ def test_alias_unalias_command
38
38
 
39
39
  assert_equal(false, @cmdproc.aliases.empty?,
40
40
  'There should be some aliases defined')
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+
4
+ # Test Trepan::CmdProcessor::Default
5
+ class TestProcDefault < Test::Unit::TestCase
6
+
7
+ DIR = File.dirname(__FILE__)
8
+ DEFAULT_RBFILE = File.join(%W(#{DIR} .. .. processor default.rb))
9
+
10
+ def test_maxwidth_setting
11
+ ENV['COLUMNS'] = '50'
12
+ Trepan::CmdProcessor.send(:remove_const, 'DEFAULT_SETTINGS') if
13
+ Trepan::CmdProcessor.const_defined?('DEFAULT_SETTINGS')
14
+ load DEFAULT_RBFILE
15
+ assert_equal(50, Trepan::CmdProcessor::DEFAULT_SETTINGS[:maxwidth],
16
+ 'Pick up COLUMNS environment')
17
+
18
+ Trepan::CmdProcessor.send(:remove_const, 'DEFAULT_SETTINGS')
19
+ load DEFAULT_RBFILE
20
+
21
+ ENV['COLUMNS'] = '0'
22
+ assert_operator(Trepan::CmdProcessor::DEFAULT_SETTINGS[:maxwidth],
23
+ :>=, 10,
24
+ 'Change too small COLUMNS environment value')
25
+
26
+ Trepan::CmdProcessor.send(:remove_const, 'DEFAULT_SETTINGS')
27
+ load DEFAULT_RBFILE
28
+
29
+ ENV['COLUMNS'] = 'non-numeric-string'
30
+ assert_operator(Trepan::CmdProcessor::DEFAULT_SETTINGS[:maxwidth],
31
+ :>=, 10,
32
+ 'Change too small COLUMNS environment value')
33
+ end
34
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb8-trepanning
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - R. Bernstein
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-01 00:00:00 Z
18
+ date: 2013-03-31 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rbx-require-relative
@@ -105,6 +105,7 @@ files:
105
105
  - app/util.rb
106
106
  - bin/.gitignore
107
107
  - bin/trepan8
108
+ - check-filter.rb
108
109
  - data/.gitignore
109
110
  - data/irbrc
110
111
  - data/perldb.bindings
@@ -266,6 +267,7 @@ files:
266
267
  - processor/command/unalias.rb
267
268
  - processor/command/undisplay.rb
268
269
  - processor/command/up.rb
270
+ - processor/complete.rb
269
271
  - processor/default.rb
270
272
  - processor/display.rb
271
273
  - processor/eval.rb
@@ -306,6 +308,7 @@ files:
306
308
  - test/data/stepping-1.9.right
307
309
  - test/data/stepping.cmd
308
310
  - test/data/stepping.right
311
+ - test/data/trace-mingw.right
309
312
  - test/data/trace.cmd
310
313
  - test/data/trace.right
311
314
  - test/data/trepan8-save.1
@@ -362,6 +365,7 @@ files:
362
365
  - test/unit/test-io-tcpclient.rb
363
366
  - test/unit/test-io-tcpfns.rb
364
367
  - test/unit/test-io-tcpserver.rb
368
+ - test/unit/test-proc-default.rb
365
369
  - test/unit/test-proc-eval.rb
366
370
  - test/unit/test-proc-hook.rb
367
371
  - test/unit/test-proc-load_cmds.rb
@@ -374,7 +378,7 @@ licenses:
374
378
  post_install_message:
375
379
  rdoc_options:
376
380
  - --title
377
- - Trepan 0.1.5 Documentation
381
+ - Trepan 0.1.6 Documentation
378
382
  require_paths:
379
383
  - lib
380
384
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -398,7 +402,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
398
402
  requirements: []
399
403
 
400
404
  rubyforge_project:
401
- rubygems_version: 1.8.6
405
+ rubygems_version: 1.8.24
402
406
  signing_key:
403
407
  specification_version: 3
404
408
  summary: Ruby Trepanning Debugger using ruby-debug-base