byebug 1.8.2 → 2.0.0

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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -1
  3. data/GUIDE.md +14 -22
  4. data/README.md +69 -6
  5. data/bin/byebug +3 -20
  6. data/ext/byebug/breakpoint.c +185 -101
  7. data/ext/byebug/byebug.c +393 -214
  8. data/ext/byebug/byebug.h +34 -15
  9. data/ext/byebug/context.c +327 -102
  10. data/ext/byebug/extconf.rb +1 -1
  11. data/ext/byebug/locker.c +54 -0
  12. data/ext/byebug/threads.c +113 -0
  13. data/lib/byebug.rb +19 -58
  14. data/lib/byebug/command.rb +18 -19
  15. data/lib/byebug/commands/breakpoints.rb +1 -4
  16. data/lib/byebug/commands/catchpoint.rb +1 -1
  17. data/lib/byebug/commands/condition.rb +1 -1
  18. data/lib/byebug/commands/control.rb +2 -3
  19. data/lib/byebug/commands/display.rb +2 -7
  20. data/lib/byebug/commands/edit.rb +1 -1
  21. data/lib/byebug/commands/enable.rb +12 -12
  22. data/lib/byebug/commands/eval.rb +4 -4
  23. data/lib/byebug/commands/finish.rb +1 -1
  24. data/lib/byebug/commands/frame.rb +12 -8
  25. data/lib/byebug/commands/info.rb +20 -52
  26. data/lib/byebug/commands/kill.rb +1 -5
  27. data/lib/byebug/commands/list.rb +2 -1
  28. data/lib/byebug/commands/quit.rb +1 -1
  29. data/lib/byebug/commands/repl.rb +2 -2
  30. data/lib/byebug/commands/save.rb +1 -1
  31. data/lib/byebug/commands/set.rb +84 -90
  32. data/lib/byebug/commands/show.rb +44 -53
  33. data/lib/byebug/commands/skip.rb +1 -1
  34. data/lib/byebug/commands/stepping.rb +5 -4
  35. data/lib/byebug/commands/threads.rb +202 -0
  36. data/lib/byebug/commands/trace.rb +1 -1
  37. data/lib/byebug/helper.rb +3 -3
  38. data/lib/byebug/interface.rb +2 -20
  39. data/lib/byebug/processor.rb +21 -100
  40. data/lib/byebug/remote.rb +3 -3
  41. data/lib/byebug/version.rb +1 -1
  42. data/old_doc/byebug.1 +0 -6
  43. data/old_doc/byebug.texi +29 -46
  44. data/test/breakpoints_test.rb +44 -65
  45. data/test/conditions_test.rb +0 -9
  46. data/test/continue_test.rb +2 -2
  47. data/test/display_test.rb +4 -23
  48. data/test/edit_test.rb +2 -16
  49. data/test/eval_test.rb +4 -13
  50. data/test/examples/thread.rb +32 -0
  51. data/test/finish_test.rb +1 -13
  52. data/test/frame_test.rb +5 -12
  53. data/test/help_test.rb +2 -12
  54. data/test/info_test.rb +8 -18
  55. data/test/kill_test.rb +1 -10
  56. data/test/list_test.rb +5 -14
  57. data/test/method_test.rb +1 -10
  58. data/test/post_mortem_test.rb +247 -14
  59. data/test/quit_test.rb +0 -9
  60. data/test/reload_test.rb +1 -15
  61. data/test/repl_test.rb +1 -9
  62. data/test/restart_test.rb +3 -18
  63. data/test/save_test.rb +1 -13
  64. data/test/set_test.rb +35 -32
  65. data/test/show_test.rb +8 -27
  66. data/test/source_test.rb +1 -8
  67. data/test/stepping_test.rb +65 -96
  68. data/test/support/test_dsl.rb +12 -17
  69. data/test/test_helper.rb +1 -1
  70. data/test/thread_test.rb +106 -0
  71. data/test/trace_test.rb +5 -17
  72. data/test/variables_test.rb +1 -10
  73. metadata +9 -7
  74. data/lib/byebug/commands/jump.rb +0 -52
  75. data/test/jump_test.rb +0 -77
  76. data/test/support/context.rb +0 -15
@@ -33,7 +33,7 @@ class TestTrace < TestDsl::TestCase
33
33
  end
34
34
 
35
35
  describe 'when basename set' do
36
- temporary_change_hash Byebug::Command.settings, :basename, true
36
+ temporary_change_hash Byebug.settings, :basename, true
37
37
 
38
38
  it 'must correctly print file lines' do
39
39
  enter 'tr on', 'cont 7', 'trace off'
@@ -47,9 +47,8 @@ class TestTrace < TestDsl::TestCase
47
47
  it 'must show an error message if given subcommand is incorrect' do
48
48
  enter 'trace bla'
49
49
  debug_file 'trace'
50
- check_output_includes \
51
- 'expecting "on", "off", "var" or "variable"; got: "bla"',
52
- interface.error_queue
50
+ check_error_includes \
51
+ 'expecting "on", "off", "var" or "variable"; got: "bla"'
53
52
  end
54
53
 
55
54
  describe 'disabling' do
@@ -96,25 +95,14 @@ class TestTrace < TestDsl::TestCase
96
95
  it 'must show an error message if there is no such global variable' do
97
96
  enter 'trace variable $foo'
98
97
  debug_file 'trace'
99
- check_output_includes \
100
- '$foo is not a global variable.', interface.error_queue
98
+ check_error_includes '$foo is not a global variable.'
101
99
  end
102
100
 
103
101
  it 'must show an error message if subcommand is invalid' do
104
102
  enter 'trace variable $bla foo'
105
103
  debug_file 'trace'
106
- check_output_includes \
107
- 'expecting "stop" or "nostop"; got "foo"', interface.error_queue
104
+ check_error_includes 'expecting "stop" or "nostop"; got "foo"'
108
105
  end
109
106
  end
110
107
  end
111
-
112
- describe 'Post Mortem' do
113
- it 'must work in post-mortem mode' do
114
- enter 'cont', 'trace on'
115
- debug_file 'post_mortem'
116
- check_output_includes 'line tracing is on.'
117
- end
118
- end
119
-
120
108
  end
@@ -76,7 +76,7 @@ class TestVariables < TestDsl::TestCase
76
76
  end
77
77
 
78
78
  describe 'when width is too small' do
79
- temporary_change_hash Byebug::Command.settings, :width, 20
79
+ temporary_change_hash Byebug.settings, :width, 20
80
80
 
81
81
  it 'must cut long variable values according it' do
82
82
  enter 'break 25', 'cont', 'var instance v'
@@ -105,13 +105,4 @@ class TestVariables < TestDsl::TestCase
105
105
  skip('can\'t install ruby-internal gem')
106
106
  end
107
107
  end
108
-
109
- describe 'Post Mortem' do
110
- it 'must work in post-mortem mode' do
111
- enter 'cont', 'var local'
112
- debug_file 'post_mortem'
113
- check_output_includes 'x => nil', 'z => 4'
114
- end
115
- end
116
-
117
108
  end
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.8.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rodriguez
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-08-16 00:00:00.000000000 Z
13
+ date: 2013-08-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: columnize
@@ -113,6 +113,8 @@ files:
113
113
  - ext/byebug/byebug.h
114
114
  - ext/byebug/context.c
115
115
  - ext/byebug/extconf.rb
116
+ - ext/byebug/locker.c
117
+ - ext/byebug/threads.c
116
118
  - lib/byebug.rb
117
119
  - lib/byebug/command.rb
118
120
  - lib/byebug/commands/breakpoints.rb
@@ -128,7 +130,6 @@ files:
128
130
  - lib/byebug/commands/frame.rb
129
131
  - lib/byebug/commands/help.rb
130
132
  - lib/byebug/commands/info.rb
131
- - lib/byebug/commands/jump.rb
132
133
  - lib/byebug/commands/kill.rb
133
134
  - lib/byebug/commands/list.rb
134
135
  - lib/byebug/commands/method.rb
@@ -141,6 +142,7 @@ files:
141
142
  - lib/byebug/commands/skip.rb
142
143
  - lib/byebug/commands/source.rb
143
144
  - lib/byebug/commands/stepping.rb
145
+ - lib/byebug/commands/threads.rb
144
146
  - lib/byebug/commands/trace.rb
145
147
  - lib/byebug/commands/variables.rb
146
148
  - lib/byebug/context.rb
@@ -194,6 +196,7 @@ files:
194
196
  - test/examples/show.rb
195
197
  - test/examples/source.rb
196
198
  - test/examples/stepping.rb
199
+ - test/examples/thread.rb
197
200
  - test/examples/tmate.rb
198
201
  - test/examples/trace.rb
199
202
  - test/examples/variables.rb
@@ -201,7 +204,6 @@ files:
201
204
  - test/frame_test.rb
202
205
  - test/help_test.rb
203
206
  - test/info_test.rb
204
- - test/jump_test.rb
205
207
  - test/kill_test.rb
206
208
  - test/list_test.rb
207
209
  - test/method_test.rb
@@ -216,11 +218,11 @@ files:
216
218
  - test/source_test.rb
217
219
  - test/stepping_test.rb
218
220
  - test/support/breakpoint.rb
219
- - test/support/context.rb
220
221
  - test/support/matchers.rb
221
222
  - test/support/test_dsl.rb
222
223
  - test/support/test_interface.rb
223
224
  - test/test_helper.rb
225
+ - test/thread_test.rb
224
226
  - test/trace_test.rb
225
227
  - test/variables_test.rb
226
228
  homepage: http://github.com/deivid-rodriguez/byebug
@@ -284,6 +286,7 @@ test_files:
284
286
  - test/examples/show.rb
285
287
  - test/examples/source.rb
286
288
  - test/examples/stepping.rb
289
+ - test/examples/thread.rb
287
290
  - test/examples/tmate.rb
288
291
  - test/examples/trace.rb
289
292
  - test/examples/variables.rb
@@ -291,7 +294,6 @@ test_files:
291
294
  - test/frame_test.rb
292
295
  - test/help_test.rb
293
296
  - test/info_test.rb
294
- - test/jump_test.rb
295
297
  - test/kill_test.rb
296
298
  - test/list_test.rb
297
299
  - test/method_test.rb
@@ -306,10 +308,10 @@ test_files:
306
308
  - test/source_test.rb
307
309
  - test/stepping_test.rb
308
310
  - test/support/breakpoint.rb
309
- - test/support/context.rb
310
311
  - test/support/matchers.rb
311
312
  - test/support/test_dsl.rb
312
313
  - test/support/test_interface.rb
313
314
  - test/test_helper.rb
315
+ - test/thread_test.rb
314
316
  - test/trace_test.rb
315
317
  - test/variables_test.rb
@@ -1,52 +0,0 @@
1
- module Byebug
2
-
3
- # Implements byebug "jump" command
4
- class JumpCommand < Command
5
- self.allow_in_control = true
6
-
7
- def numeric?(object)
8
- true if Float(object) rescue false
9
- end
10
-
11
- def regexp
12
- /^\s* j(?:ump)? (?:\s+(\S+))? \s* (?:\s+(\S+))? \s*$/ix
13
- end
14
-
15
- def execute
16
- return errmsg "\"jump\" must be followed by a line number\n" unless @match[1]
17
- return errmsg "Bad line number: " + @match[1] unless numeric?(@match[1])
18
-
19
- line = @match[1].to_i
20
- line = @state.context.frame_line(0) + line if @match[1][0] == '+' or @match[1][0] == '-'
21
- return aprint @state.location if line == @state.context.frame_line(0)
22
-
23
- file = @match[2]
24
- file = @state.context.frame_file(file.to_i) if numeric?(file)
25
- file = @state.context.frame_file(0) if !file
26
- case Byebug.context.jump(line, file)
27
- when 0
28
- @state.proceed
29
- when 1
30
- errmsg "Not possible to jump from here\n"
31
- when 2
32
- errmsg "Couldn't find debugged frame\n"
33
- when 3
34
- errmsg "Couldn't find active code at " + file + ":" + line.to_s + "\n"
35
- end
36
- end
37
-
38
- class << self
39
- def names
40
- %w(jump)
41
- end
42
-
43
- def description
44
- %{j[ump] line\tjump to line number (absolute)
45
- j[ump] -line\tjump back to line (relative)
46
- j[ump] +line\tjump ahead to line (relative)
47
-
48
- Change the next line of code to be executed.}
49
- end
50
- end
51
- end
52
- end
@@ -1,77 +0,0 @@
1
- require_relative 'test_helper'
2
-
3
- class TestJump < TestDsl::TestCase
4
-
5
- describe "successful" do
6
- it "must jump with absolute line number" do
7
- skip("No jumping for now")
8
- enter 'break 6', 'cont', "jump 8 #{fullpath('jump')}"
9
- debug_file('jump') { $state.line.must_equal 8 }
10
- end
11
-
12
- it "must not initialize skipped variables during jump" do
13
- skip("No jumping for now")
14
- enter 'break 6', 'cont', "jump 8 #{fullpath('jump')}", 'next'
15
- enter 'var local'
16
- debug_file('jump')
17
- check_output_includes "a => 2", "b => nil", "c => nil", "d => 5"
18
- end
19
-
20
- it "must jump with relative line number (-)" do
21
- skip("No jumping for now")
22
- enter 'break 8', 'cont', "jump -2 #{fullpath('jump')}"
23
- debug_file('jump') { $state.line.must_equal 6 }
24
- end
25
-
26
- it "must jump with relative line number (+)" do
27
- skip("No jumping for now")
28
- enter 'break 8', 'cont', "jump +2 #{fullpath('jump')}"
29
- debug_file('jump') { $state.line.must_equal 10 }
30
- end
31
- end
32
-
33
- describe "errors" do
34
- it "must show an error if line number is invalid" do
35
- skip("No jumping for now")
36
- enter 'jump bla'
37
- debug_file('jump')
38
- check_output_includes "Bad line number: bla", interface.error_queue
39
- end
40
-
41
- it "must show an error if line number is not specified" do
42
- skip("No jumping for now")
43
- enter 'jump'
44
- debug_file('jump')
45
- check_output_includes '"jump" must be followed by a line number',
46
- interface.error_queue
47
- end
48
-
49
- describe "when there is no active code in specified line" do
50
- it "must not jump to there" do
51
- skip("No jumping for now")
52
- enter "jump 13 #{fullpath('jump')}"
53
- debug_file('jump') { $state.line.must_equal 3 }
54
- end
55
-
56
- it "must show an error" do
57
- skip("No jumping for now")
58
- enter "jump 13 #{fullpath('jump')}"
59
- debug_file('jump')
60
- check_output_includes \
61
- "Couldn't find active code at #{fullpath('jump')}:13",
62
- interface.error_queue
63
- end
64
- end
65
- end
66
-
67
- describe "Post Mortem" do
68
- it "must work in post-mortem mode" do
69
- skip 'No jumping for now plus this test fails with "Segmentation ' \
70
- 'fault". Probably need to fix it somehow or forbid this command ' \
71
- 'in post mortem mode. Seems like $state.context.frame_file and ' \
72
- '$state.context.frame_line cause that.'
73
- enter 'cont', 'jump 12'
74
- debug_file 'post_mortem'
75
- end
76
- end
77
- end
@@ -1,15 +0,0 @@
1
- module Byebug
2
-
3
- class Context
4
-
5
- def inspect
6
- values = %w{
7
- stop_reason tracing ignored? stack_size dead? frame_line frame_file frame_self
8
- }.map do |field|
9
- "#{field}: #{send(field)}"
10
- end.join(", ")
11
- "#<Byebug::Context #{values}>"
12
- end
13
-
14
- end
15
- end