byebug 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +9 -0
- data/CONTRIBUTING.md +13 -1
- data/GUIDE.md +181 -1
- data/README.md +67 -211
- data/Rakefile +1 -0
- data/bin/byebug +1 -8
- data/ext/byebug/byebug.c +66 -25
- data/ext/byebug/context.c +16 -20
- data/ext/byebug/extconf.rb +2 -1
- data/lib/byebug.rb +16 -9
- data/lib/byebug/command.rb +3 -3
- data/lib/byebug/commands/condition.rb +2 -2
- data/lib/byebug/commands/edit.rb +12 -9
- data/lib/byebug/commands/eval.rb +0 -16
- data/lib/byebug/commands/frame.rb +7 -17
- data/lib/byebug/commands/info.rb +2 -9
- data/lib/byebug/commands/list.rb +1 -1
- data/lib/byebug/commands/reload.rb +11 -0
- data/lib/byebug/commands/repl.rb +3 -6
- data/lib/byebug/commands/set.rb +5 -5
- data/lib/byebug/commands/show.rb +5 -0
- data/lib/byebug/commands/threads.rb +4 -4
- data/lib/byebug/commands/trace.rb +2 -1
- data/lib/byebug/context.rb +14 -5
- data/lib/byebug/interface.rb +1 -1
- data/lib/byebug/processor.rb +1 -1
- data/lib/byebug/remote.rb +1 -24
- data/lib/byebug/version.rb +1 -1
- data/old_doc/byebug.1 +0 -3
- data/old_doc/byebug.texi +2 -3
- data/test/breakpoints_test.rb +75 -52
- data/test/conditions_test.rb +2 -3
- data/test/continue_test.rb +6 -0
- data/test/edit_test.rb +3 -3
- data/test/eval_test.rb +14 -5
- data/test/examples/breakpoint.rb +4 -13
- data/test/examples/breakpoint_deep.rb +1 -21
- data/test/examples/conditions.rb +1 -1
- data/test/examples/continue.rb +2 -1
- data/test/examples/edit.rb +1 -0
- data/test/examples/eval.rb +1 -11
- data/test/examples/finish.rb +0 -17
- data/test/examples/frame.rb +2 -26
- data/test/examples/frame_deep.rb +0 -19
- data/test/examples/help.rb +0 -1
- data/test/examples/info.rb +4 -36
- data/test/examples/kill.rb +1 -1
- data/test/examples/list.rb +1 -1
- data/test/examples/method.rb +2 -13
- data/test/examples/post_mortem.rb +1 -16
- data/test/examples/quit.rb +1 -1
- data/test/examples/reload.rb +1 -1
- data/test/examples/restart.rb +1 -1
- data/test/examples/show.rb +0 -1
- data/test/examples/stepping.rb +2 -19
- data/test/examples/thread.rb +0 -27
- data/test/examples/variables.rb +0 -22
- data/test/finish_test.rb +22 -6
- data/test/frame_test.rb +89 -56
- data/test/info_test.rb +71 -46
- data/test/kill_test.rb +6 -1
- data/test/list_test.rb +1 -2
- data/test/method_test.rb +32 -13
- data/test/post_mortem_test.rb +34 -21
- data/test/quit_test.rb +0 -1
- data/test/restart_test.rb +6 -0
- data/test/set_test.rb +1 -1
- data/test/show_test.rb +17 -17
- data/test/source_test.rb +2 -3
- data/test/stepping_test.rb +31 -7
- data/test/support/test_dsl.rb +11 -1
- data/test/test_helper.rb +9 -0
- data/test/thread_test.rb +57 -23
- data/test/trace_test.rb +0 -1
- data/test/variables_test.rb +36 -17
- metadata +3 -9
- data/test/examples/breakpoint2.rb +0 -7
- data/test/examples/jump.rb +0 -14
- data/test/examples/set_annotate.rb +0 -12
data/test/support/test_dsl.rb
CHANGED
@@ -49,6 +49,14 @@ module TestDsl
|
|
49
49
|
(Pathname.new(__FILE__) + "../../examples/#{filename}.rb").cleanpath.to_s
|
50
50
|
end
|
51
51
|
|
52
|
+
#
|
53
|
+
# Shorten a fullpath
|
54
|
+
#
|
55
|
+
def shortpath(fullpath)
|
56
|
+
separator = File::ALT_SEPARATOR || File::SEPARATOR
|
57
|
+
"...#{separator}" + fullpath.split(separator)[-3..-1].join(separator)
|
58
|
+
end
|
59
|
+
|
52
60
|
#
|
53
61
|
# Adds commands to the input queue, so they will be later retrieved by
|
54
62
|
# Processor, i.e., it emulates user's input.
|
@@ -150,7 +158,9 @@ module TestDsl
|
|
150
158
|
|
151
159
|
def change_line_in_file(file, line, new_line_content)
|
152
160
|
old_content = File.read(file)
|
153
|
-
new_content = old_content.split("\n")
|
161
|
+
new_content = old_content.split("\n")
|
162
|
+
.tap { |c| c[line - 1] = new_line_content }
|
163
|
+
.join("\n") + "\n"
|
154
164
|
File.open(file, 'w') { |f| f.write(new_content) }
|
155
165
|
end
|
156
166
|
|
data/test/test_helper.rb
CHANGED
@@ -6,3 +6,12 @@ require 'byebug'
|
|
6
6
|
Dir.glob(File.expand_path("../support/*.rb", __FILE__)).each { |f| require f }
|
7
7
|
|
8
8
|
Byebug.settings[:testing] = true
|
9
|
+
|
10
|
+
class DummyObject
|
11
|
+
def initialize(*args)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# Init globals to avoid warnings
|
16
|
+
$bla = nil
|
17
|
+
$binding = binding # this is from irb...
|
data/test/thread_test.rb
CHANGED
@@ -1,56 +1,86 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
+
class ThreadExample
|
4
|
+
def initialize
|
5
|
+
Thread.main[:should_break] = false
|
6
|
+
end
|
7
|
+
|
8
|
+
def launch
|
9
|
+
@t1 = Thread.new do
|
10
|
+
while true
|
11
|
+
break if Thread.main[:should_break]
|
12
|
+
sleep 0.02
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
@t2 = Thread.new do
|
17
|
+
while true
|
18
|
+
sleep 0.02
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
@t1.join
|
23
|
+
Thread.main[:should_break]
|
24
|
+
end
|
25
|
+
|
26
|
+
def kill
|
27
|
+
@t2.kill
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
3
31
|
class TestThread < TestDsl::TestCase
|
4
32
|
let(:release) { 'eval Thread.main[:should_break] = true' }
|
5
33
|
|
6
34
|
describe 'list' do
|
7
35
|
it 'must show current thread by "plus" sign' do
|
8
36
|
thnum = nil
|
9
|
-
enter
|
37
|
+
enter "break #{__FILE__}:9", 'cont', 'thread list', release
|
10
38
|
debug_file('thread') { thnum = Byebug.contexts.first.thnum }
|
11
|
-
check_output_includes
|
39
|
+
check_output_includes(/\+ #{thnum} #<Thread:\S+ run>\t#{__FILE__}:9/)
|
12
40
|
end
|
13
41
|
|
14
42
|
it 'must work with shortcut' do
|
15
43
|
thnum = nil
|
16
|
-
enter
|
44
|
+
enter "break #{__FILE__}:9", 'cont', 'th list', release
|
17
45
|
debug_file('thread') { thnum = Byebug.contexts.first.thnum }
|
18
|
-
check_output_includes
|
46
|
+
check_output_includes(/\+ #{thnum} #<Thread:\S+ run>\t#{__FILE__}:9/)
|
19
47
|
end
|
20
48
|
|
21
49
|
it 'must show 3 available threads' do
|
22
|
-
enter
|
50
|
+
enter "break #{__FILE__}:22", 'cont', 'thread list', release
|
23
51
|
debug_file 'thread'
|
24
|
-
check_output_includes
|
52
|
+
check_output_includes(/(\+)?\d+ #<Thread:\S+ (sleep|run)>/,
|
25
53
|
/(\+)?\d+ #<Thread:\S+ (sleep|run)>/,
|
26
|
-
/(\+)?\d+ #<Thread:\S+ (sleep|run)>/
|
54
|
+
/(\+)?\d+ #<Thread:\S+ (sleep|run)>/)
|
27
55
|
end
|
28
56
|
end
|
29
57
|
|
30
58
|
describe 'stop' do
|
31
59
|
it 'must mark thread as suspended' do
|
32
60
|
thnum = nil
|
33
|
-
enter
|
61
|
+
enter "break #{__FILE__}:22", 'cont',
|
62
|
+
->{ "thread stop #{Byebug.contexts.last.thnum}" }, release
|
34
63
|
debug_file('thread') { thnum = Byebug.contexts.last.thnum }
|
35
|
-
check_output_includes
|
64
|
+
check_output_includes(/\$ #{thnum} #<Thread:/)
|
36
65
|
end
|
37
66
|
|
38
67
|
it 'must actually suspend thread execution' do
|
39
|
-
enter
|
68
|
+
enter "break #{__FILE__}:22", 'cont', 'trace on',
|
40
69
|
->{ "thread stop #{Byebug.contexts.last.thnum}" }, release
|
41
70
|
debug_file('thread')
|
42
|
-
check_output_doesnt_include
|
43
|
-
/Tracing: #{
|
71
|
+
check_output_doesnt_include(/Tracing: #{__FILE__}:17/,
|
72
|
+
/Tracing: #{__FILE__}:18/)
|
44
73
|
end
|
45
74
|
|
46
75
|
it 'must show error message if thread number is not specified' do
|
47
|
-
enter
|
76
|
+
enter "break #{__FILE__}:9", 'cont', 'thread stop', release
|
48
77
|
debug_file 'thread'
|
49
78
|
check_error_includes '"thread stop" needs a thread number'
|
50
79
|
end
|
51
80
|
|
52
81
|
it 'must show error message when trying to stop current thread' do
|
53
|
-
enter
|
82
|
+
enter "break #{__FILE__}:9", 'cont',
|
83
|
+
->{"thread stop #{Byebug.contexts.first.thnum}"}, release
|
54
84
|
debug_file 'thread'
|
55
85
|
check_error_includes "It's the current thread"
|
56
86
|
end
|
@@ -59,27 +89,29 @@ class TestThread < TestDsl::TestCase
|
|
59
89
|
describe 'resume' do
|
60
90
|
it 'must mark remove thread from the suspended state' do
|
61
91
|
thnum = nil
|
62
|
-
enter 'cont
|
92
|
+
enter "break #{__FILE__}:22", 'cont',
|
63
93
|
-> { thnum = Byebug.contexts.last.thnum ; "thread stop #{thnum}" },
|
64
94
|
-> { "thread resume #{thnum}" }, release
|
65
95
|
debug_file('thread') { Byebug.contexts.last.suspended?.must_equal false }
|
66
|
-
check_output_includes
|
96
|
+
check_output_includes(/\$ #{thnum} #<Thread:/, /#{thnum} #<Thread:/)
|
67
97
|
end
|
68
98
|
|
69
99
|
it 'must show error message if thread number is not specified' do
|
70
|
-
enter
|
100
|
+
enter "break #{__FILE__}:9", 'cont', 'thread resume', release
|
71
101
|
debug_file 'thread'
|
72
102
|
check_error_includes '"thread resume" needs a thread number'
|
73
103
|
end
|
74
104
|
|
75
105
|
it 'must show error message when trying to resume current thread' do
|
76
|
-
enter
|
106
|
+
enter "break #{__FILE__}:9", 'cont',
|
107
|
+
->{ "thread resume #{Byebug.contexts.first.thnum}" }, release
|
77
108
|
debug_file 'thread'
|
78
109
|
check_error_includes "It's the current thread"
|
79
110
|
end
|
80
111
|
|
81
112
|
it 'must show error message if it is not stopped' do
|
82
|
-
enter
|
113
|
+
enter "break #{__FILE__}:22", 'cont',
|
114
|
+
->{ "thread resume #{Byebug.contexts.last.thnum}" }, release
|
83
115
|
debug_file 'thread'
|
84
116
|
check_error_includes 'Already running'
|
85
117
|
end
|
@@ -87,18 +119,20 @@ class TestThread < TestDsl::TestCase
|
|
87
119
|
|
88
120
|
describe 'switch' do
|
89
121
|
it 'must switch to another thread' do
|
90
|
-
enter
|
91
|
-
|
122
|
+
enter "break #{__FILE__}:22", 'cont',
|
123
|
+
->{ "thread switch #{Byebug.contexts.last.thnum}" }, release
|
124
|
+
debug_file('thread') { $state.line.must_equal 17 }
|
92
125
|
end
|
93
126
|
|
94
127
|
it 'must show error message if thread number is not specified' do
|
95
|
-
enter
|
128
|
+
enter "break #{__FILE__}:9", 'cont', 'thread switch', release
|
96
129
|
debug_file 'thread'
|
97
130
|
check_error_includes '"thread switch" needs a thread number'
|
98
131
|
end
|
99
132
|
|
100
133
|
it 'must show error message when trying to switch current thread' do
|
101
|
-
enter
|
134
|
+
enter "break #{__FILE__}:9", 'cont',
|
135
|
+
->{ "thread switch #{Byebug.contexts.first.thnum}" }, release
|
102
136
|
debug_file 'thread'
|
103
137
|
check_error_includes "It's the current thread"
|
104
138
|
end
|
data/test/trace_test.rb
CHANGED
data/test/variables_test.rb
CHANGED
@@ -1,16 +1,35 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class VariablesExample
|
4
|
+
SOMECONST = 'foo' unless defined?(SOMECONST)
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@inst_a = 1
|
8
|
+
@inst_b = 2
|
9
|
+
@inst_c = "1" * 40
|
10
|
+
@inst_d = BasicObject.new
|
11
|
+
@@class_c = 3
|
12
|
+
end
|
4
13
|
|
14
|
+
def run
|
15
|
+
a = 4
|
16
|
+
b = [1, 2, 3].map do |i|
|
17
|
+
a * i
|
18
|
+
end
|
19
|
+
b
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class TestVariables < TestDsl::TestCase
|
5
24
|
describe 'class variables' do
|
6
25
|
it 'must show variables' do
|
7
|
-
enter
|
26
|
+
enter "break #{__FILE__}:19", 'cont', 'var class'
|
8
27
|
debug_file 'variables'
|
9
28
|
check_output_includes '@@class_c = 3'
|
10
29
|
end
|
11
30
|
|
12
31
|
it 'must be able to use shortcut' do
|
13
|
-
enter
|
32
|
+
enter "break #{__FILE__}:19", 'cont', 'v cl'
|
14
33
|
debug_file 'variables'
|
15
34
|
check_output_includes '@@class_c = 3'
|
16
35
|
end
|
@@ -18,19 +37,19 @@ class TestVariables < TestDsl::TestCase
|
|
18
37
|
|
19
38
|
describe 'constants' do
|
20
39
|
it 'must show constants' do
|
21
|
-
enter 'break
|
40
|
+
enter 'break 4', 'cont', 'var const VariablesExample'
|
22
41
|
debug_file 'variables'
|
23
42
|
check_output_includes 'SOMECONST => "foo"'
|
24
43
|
end
|
25
44
|
|
26
45
|
it 'must be able to use shortcut' do
|
27
|
-
enter 'break
|
46
|
+
enter 'break 4', 'cont', 'v co VariablesExample'
|
28
47
|
debug_file 'variables'
|
29
48
|
check_output_includes 'SOMECONST => "foo"'
|
30
49
|
end
|
31
50
|
|
32
51
|
it 'must show error message if given object is not a class or a module' do
|
33
|
-
enter 'break
|
52
|
+
enter 'break 4', 'cont', 'var const v'
|
34
53
|
debug_file 'variables'
|
35
54
|
check_output_includes 'Should be Class/Module: v'
|
36
55
|
end
|
@@ -38,39 +57,39 @@ class TestVariables < TestDsl::TestCase
|
|
38
57
|
|
39
58
|
describe 'globals' do
|
40
59
|
it 'must show global variables' do
|
41
|
-
enter 'break
|
60
|
+
enter 'break 4', 'cont', 'var global'
|
42
61
|
debug_file 'variables'
|
43
|
-
check_output_includes '$
|
62
|
+
check_output_includes '$VERBOSE = true'
|
44
63
|
end
|
45
64
|
|
46
65
|
it 'must be able to use shortcut' do
|
47
|
-
enter 'break
|
66
|
+
enter 'break 4', 'cont', 'v g'
|
48
67
|
debug_file 'variables'
|
49
|
-
check_output_includes '$
|
68
|
+
check_output_includes '$VERBOSE = true'
|
50
69
|
end
|
51
70
|
end
|
52
71
|
|
53
72
|
describe 'instance variables' do
|
54
73
|
it 'must show instance variables of the given object' do
|
55
|
-
enter 'break
|
74
|
+
enter 'break 4', 'cont', 'var instance v'
|
56
75
|
debug_file 'variables'
|
57
76
|
check_output_includes '@inst_a = 1', '@inst_b = 2'
|
58
77
|
end
|
59
78
|
|
60
79
|
it 'must show instance variables of self' do
|
61
|
-
enter
|
80
|
+
enter "break #{__FILE__}:11", 'cont', 'var instance'
|
62
81
|
debug_file 'variables'
|
63
82
|
check_output_includes '@inst_a = 1', '@inst_b = 2'
|
64
83
|
end
|
65
84
|
|
66
85
|
it 'must show instance variables' do
|
67
|
-
enter 'break
|
86
|
+
enter 'break 4', 'cont', 'var instance v'
|
68
87
|
debug_file 'variables'
|
69
88
|
check_output_includes '@inst_a = 1', '@inst_b = 2'
|
70
89
|
end
|
71
90
|
|
72
91
|
it 'must be able to use shortcut' do
|
73
|
-
enter 'break
|
92
|
+
enter 'break 4', 'cont', 'v ins v'
|
74
93
|
debug_file 'variables'
|
75
94
|
check_output_includes '@inst_a = 1', '@inst_b = 2'
|
76
95
|
end
|
@@ -79,14 +98,14 @@ class TestVariables < TestDsl::TestCase
|
|
79
98
|
temporary_change_hash Byebug.settings, :width, 20
|
80
99
|
|
81
100
|
it 'must cut long variable values according it' do
|
82
|
-
enter 'break
|
101
|
+
enter 'break 4', 'cont', 'var instance v'
|
83
102
|
debug_file 'variables'
|
84
103
|
check_output_includes '@inst_c = "1111111111111111...'
|
85
104
|
end
|
86
105
|
end
|
87
106
|
|
88
107
|
it 'must show error if value doesn\'t have #to_s/#inspect methods' do
|
89
|
-
enter 'break
|
108
|
+
enter 'break 4', 'cont', 'var instance v'
|
90
109
|
debug_file 'variables'
|
91
110
|
check_output_includes '@inst_d = *Error in evaluation*'
|
92
111
|
end
|
@@ -94,7 +113,7 @@ class TestVariables < TestDsl::TestCase
|
|
94
113
|
|
95
114
|
describe 'local variables' do
|
96
115
|
it 'must show local variables' do
|
97
|
-
enter
|
116
|
+
enter "break #{__FILE__}:17", 'cont', 'var local'
|
98
117
|
debug_file 'variables'
|
99
118
|
check_output_includes 'a => 4', 'b => nil', 'i => 1'
|
100
119
|
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: 2.
|
4
|
+
version: 2.2.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-09-
|
13
|
+
date: 2013-09-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: columnize
|
@@ -167,7 +167,6 @@ files:
|
|
167
167
|
- test/edit_test.rb
|
168
168
|
- test/eval_test.rb
|
169
169
|
- test/examples/breakpoint.rb
|
170
|
-
- test/examples/breakpoint2.rb
|
171
170
|
- test/examples/breakpoint_deep.rb
|
172
171
|
- test/examples/conditions.rb
|
173
172
|
- test/examples/continue.rb
|
@@ -180,7 +179,6 @@ files:
|
|
180
179
|
- test/examples/help.rb
|
181
180
|
- test/examples/info.rb
|
182
181
|
- test/examples/info2.rb
|
183
|
-
- test/examples/jump.rb
|
184
182
|
- test/examples/kill.rb
|
185
183
|
- test/examples/list.rb
|
186
184
|
- test/examples/method.rb
|
@@ -191,7 +189,6 @@ files:
|
|
191
189
|
- test/examples/restart.rb
|
192
190
|
- test/examples/save.rb
|
193
191
|
- test/examples/set.rb
|
194
|
-
- test/examples/set_annotate.rb
|
195
192
|
- test/examples/settings.rb
|
196
193
|
- test/examples/show.rb
|
197
194
|
- test/examples/source.rb
|
@@ -245,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
242
|
version: '0'
|
246
243
|
requirements: []
|
247
244
|
rubyforge_project:
|
248
|
-
rubygems_version: 2.
|
245
|
+
rubygems_version: 2.1.4
|
249
246
|
signing_key:
|
250
247
|
specification_version: 4
|
251
248
|
summary: Ruby 2.0 fast debugger - base + cli
|
@@ -257,7 +254,6 @@ test_files:
|
|
257
254
|
- test/edit_test.rb
|
258
255
|
- test/eval_test.rb
|
259
256
|
- test/examples/breakpoint.rb
|
260
|
-
- test/examples/breakpoint2.rb
|
261
257
|
- test/examples/breakpoint_deep.rb
|
262
258
|
- test/examples/conditions.rb
|
263
259
|
- test/examples/continue.rb
|
@@ -270,7 +266,6 @@ test_files:
|
|
270
266
|
- test/examples/help.rb
|
271
267
|
- test/examples/info.rb
|
272
268
|
- test/examples/info2.rb
|
273
|
-
- test/examples/jump.rb
|
274
269
|
- test/examples/kill.rb
|
275
270
|
- test/examples/list.rb
|
276
271
|
- test/examples/method.rb
|
@@ -281,7 +276,6 @@ test_files:
|
|
281
276
|
- test/examples/restart.rb
|
282
277
|
- test/examples/save.rb
|
283
278
|
- test/examples/set.rb
|
284
|
-
- test/examples/set_annotate.rb
|
285
279
|
- test/examples/settings.rb
|
286
280
|
- test/examples/show.rb
|
287
281
|
- test/examples/source.rb
|
data/test/examples/jump.rb
DELETED