byebug 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/Rakefile +0 -1
  4. data/bin/byebug +51 -114
  5. data/byebug.gemspec +1 -1
  6. data/ext/byebug/byebug.c +23 -106
  7. data/ext/byebug/byebug.h +10 -30
  8. data/ext/byebug/context.c +16 -102
  9. data/ext/byebug/extconf.rb +0 -9
  10. data/lib/byebug.rb +8 -122
  11. data/lib/byebug/command.rb +35 -29
  12. data/lib/byebug/commands/breakpoints.rb +17 -12
  13. data/lib/byebug/commands/catchpoint.rb +5 -5
  14. data/lib/byebug/commands/condition.rb +9 -7
  15. data/lib/byebug/commands/continue.rb +7 -4
  16. data/lib/byebug/commands/control.rb +4 -32
  17. data/lib/byebug/commands/display.rb +15 -14
  18. data/lib/byebug/commands/edit.rb +14 -13
  19. data/lib/byebug/commands/enable.rb +33 -35
  20. data/lib/byebug/commands/eval.rb +22 -29
  21. data/lib/byebug/commands/finish.rb +11 -9
  22. data/lib/byebug/commands/frame.rb +24 -50
  23. data/lib/byebug/commands/help.rb +21 -27
  24. data/lib/byebug/commands/info.rb +29 -92
  25. data/lib/byebug/commands/irb.rb +9 -11
  26. data/lib/byebug/commands/jump.rb +4 -4
  27. data/lib/byebug/commands/kill.rb +8 -8
  28. data/lib/byebug/commands/list.rb +2 -2
  29. data/lib/byebug/commands/method.rb +6 -6
  30. data/lib/byebug/commands/quit.rb +8 -8
  31. data/lib/byebug/commands/reload.rb +3 -3
  32. data/lib/byebug/commands/save.rb +10 -9
  33. data/lib/byebug/commands/set.rb +29 -26
  34. data/lib/byebug/commands/show.rb +17 -18
  35. data/lib/byebug/commands/skip.rb +8 -8
  36. data/lib/byebug/commands/source.rb +15 -13
  37. data/lib/byebug/commands/stepping.rb +7 -7
  38. data/lib/byebug/commands/trace.rb +8 -13
  39. data/lib/byebug/commands/variables.rb +18 -18
  40. data/lib/byebug/context.rb +3 -3
  41. data/lib/byebug/interface.rb +2 -7
  42. data/lib/byebug/processor.rb +9 -22
  43. data/lib/byebug/version.rb +1 -1
  44. data/old_doc/byebug.1 +3 -35
  45. data/old_doc/byebug.texi +69 -201
  46. data/old_doc/test-tri2.rb +1 -1
  47. data/test/breakpoints_test.rb +8 -1
  48. data/test/frame_test.rb +0 -8
  49. data/test/help_test.rb +13 -19
  50. data/test/info_test.rb +8 -32
  51. data/test/irb_test.rb +3 -4
  52. data/test/jump_test.rb +4 -4
  53. data/test/save_test.rb +2 -2
  54. data/test/set_test.rb +16 -8
  55. data/test/source_test.rb +10 -1
  56. data/test/support/context.rb +1 -1
  57. data/test/support/mocha_extensions.rb +16 -15
  58. data/test/support/test_dsl.rb +2 -2
  59. data/test/trace_test.rb +0 -45
  60. metadata +4 -10
  61. data/ext/byebug/locker.c +0 -53
  62. data/lib/byebug/commands/threads.rb +0 -190
  63. data/test/examples/frame_threads.rb +0 -31
  64. data/test/examples/info_threads.rb +0 -48
  65. data/test/examples/thread.rb +0 -32
  66. data/test/examples/trace_threads.rb +0 -20
@@ -2,7 +2,7 @@
2
2
  require "test/unit"
3
3
  require "tri2.rb"
4
4
  require "rubygems"
5
- require "ruby-debug"
5
+ require "byebug"
6
6
  Byebug.start
7
7
 
8
8
  class TestTri < Test::Unit::TestCase
@@ -238,7 +238,6 @@ describe 'Breakpoints' do
238
238
  check_output_includes \
239
239
  '"disable" must be followed by "display", "breakpoints" or ' \
240
240
  'breakpoint numbers.', interface.error_queue
241
-
242
241
  end
243
242
 
244
243
  it 'must show an error if no breakpoints is set' do
@@ -367,6 +366,14 @@ describe 'Breakpoints' do
367
366
  end
368
367
  end
369
368
 
369
+ describe 'Help' do
370
+ it 'must show info about setting breakpoints when using just "break"' do
371
+ enter 'break', 'cont'
372
+ debug_file 'breakpoint1'
373
+ check_output_includes /b\[reak\] file:line \[if expr\]/
374
+ end
375
+ end
376
+
370
377
  describe 'Post Mortem' do
371
378
  it 'must be able to set breakpoints in post-mortem mode' do
372
379
  enter 'cont', 'break 12', 'cont'
@@ -125,14 +125,6 @@ describe 'Frame Command' do
125
125
  end
126
126
  end
127
127
 
128
- it 'must change to frame in another thread' do
129
- skip('No threads supported')
130
- end
131
-
132
- it 'must not change to frame in another thread if thread doesn\'t exist' do
133
- skip('No threads supported')
134
- end
135
-
136
128
  describe 'Post Mortem' do
137
129
  it 'must work in post-mortem mode' do
138
130
  #skip 'TODO: This test fails with \'Segmentation fault\'.'
@@ -4,30 +4,26 @@ describe 'Help Command' do
4
4
  include TestDsl
5
5
  include Columnize
6
6
 
7
- let(:available_commands) do
8
- Byebug::Command.commands.select(&:event).
9
- map(&:help_command).flatten.uniq.sort
10
- end
7
+ let(:available_commands) {
8
+ Byebug::Command.commands.select(&:event).map(&:names).flatten.uniq.sort
9
+ }
11
10
 
12
- it 'must show help how to use "help"' do
13
- temporary_change_hash_value(Byebug::HelpCommand.settings, :width, 50) do
14
- enter 'help'
15
- debug_file 'help'
16
- check_output_includes \
17
- 'Type \'help <command-name>\' for help on a specific command',
18
- 'Available commands:',
19
- columnize(available_commands, 50)
20
- end
11
+ it '"help" alone must show how to use "help"' do
12
+ enter 'set width 50', 'help'
13
+ debug_file 'help'
14
+ check_output_includes \
15
+ 'Type "help <command-name>" for help on a specific command',
16
+ 'Available commands:', columnize(available_commands, 50)
21
17
  end
22
18
 
23
- it 'must show help when use shortcut' do
19
+ it 'must work when shortcut used' do
24
20
  enter 'h'
25
21
  debug_file 'help'
26
22
  check_output_includes \
27
- 'Type \'help <command-name>\' for help on a specific command'
23
+ 'Type "help <command-name>" for help on a specific command'
28
24
  end
29
25
 
30
- it 'must show an error if undefined command is specified' do
26
+ it 'must show an error if an undefined command is specified' do
31
27
  enter 'help foobar'
32
28
  debug_file 'help'
33
29
  check_output_includes \
@@ -37,9 +33,7 @@ describe 'Help Command' do
37
33
  it 'must show a command\'s help' do
38
34
  enter 'help break'
39
35
  debug_file 'help'
40
- check_output_includes \
41
- Byebug::AddBreakpoint.help(nil).split('\n').
42
- map { |l| l.gsub(/^ +/, '') }.join('\n')
36
+ check_output_includes Byebug::AddBreakpoint.help(nil)
43
37
  end
44
38
 
45
39
  describe 'Post Mortem' do
@@ -239,38 +239,6 @@ describe 'Info Command' do
239
239
  end
240
240
  end
241
241
 
242
- describe 'Thread info' do
243
- it 'must show threads info when without args' do
244
- enter 'break 48', 'cont', 'info threads'
245
- debug_file 'info_threads'
246
- check_output_includes /#<Thread:\S+ run>/
247
- end
248
-
249
- it 'must show thread info' do
250
- skip('XXX: Unreliable due to race conditions, needs fix to be reliable')
251
- thread_number = nil
252
- enter ->{ thread_number = context.thnum; "info thread #{context.thnum}" }
253
- debug_file 'info'
254
- check_output_includes '+', thread_number.to_s, /#<Thread:\S+ run>/
255
- end
256
-
257
- it 'must show verbose thread info' do
258
- skip('XXX: Unreliable due to race conditions, needs fix to be reliable')
259
- enter 'break 20', 'cont', ->{ "info thread #{context.thnum} verbose" }
260
- debug_file 'info'
261
- check_output_includes \
262
- /#<Thread:\S+ run>/, '#0', 'A.a', "at #{fullpath('info')}:20"
263
- end
264
-
265
- it 'must show error when unknown parameter is used' do
266
- skip('No thread support')
267
- enter ->{'info thread #{context.thnum} blabla'}
268
- debug_file 'info'
269
- check_output_includes \
270
- '"terse" or "verbose" expected. Got "blabla"', interface.error_queue
271
- end
272
- end
273
-
274
242
  describe 'Global Variables info' do
275
243
  it 'must show global variables' do
276
244
  enter 'info global_variables'
@@ -308,6 +276,14 @@ describe 'Info Command' do
308
276
  end
309
277
  end
310
278
 
279
+ describe 'Help' do
280
+ it 'must show help when typing just "info"' do
281
+ enter 'info', 'cont'
282
+ debug_file 'info'
283
+ check_output_includes /List of "info" subcommands:/
284
+ end
285
+ end
286
+
311
287
  describe 'Post Mortem' do
312
288
  it 'must work in post-mortem mode' do
313
289
  enter 'cont', 'info line'
@@ -9,7 +9,7 @@ describe 'Irb Command' do
9
9
  Signal.trap('SIGINT', 'IGNORE')
10
10
  end
11
11
 
12
- def after_teardown
12
+ def before_teardown
13
13
  Signal.trap('SIGINT', 'DEFAULT')
14
14
  end
15
15
 
@@ -35,9 +35,8 @@ describe 'Irb Command' do
35
35
 
36
36
  describe 'autoirb' do
37
37
  it 'must call irb automatically after breakpoint' do
38
- skip('Segfaulting... skip until fixed')
39
38
  irb.expects(:eval_input)
40
- enter 'set autoirb', 'break 4', 'cont'
39
+ enter 'set autoirb', 'break 4', 'cont', 'set noautoirb'
41
40
  debug_file 'irb'
42
41
  end
43
42
  end
@@ -55,7 +54,7 @@ describe 'Irb Command' do
55
54
  describe 'setting context to $byebug_state' do
56
55
  before do
57
56
  $byebug_state = nil
58
- Byebug::Command.settings[:byebugtesting] = false
57
+ Byebug::Command.settings[:testing] = false
59
58
  end
60
59
 
61
60
  it 'must set $byebug_state if irb is in the debug mode' do
@@ -66,11 +66,11 @@ describe "Jump Command" do
66
66
  end
67
67
 
68
68
  describe "Post Mortem" do
69
- # TODO: This test fails with "Segmentation fault". Probably need to fix it
70
- # somehow or forbid this command in post mortem mode. Seems like
71
- # state.context.frame_file and state.context.frame_line cause that.
72
69
  it "must work in post-mortem mode" do
73
- skip("No post morten mode for now")
70
+ skip 'No jumping for now plus this test fails with "Segmentation ' \
71
+ 'fault". Probably need to fix it somehow or forbid this command ' \
72
+ 'in post mortem mode. Seems like state.context.frame_file and ' \
73
+ 'state.context.frame_line cause that.'
74
74
  enter 'cont', 'jump 12'
75
75
  debug_file 'post_mortem'
76
76
  end
@@ -42,8 +42,8 @@ describe 'Save Command' do
42
42
  file_contents.must_include 'set basename off'
43
43
  end
44
44
 
45
- it 'must save byebugtesting' do
46
- file_contents.must_include 'set byebugtesting on'
45
+ it 'must save testing' do
46
+ file_contents.must_include 'set testing on'
47
47
  end
48
48
 
49
49
  it 'must save autolist' do
@@ -63,23 +63,23 @@ describe 'Set Command' do
63
63
  end
64
64
  end
65
65
 
66
- describe 'byebugtesting' do
67
- it 'must set $byebug_state if byebugsetting is on' do
68
- enter 'set byebugtesting', 'break 3', 'cont'
66
+ describe 'testing' do
67
+ it '$byebug_state must get set if "testing" is on' do
68
+ enter 'set testing', 'break 3', 'cont'
69
69
  debug_file('set') {
70
- state.must_be_kind_of Byebug::CommandProcessor::State }
70
+ $byebug_state.must_be_kind_of Byebug::CommandProcessor::State }
71
71
  end
72
72
 
73
- it 'must set basename on too' do
73
+ it 'basename must get set if "testing" is on' do
74
74
  temporary_change_hash_value(Byebug::Command.settings, :basename, false) do
75
- enter 'set byebugtesting', 'show basename'
75
+ enter 'set testing', 'show basename'
76
76
  debug_file('set')
77
77
  check_output_includes 'basename is on.'
78
78
  end
79
79
  end
80
80
 
81
- it 'must not set $byebug_state if byebugsetting is off' do
82
- enter 'set nobyebugtesting', 'break 3', 'cont'
81
+ it '$byebug_state must get unset if "testing" is off' do
82
+ enter 'set notesting', 'break 3', 'cont'
83
83
  debug_file('set') { $byebug_state.must_be_nil }
84
84
  end
85
85
  end
@@ -165,6 +165,14 @@ describe 'Set Command' do
165
165
  end
166
166
  end
167
167
 
168
+ describe 'Help' do
169
+ it 'must show help when typing just "set"' do
170
+ enter 'set', 'cont'
171
+ debug_file 'set'
172
+ check_output_includes /List of "set" subcommands:/
173
+ end
174
+ end
175
+
168
176
  describe 'Post Mortem' do
169
177
  Byebug::Command.settings[:autolist] = 0
170
178
 
@@ -33,7 +33,16 @@ describe 'Source Command' do
33
33
  it 'must show an error if file is not found' do
34
34
  enter 'source blabla'
35
35
  debug_file 'source'
36
- check_output_includes /Command file '.*blabla' is not found/, interface.error_queue
36
+ check_output_includes /File ".*blabla" not found/, interface.error_queue
37
+ end
38
+
39
+ describe 'Help' do
40
+ it 'must show help when used without arguments' do
41
+ enter 'source'
42
+ debug_file 'source'
43
+ check_output_includes \
44
+ "source FILE\texecutes a file containing byebug commands"
45
+ end
37
46
  end
38
47
 
39
48
  describe 'Post Mortem' do
@@ -4,7 +4,7 @@ module Byebug
4
4
 
5
5
  def inspect
6
6
  values = %w{
7
- thread thnum stop_reason tracing ignored? stack_size dead? frame_line frame_file frame_self
7
+ stop_reason tracing ignored? stack_size dead? frame_line frame_file frame_self
8
8
  }.map do |field|
9
9
  "#{field}: #{send(field)}"
10
10
  end.join(", ")
@@ -21,33 +21,34 @@ module Mocha
21
21
  alias_method :invoke, :invoke_with_calls
22
22
  end
23
23
 
24
- class Mock
25
24
 
25
+ class Mock
26
26
  # We monkey-patch that method to be able to pass arguments to
27
27
  # Expectation#invoke method
28
28
  def method_missing(symbol, *arguments, &block)
29
29
  if @responder and not @responder.respond_to?(symbol)
30
- raise NoMethodError, "undefined method `#{symbol}' for #{self.mocha_inspect} which responds like #{@responder.mocha_inspect}"
30
+ raise NoMethodError,
31
+ "undefined method `#{symbol}' for #{self.mocha_inspect} which " \
32
+ "responds like #{@responder.mocha_inspect}"
31
33
  end
32
- if matching_expectation_allowing_invocation = @expectations.match_allowing_invocation(symbol, *arguments)
34
+ if matching_expectation_allowing_invocation =
35
+ @expectations.match_allowing_invocation(symbol, *arguments)
33
36
  # We change this line - added arguments
34
37
  matching_expectation_allowing_invocation.invoke(arguments, &block)
35
- else
36
- if (matching_expectation = @expectations.match(symbol, *arguments)) || (!matching_expectation && !@everything_stubbed)
37
- # We change this line - added arguments
38
- matching_expectation.invoke(arguments, &block) if matching_expectation
39
- message = UnexpectedInvocation.new(self, symbol, *arguments).to_s
40
- require 'mocha/mockery'
41
- message << Mockery.instance.mocha_inspect
42
- raise ExpectationError.new(message, caller)
43
- end
38
+ elsif (matching_expectation = @expectations.match(symbol, *arguments)) ||
39
+ (!matching_expectation && !@everything_stubbed)
40
+ # We change this line - added arguments
41
+ matching_expectation.invoke(arguments, &block) if matching_expectation
42
+ message = UnexpectedInvocation.new(self, symbol, *arguments).to_s
43
+ require 'mocha/mockery'
44
+ message << Mockery.instance.mocha_inspect
45
+ raise ExpectationError.new(message, caller)
44
46
  end
45
47
  end
46
-
47
48
  end
48
49
 
49
- class Call
50
50
 
51
+ class Call
51
52
  attr_reader :blocks
52
53
 
53
54
  def initialize(*blocks)
@@ -65,6 +66,6 @@ module Mocha
65
66
  def +(other)
66
67
  self.class.new(*(@blocks + other.blocks))
67
68
  end
68
-
69
69
  end
70
+
70
71
  end
@@ -22,7 +22,7 @@ module TestDsl
22
22
  # Loads byebug default settings
23
23
  #
24
24
  def load_defaults
25
- Byebug::Command.settings[:byebugtesting] = true
25
+ Byebug::Command.settings[:testing] = true
26
26
  Byebug::Command.settings[:basename] = false
27
27
  Byebug::Command.settings[:callstyle] = :last
28
28
  Byebug::Command.settings[:force_stepping] = false
@@ -146,7 +146,7 @@ module TestDsl
146
146
  end
147
147
 
148
148
  def context
149
- state.context
149
+ $byebug_state.context
150
150
  end
151
151
 
152
152
  def force_set_const(klass, const, value)
@@ -54,51 +54,6 @@ describe 'Trace Command' do
54
54
  end
55
55
  end
56
56
 
57
- describe 'tracing on all threads' do
58
- describe 'enabling' do
59
- it 'must trace execution by setting trace to on' do
60
- skip('XXX: No thread support')
61
- th = nil
62
- enter 'trace on all'
63
- debug_file('trace_threads') { th = context.thnum }
64
- check_output_includes \
65
- "Tracing(#{th}):#{fullpath('trace_threads')}:4 @break1 = false",
66
- "Tracing(#{th}):#{fullpath('trace_threads')}:5 @break2 = false"
67
- check_output_includes \
68
- /Tracing\(\d+\):#{fullpath('trace_threads')}:8 until @break1/
69
- end
70
-
71
- it 'must show a message it is on' do
72
- skip('XXX: No thread support')
73
- enter 'trace on all'
74
- debug_file 'trace'
75
- check_output_includes 'Tracing on all threads.'
76
- end
77
- end
78
-
79
- describe 'disabling' do
80
- it 'must stop tracing by setting trace to off' do
81
- skip('XXX: No thread support')
82
- th = nil
83
- enter 'trace on all', 'break 19', 'cont', 'trace off all'
84
- debug_file('trace_threads') { th = context.thnum }
85
- check_output_includes \
86
- /Tracing\(\d+\):#{fullpath('trace_threads')}:8 until @break1/
87
- check_output_includes \
88
- "Tracing(#{th}):#{fullpath('trace_threads')}:19 t1.join"
89
- check_output_doesnt_include \
90
- "Tracing(#{th}):#{fullpath('trace_threads')}:20 t1"
91
- end
92
-
93
- it 'must show a message it is off' do
94
- skip('XXX: No thread support')
95
- enter 'trace off'
96
- debug_file 'trace'
97
- check_output_includes 'Tracing off on current thread.'
98
- end
99
- end
100
- end
101
-
102
57
  describe 'tracing global variables' do
103
58
  it 'must track global variable' do
104
59
  enter 'trace variable $bla'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: byebug
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rodríguez
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-04-30 00:00:00.000000000 Z
13
+ date: 2013-05-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: columnize
@@ -88,14 +88,14 @@ dependencies:
88
88
  requirements:
89
89
  - - ~>
90
90
  - !ruby/object:Gem::Version
91
- version: 4.7.3
91
+ version: 4.7.4
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ~>
97
97
  - !ruby/object:Gem::Version
98
- version: 4.7.3
98
+ version: 4.7.4
99
99
  description: |-
100
100
  Byebug is a Ruby 2.0 debugger. It's implemented using the
101
101
  Ruby 2.0 TracePoint C API. The C extension was forked from debase whereas
@@ -125,7 +125,6 @@ files:
125
125
  - ext/byebug/byebug.h
126
126
  - ext/byebug/context.c
127
127
  - ext/byebug/extconf.rb
128
- - ext/byebug/locker.c
129
128
  - lib/byebug.rb
130
129
  - lib/byebug/command.rb
131
130
  - lib/byebug/commands/breakpoints.rb
@@ -154,7 +153,6 @@ files:
154
153
  - lib/byebug/commands/skip.rb
155
154
  - lib/byebug/commands/source.rb
156
155
  - lib/byebug/commands/stepping.rb
157
- - lib/byebug/commands/threads.rb
158
156
  - lib/byebug/commands/trace.rb
159
157
  - lib/byebug/commands/variables.rb
160
158
  - lib/byebug/context.rb
@@ -186,11 +184,9 @@ files:
186
184
  - test/examples/eval.rb
187
185
  - test/examples/finish.rb
188
186
  - test/examples/frame.rb
189
- - test/examples/frame_threads.rb
190
187
  - test/examples/help.rb
191
188
  - test/examples/info.rb
192
189
  - test/examples/info2.rb
193
- - test/examples/info_threads.rb
194
190
  - test/examples/irb.rb
195
191
  - test/examples/jump.rb
196
192
  - test/examples/kill.rb
@@ -207,10 +203,8 @@ files:
207
203
  - test/examples/show.rb
208
204
  - test/examples/source.rb
209
205
  - test/examples/stepping.rb
210
- - test/examples/thread.rb
211
206
  - test/examples/tmate.rb
212
207
  - test/examples/trace.rb
213
- - test/examples/trace_threads.rb
214
208
  - test/examples/variables.rb
215
209
  - test/finish_test.rb
216
210
  - test/frame_test.rb