byebug 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/.gitignore +4 -0
  2. data/.travis.yml +0 -5
  3. data/CHANGELOG.md +6 -0
  4. data/Gemfile +1 -1
  5. data/LICENSE +23 -20
  6. data/byebug.gemspec +5 -5
  7. data/ext/byebug/breakpoint.c +102 -134
  8. data/ext/byebug/byebug.c +110 -64
  9. data/ext/byebug/byebug.h +2 -3
  10. data/ext/byebug/context.c +72 -39
  11. data/lib/byebug.rb +34 -38
  12. data/lib/byebug/command.rb +19 -24
  13. data/lib/byebug/commands/breakpoints.rb +11 -12
  14. data/lib/byebug/commands/catchpoint.rb +1 -1
  15. data/lib/byebug/commands/control.rb +2 -4
  16. data/lib/byebug/commands/finish.rb +1 -1
  17. data/lib/byebug/commands/frame.rb +15 -17
  18. data/lib/byebug/commands/info.rb +29 -28
  19. data/lib/byebug/commands/irb.rb +23 -21
  20. data/lib/byebug/commands/method.rb +4 -4
  21. data/lib/byebug/commands/reload.rb +8 -6
  22. data/lib/byebug/commands/set.rb +27 -23
  23. data/lib/byebug/commands/show.rb +6 -4
  24. data/lib/byebug/commands/stepping.rb +2 -2
  25. data/lib/byebug/commands/threads.rb +10 -10
  26. data/lib/byebug/commands/trace.rb +13 -14
  27. data/lib/byebug/commands/variables.rb +14 -12
  28. data/lib/byebug/context.rb +2 -15
  29. data/lib/byebug/interface.rb +5 -0
  30. data/lib/byebug/processor.rb +59 -64
  31. data/lib/byebug/version.rb +2 -1
  32. data/old_doc/Makefile +20 -0
  33. data/{man/rdebug.1 → old_doc/byebug.1} +5 -5
  34. data/old_doc/byebug.html +6178 -0
  35. data/old_doc/byebug.texi +3775 -0
  36. data/{doc → old_doc}/hanoi.rb +0 -0
  37. data/{doc → old_doc}/primes.rb +0 -0
  38. data/{doc → old_doc}/test-tri2.rb +0 -0
  39. data/{doc → old_doc}/tri3.rb +0 -0
  40. data/{doc → old_doc}/triangle.rb +0 -0
  41. data/test/breakpoints_test.rb +96 -60
  42. data/test/conditions_test.rb +15 -12
  43. data/test/examples/info.rb +5 -5
  44. data/test/examples/stepping.rb +1 -1
  45. data/test/frame_test.rb +40 -39
  46. data/test/info_test.rb +105 -96
  47. data/test/irb_test.rb +66 -61
  48. data/test/jump_test.rb +18 -9
  49. data/test/list_test.rb +114 -107
  50. data/test/restart_test.rb +51 -58
  51. data/test/save_test.rb +8 -7
  52. data/test/set_test.rb +8 -11
  53. data/test/show_test.rb +3 -5
  54. data/test/stepping_test.rb +43 -53
  55. data/test/support/context.rb +1 -0
  56. data/test/support/processor.rb +10 -4
  57. data/test/support/test_dsl.rb +46 -18
  58. data/test/support/test_interface.rb +8 -5
  59. data/test/test_helper.rb +2 -2
  60. data/test/trace_test.rb +123 -124
  61. metadata +39 -17
  62. data/AUTHORS +0 -10
  63. data/doc/rdebug-emacs.texi +0 -1030
@@ -19,12 +19,15 @@ class TestInterface < Byebug::Interface
19
19
  end
20
20
 
21
21
  def read_command(*args)
22
- if @input_queue.empty? && test_block
23
- test_block.call
24
- self.test_block = nil
22
+ if @input_queue.empty?
23
+ if test_block
24
+ test_block.call
25
+ self.test_block = nil
26
+ end
27
+ else
28
+ result = @input_queue.shift
29
+ result.is_a?(Proc) ? result.call : result
25
30
  end
26
- result = @input_queue.shift
27
- result.is_a?(Proc) ? result.call : result
28
31
  end
29
32
 
30
33
  def print(*args)
@@ -1,10 +1,10 @@
1
+ require 'rubygems'
1
2
  require 'pathname'
2
3
  require 'minitest/autorun'
4
+ require 'minitest/spec'
3
5
  require 'mocha/setup'
4
6
  require 'byebug'
5
7
 
6
8
  Dir.glob(File.expand_path("../support/*.rb", __FILE__)).each { |f| require f }
7
9
 
8
- # General settings for all tests
9
- Byebug::Command.settings[:byebugtesting] = true
10
10
  Byebug.annotate = 2
@@ -1,159 +1,158 @@
1
1
  require_relative 'test_helper'
2
2
 
3
3
  describe "Trace Command" do
4
+ include TestDsl
4
5
 
5
- extend TestDsl::ClassMethods
6
- temporary_set_const(Byebug, "PROG_SCRIPT", fullpath('trace'))
7
- temporary_change_hash_value(Byebug::Command.settings, :basename, false)
8
- temporary_change_method_value(Byebug::Command.settings, :tracing, false)
9
- before { untrace_var(:$bla) if defined?($bla) }
6
+ describe "Trace Command Setup" do
10
7
 
11
- include TestDsl
8
+ before do
9
+ force_set_const(Byebug, 'PROG_SCRIPT', fullpath('trace'))
10
+ Byebug::Command.settings[:basename] = false
11
+ Byebug.tracing = false
12
+ untrace_var(:$bla) if defined?($bla)
13
+ end
12
14
 
13
- describe "tracing" do
15
+ describe "tracing" do
14
16
 
15
- describe "enabling" do
16
- it "must trace execution by setting trace to on" do
17
- temporary_set_const(Byebug, "PROG_SCRIPT", fullpath('trace')) do
17
+ describe "enabling" do
18
+ it "must trace execution by setting trace to on" do
18
19
  enter 'trace on'
19
- debug_file('trace')
20
- check_output_includes(
21
- "Tracing:#{fullpath('trace')}:4 @break1 = false",
22
- "Tracing:#{fullpath('trace')}:5 @break2 = false"
23
- )
24
- check_output_doesnt_include /Tracing:#{fullpath('trace')}:8 until @break1/
20
+ debug_file 'trace'
21
+ check_output_includes "Tracing is on",
22
+ "Tracing: #{fullpath('trace')}:4 $bla = 4",
23
+ "Tracing: #{fullpath('trace')}:7 $bla = 7"
25
24
  end
26
- end
27
25
 
28
- it "must show a message it is on" do
29
- enter 'trace on'
30
- debug_file 'trace'
31
- check_output_includes "Tracing on on current thread."
26
+ it "must be able to use a shortcut" do
27
+ enter 'tr on'
28
+ debug_file 'trace'
29
+ check_output_includes "Tracing is on",
30
+ "Tracing: #{fullpath('trace')}:4 $bla = 4",
31
+ "Tracing: #{fullpath('trace')}:7 $bla = 7"
32
+ end
32
33
  end
33
34
 
34
- it "must be able to use a shortcut" do
35
- enter 'tr on'
35
+ it "must show an error message if given subcommand is incorrect" do
36
+ enter 'trace bla'
36
37
  debug_file 'trace'
37
- check_output_includes "Tracing on on current thread."
38
+ check_output_includes "expecting 'on', 'off', 'var' or 'variable'; got: bla", interface.error_queue
38
39
  end
39
- end
40
40
 
41
- it "must show an error message if given subcommand is incorrect" do
42
- enter 'trace bla'
43
- debug_file 'trace'
44
- check_output_includes "expecting 'on', 'off', 'var' or 'variable'; got: bla", interface.error_queue
45
- end
46
-
47
- describe "disabling" do
48
- it "must stop tracing by setting trace to off" do
49
- thnum = nil
50
- enter 'trace on', 'next', 'trace off'
51
- debug_file('trace')
52
- check_output_includes "Tracing:#{fullpath('trace')}:4 $bla = 4"
53
- check_output_doesnt_include "Tracing:#{fullpath('trace')}:5 $bla = 5"
54
- end
41
+ describe "disabling" do
42
+ it "must stop tracing by setting trace to off" do
43
+ enter 'trace on', 'next', 'trace off'
44
+ debug_file 'trace'
45
+ check_output_includes "Tracing: #{fullpath('trace')}:4 $bla = 4"
46
+ check_output_doesnt_include "Tracing: #{fullpath('trace')}:5 $bla = 5"
47
+ end
55
48
 
56
- it "must show a message it is off" do
57
- enter 'trace off'
58
- debug_file 'trace'
59
- check_output_includes "Tracing off on current thread."
49
+ it "must show a message when turned off" do
50
+ enter 'trace off'
51
+ debug_file 'trace'
52
+ check_output_includes "Tracing is off"
53
+ end
60
54
  end
61
55
  end
62
- end
63
56
 
64
- #
65
- # XXX: No thread support
66
- #
67
- # describe "tracing on all thread" do
68
- # describe "enabling" do
69
- # it "must trace execution by setting trace to on" do
70
- # temporary_set_const(Byebug, "PROG_SCRIPT", fullpath('trace_threads')) do
71
- # thnum = nil
72
- # enter 'trace on all'
73
- # debug_file('trace_threads') { thnum = context.thnum }
74
- # check_output_includes(
75
- # "Tracing(#{thnum}):#{fullpath('trace_threads')}:4 @break1 = false",
76
- # "Tracing(#{thnum}):#{fullpath('trace_threads')}:5 @break2 = false"
77
- # )
78
- # check_output_includes /Tracing\(\d+\):#{fullpath('trace_threads')}:8 until @break1/
79
- # end
80
- # end
81
-
82
- # it "must show a message it is on" do
83
- # enter 'trace on all'
84
- # debug_file 'trace'
85
- # check_output_includes "Tracing on all threads."
86
- # end
87
- # end
88
-
89
- # describe "disabling" do
90
- # it "must stop tracing by setting trace to off" do
91
- # temporary_set_const(Byebug, "PROG_SCRIPT", fullpath('trace_threads')) do
92
- # thnum = nil
93
- # enter 'trace on all', 'break 19', 'cont', 'trace off all'
94
- # debug_file('trace_threads') { thnum = context.thnum }
95
- # check_output_includes /Tracing\(\d+\):#{fullpath('trace_threads')}:8 until @break1/
96
- # check_output_includes "Tracing(#{thnum}):#{fullpath('trace_threads')}:19 t1.join"
97
- # check_output_doesnt_include "Tracing(#{thnum}):#{fullpath('trace_threads')}:20 t1"
98
- # end
99
- # end
100
-
101
- # it "must show a message it is off" do
102
- # enter 'trace off'
103
- # debug_file 'trace'
104
- # check_output_includes "Tracing off on current thread."
105
- # end
106
- # end
107
- # end
108
-
109
- describe "tracing global variables" do
110
- it "must track global variable" do
111
- enter 'trace variable $bla'
112
- debug_file 'trace'
113
- check_output_includes(
114
- "traced variable $bla has value 3",
115
- "traced variable $bla has value 7",
116
- )
117
- end
57
+ describe "tracing on all thread" do
58
+ describe "enabling" do
59
+ it "must trace execution by setting trace to on" do
60
+ skip("XXX: No thread support")
61
+ temporary_set_const(Byebug, "PROG_SCRIPT", fullpath('trace_threads')) do
62
+ thnum = nil
63
+ enter 'trace on all'
64
+ debug_file('trace_threads') { thnum = context.thnum }
65
+ check_output_includes \
66
+ "Tracing(#{thnum}):#{fullpath('trace_threads')}:4 @break1 = false",
67
+ "Tracing(#{thnum}):#{fullpath('trace_threads')}:5 @break2 = false"
68
+ check_output_includes \
69
+ /Tracing\(\d+\):#{fullpath('trace_threads')}:8 until @break1/
70
+ end
71
+ end
118
72
 
119
- it "must be able to use a shortcut" do
120
- enter 'trace var $bla'
121
- debug_file 'trace'
122
- check_output_includes "traced variable $bla has value 3"
123
- end
73
+ it "must show a message it is on" do
74
+ skip("XXX: No thread support")
75
+ enter 'trace on all'
76
+ debug_file 'trace'
77
+ check_output_includes "Tracing on all threads."
78
+ end
79
+ end
124
80
 
125
- it "must track global variable with stop" do
126
- enter 'trace variable $bla stop', 'break 7', 'cont'
127
- debug_file('trace') { state.line.must_equal 4 }
128
- end
81
+ describe "disabling" do
82
+ it "must stop tracing by setting trace to off" do
83
+ skip("XXX: No thread support")
84
+ temporary_set_const(Byebug, "PROG_SCRIPT", fullpath('trace_threads')) do
85
+ thnum = nil
86
+ enter 'trace on all', 'break 19', 'cont', 'trace off all'
87
+ debug_file('trace_threads') { thnum = context.thnum }
88
+ check_output_includes \
89
+ /Tracing\(\d+\):#{fullpath('trace_threads')}:8 until @break1/
90
+ check_output_includes \
91
+ "Tracing(#{thnum}):#{fullpath('trace_threads')}:19 t1.join"
92
+ check_output_doesnt_include \
93
+ "Tracing(#{thnum}):#{fullpath('trace_threads')}:20 t1"
94
+ end
95
+ end
129
96
 
130
- it "must track global variable with nostop" do
131
- enter 'trace variable $bla nostop', 'break 7', 'cont'
132
- debug_file('trace') { state.line.must_equal 7 }
97
+ it "must show a message it is off" do
98
+ skip("XXX: No thread support")
99
+ enter 'trace off'
100
+ debug_file 'trace'
101
+ check_output_includes "Tracing off on current thread."
102
+ end
103
+ end
133
104
  end
134
105
 
135
- describe "errors" do
136
- it "must show an error message if there is no such global variable" do
137
- enter 'trace variable $foo'
106
+ describe "tracing global variables" do
107
+ it "must track global variable" do
108
+ enter 'trace variable $bla'
138
109
  debug_file 'trace'
139
- check_output_includes "$foo is not a global variable.", interface.error_queue
110
+ check_output_includes "traced variable $bla has value 3",
111
+ "traced variable $bla has value 7"
140
112
  end
141
113
 
142
- it "must show an error message if subcommand is invalid" do
143
- enter 'trace variable $bla foo'
114
+ it "must be able to use a shortcut" do
115
+ enter 'trace var $bla'
144
116
  debug_file 'trace'
145
- check_output_includes "expecting 'stop' or 'nostop'; got foo", interface.error_queue
117
+ check_output_includes "traced variable $bla has value 3"
118
+ end
119
+
120
+ it "must track global variable with stop" do
121
+ enter 'trace variable $bla stop', 'break 7', 'cont'
122
+ debug_file('trace') { state.line.must_equal 4 }
123
+ end
124
+
125
+ it "must track global variable with nostop" do
126
+ enter 'trace variable $bla nostop', 'break 7', 'cont'
127
+ debug_file('trace') { state.line.must_equal 7 }
128
+ end
129
+
130
+ describe "errors" do
131
+ it "must show an error message if there is no such global variable" do
132
+ enter 'trace variable $foo'
133
+ debug_file 'trace'
134
+ check_output_includes \
135
+ "$foo is not a global variable.", interface.error_queue
136
+ end
137
+
138
+ it "must show an error message if subcommand is invalid" do
139
+ enter 'trace variable $bla foo'
140
+ debug_file 'trace'
141
+ check_output_includes \
142
+ "expecting 'stop' or 'nostop'; got foo", interface.error_queue
143
+ end
146
144
  end
147
145
  end
148
- end
149
146
 
150
- describe "Post Mortem" do
151
- it "must work in post-mortem mode" do
152
- skip("No post morten mode for now")
153
- #enter 'cont', 'trace on'
154
- #debug_file 'post_mortem'
155
- #check_output_includes "Tracing on on current thread."
147
+ describe "Post Mortem" do
148
+ it "must work in post-mortem mode" do
149
+ skip("No post morten mode for now")
150
+ enter 'cont', 'trace on'
151
+ debug_file 'post_mortem'
152
+ check_output_includes "Tracing on on current thread."
153
+ end
156
154
  end
155
+
157
156
  end
158
157
 
159
158
  end
metadata CHANGED
@@ -1,32 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: byebug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - David Rodríguez
9
+ - Kent Sibilev
10
+ - Mark Moseley
9
11
  autorequire:
10
12
  bindir: bin
11
13
  cert_chain: []
12
- date: 2013-03-18 00:00:00.000000000 Z
14
+ date: 2013-03-29 00:00:00.000000000 Z
13
15
  dependencies:
14
16
  - !ruby/object:Gem::Dependency
15
17
  name: columnize
16
18
  requirement: !ruby/object:Gem::Requirement
17
19
  none: false
18
20
  requirements:
19
- - - '>='
21
+ - - ~>
20
22
  - !ruby/object:Gem::Version
21
- version: 0.3.1
23
+ version: 0.3.6
22
24
  type: :runtime
23
25
  prerelease: false
24
26
  version_requirements: !ruby/object:Gem::Requirement
25
27
  none: false
26
28
  requirements:
27
- - - '>='
29
+ - - ~>
28
30
  - !ruby/object:Gem::Version
29
- version: 0.3.1
31
+ version: 0.3.6
30
32
  - !ruby/object:Gem::Dependency
31
33
  name: debugger-linecache
32
34
  requirement: !ruby/object:Gem::Requirement
@@ -91,7 +93,23 @@ dependencies:
91
93
  - - ~>
92
94
  - !ruby/object:Gem::Version
93
95
  version: 0.13.3
94
- description: |
96
+ - !ruby/object:Gem::Dependency
97
+ name: minitest
98
+ requirement: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 4.7.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ~>
110
+ - !ruby/object:Gem::Version
111
+ version: 4.7.0
112
+ description: |-
95
113
  Byebug is a Ruby 2.0 debugger. It's implemented using the
96
114
  Ruby 2.0 TracePoint C API. The C extension was forked from debase whereas
97
115
  the rest of the gem was forked from debugger. The core component provides
@@ -107,20 +125,14 @@ extra_rdoc_files:
107
125
  files:
108
126
  - .gitignore
109
127
  - .travis.yml
110
- - AUTHORS
111
128
  - CHANGELOG.md
112
129
  - CONTRIBUTING.md
113
130
  - Gemfile
114
131
  - LICENSE
115
132
  - README.md
116
133
  - Rakefile
134
+ - bin/byebug
117
135
  - byebug.gemspec
118
- - doc/hanoi.rb
119
- - doc/primes.rb
120
- - doc/rdebug-emacs.texi
121
- - doc/test-tri2.rb
122
- - doc/tri3.rb
123
- - doc/triangle.rb
124
136
  - ext/byebug/breakpoint.c
125
137
  - ext/byebug/byebug.c
126
138
  - ext/byebug/byebug.h
@@ -164,7 +176,15 @@ files:
164
176
  - lib/byebug/interface.rb
165
177
  - lib/byebug/processor.rb
166
178
  - lib/byebug/version.rb
167
- - man/rdebug.1
179
+ - old_doc/Makefile
180
+ - old_doc/byebug.1
181
+ - old_doc/byebug.html
182
+ - old_doc/byebug.texi
183
+ - old_doc/hanoi.rb
184
+ - old_doc/primes.rb
185
+ - old_doc/test-tri2.rb
186
+ - old_doc/tri3.rb
187
+ - old_doc/triangle.rb
168
188
  - test/breakpoints_test.rb
169
189
  - test/conditions_test.rb
170
190
  - test/continue_test.rb
@@ -236,10 +256,9 @@ files:
236
256
  - test/tmate_test.rb
237
257
  - test/trace_test.rb
238
258
  - test/variables_test.rb
239
- - bin/byebug
240
259
  homepage: http://github.com/deivid-rodriguez/byebug
241
260
  licenses:
242
- - MIT
261
+ - BSD
243
262
  post_install_message:
244
263
  rdoc_options: []
245
264
  require_paths:
@@ -250,6 +269,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
250
269
  - - '>='
251
270
  - !ruby/object:Gem::Version
252
271
  version: '0'
272
+ segments:
273
+ - 0
274
+ hash: 871910095
253
275
  required_rubygems_version: !ruby/object:Gem::Requirement
254
276
  none: false
255
277
  requirements:
data/AUTHORS DELETED
@@ -1,10 +0,0 @@
1
- Author:
2
- Kent Sibilev
3
-
4
- Contributors:
5
- Markus Barchfeld
6
- R. Bernstein
7
- Anders Lindgren
8
-
9
- Contributor and maintainer:
10
- Mark Moseley