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/conditions_test.rb
CHANGED
@@ -6,19 +6,18 @@ class TestConditions < TestDsl::TestCase
|
|
6
6
|
before { enter 'break 3' }
|
7
7
|
|
8
8
|
describe 'successfully' do
|
9
|
+
before { enter ->{ "cond #{Byebug.breakpoints.first.id} b == 5" }, 'cont'}
|
10
|
+
|
9
11
|
it 'must assign the expression to breakpoint' do
|
10
|
-
enter ->{ "cond #{Byebug.breakpoints.first.id} b == 5" }, 'cont'
|
11
12
|
debug_file('conditions') {
|
12
13
|
Byebug.breakpoints.first.expr.must_equal 'b == 5' }
|
13
14
|
end
|
14
15
|
|
15
16
|
it 'must stop at the breakpoint if condition is true' do
|
16
|
-
enter ->{ "cond #{Byebug.breakpoints.first.id} b == 5" }, 'cont'
|
17
17
|
debug_file('conditions') { $state.line.must_equal 3 }
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'must work with full command name too' do
|
21
|
-
enter ->{ "condition #{Byebug.breakpoints.first.id} b == 5" }, 'cont'
|
22
21
|
debug_file('conditions') { $state.line.must_equal 3 }
|
23
22
|
end
|
24
23
|
end
|
data/test/continue_test.rb
CHANGED
data/test/edit_test.rb
CHANGED
@@ -16,9 +16,9 @@ class TestEdit < TestDsl::TestCase
|
|
16
16
|
describe 'open default editor' do
|
17
17
|
temporary_change_hash ENV, 'EDITOR', nil
|
18
18
|
|
19
|
-
it 'must call "
|
19
|
+
it 'must call "vim" with current line and file if EDITOR env not set' do
|
20
20
|
Byebug::Edit.any_instance.expects(:system).
|
21
|
-
with("
|
21
|
+
with("vim +2 #{fullpath('edit')}")
|
22
22
|
enter 'edit'
|
23
23
|
debug_file 'edit'
|
24
24
|
end
|
@@ -44,6 +44,6 @@ class TestEdit < TestDsl::TestCase
|
|
44
44
|
it 'must show an error if there is incorrect syntax' do
|
45
45
|
enter 'edit blabla'
|
46
46
|
debug_file 'edit'
|
47
|
-
check_error_includes 'Invalid file
|
47
|
+
check_error_includes 'Invalid file[:line] number specification: blabla'
|
48
48
|
end
|
49
49
|
end
|
data/test/eval_test.rb
CHANGED
@@ -1,7 +1,16 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class EvalTest
|
4
|
+
def sum(a,b)
|
5
|
+
a + b
|
6
|
+
end
|
7
|
+
|
8
|
+
def inspect
|
9
|
+
raise "Broken"
|
10
|
+
end
|
11
|
+
end
|
4
12
|
|
13
|
+
class TestEval < TestDsl::TestCase
|
5
14
|
it 'must evaluate an expression' do
|
6
15
|
enter 'eval 3 + 2'
|
7
16
|
debug_file 'eval'
|
@@ -21,8 +30,8 @@ class TestEval < TestDsl::TestCase
|
|
21
30
|
end
|
22
31
|
|
23
32
|
it 'must work when inspect raises an exception' do
|
24
|
-
enter 'c
|
25
|
-
debug_file('eval') { $state.line.must_equal
|
33
|
+
enter 'c 4', 'p @foo'
|
34
|
+
debug_file('eval') { $state.line.must_equal 4 }
|
26
35
|
check_output_includes 'RuntimeError Exception: Broken'
|
27
36
|
end
|
28
37
|
|
@@ -49,7 +58,7 @@ class TestEval < TestDsl::TestCase
|
|
49
58
|
it 'must show a stack trace' do
|
50
59
|
enter 'eval 2 / 0'
|
51
60
|
debug_file 'eval'
|
52
|
-
check_output_includes
|
61
|
+
check_output_includes(/\s*from \S+:in \`eval\'/)
|
53
62
|
check_output_doesnt_include 'ZeroDivisionError Exception: divided by 0'
|
54
63
|
end
|
55
64
|
end
|
@@ -61,7 +70,7 @@ class TestEval < TestDsl::TestCase
|
|
61
70
|
enter 'eval 2 / 0'
|
62
71
|
debug_file 'eval'
|
63
72
|
check_output_includes 'ZeroDivisionError Exception: divided by 0'
|
64
|
-
check_output_doesnt_include
|
73
|
+
check_output_doesnt_include(/\S+:\d+:in `eval':divided by 0/)
|
65
74
|
end
|
66
75
|
end
|
67
76
|
end
|
data/test/examples/breakpoint.rb
CHANGED
@@ -1,15 +1,6 @@
|
|
1
|
-
|
2
|
-
def self.a
|
3
|
-
4
|
4
|
-
end
|
5
|
-
def b
|
6
|
-
3
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
a = 3
|
1
|
+
y = 3
|
11
2
|
# A comment
|
12
3
|
byebug
|
13
|
-
|
14
|
-
|
15
|
-
|
4
|
+
z = 5
|
5
|
+
BreakpointExample.new.b
|
6
|
+
BreakpointExample.a(y+z)
|
@@ -1,24 +1,4 @@
|
|
1
|
-
|
2
|
-
def a
|
3
|
-
z = 2
|
4
|
-
b
|
5
|
-
end
|
6
|
-
|
7
|
-
def b
|
8
|
-
v2 = 5 if 1 == 2 ; [1,2,3].map { |a| a.to_f }
|
9
|
-
c
|
10
|
-
end
|
11
|
-
|
12
|
-
def c
|
13
|
-
z = 4
|
14
|
-
5
|
15
|
-
byebug
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
ex = SteppingExample.new.a
|
1
|
+
ex = BreakpointDeepExample.new.a
|
20
2
|
2.times do
|
21
3
|
ex += 1
|
22
4
|
end
|
23
|
-
|
24
|
-
ex
|
data/test/examples/conditions.rb
CHANGED
data/test/examples/continue.rb
CHANGED
data/test/examples/edit.rb
CHANGED
data/test/examples/eval.rb
CHANGED
data/test/examples/finish.rb
CHANGED
data/test/examples/frame.rb
CHANGED
@@ -1,28 +1,4 @@
|
|
1
1
|
byebug
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
@f = f
|
6
|
-
end
|
7
|
-
|
8
|
-
def a
|
9
|
-
b
|
10
|
-
end
|
11
|
-
|
12
|
-
def b
|
13
|
-
c
|
14
|
-
2
|
15
|
-
end
|
16
|
-
|
17
|
-
def c
|
18
|
-
d('a')
|
19
|
-
3
|
20
|
-
end
|
21
|
-
|
22
|
-
def d(e)
|
23
|
-
5
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
local_var = "hola"
|
28
|
-
FrameExample.new('f').a
|
3
|
+
fr_ex = FrameExample.new('f')
|
4
|
+
fr_ex.a()
|
data/test/examples/frame_deep.rb
CHANGED
data/test/examples/help.rb
CHANGED
data/test/examples/info.rb
CHANGED
@@ -1,38 +1,6 @@
|
|
1
1
|
byebug
|
2
|
-
def bla(a, b)
|
3
|
-
a + b
|
4
|
-
end
|
5
|
-
z = 5
|
6
|
-
z = 6
|
7
|
-
z = 7
|
8
|
-
z = 8
|
9
|
-
z = 9
|
10
|
-
bla("a" * 30, "b")
|
11
2
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
def a
|
19
|
-
a = "1" * 30
|
20
|
-
b = 2
|
21
|
-
@foo
|
22
|
-
end
|
23
|
-
|
24
|
-
def c
|
25
|
-
a = BasicObject.new
|
26
|
-
a
|
27
|
-
end
|
28
|
-
|
29
|
-
def b
|
30
|
-
a
|
31
|
-
e = "%.2f"
|
32
|
-
e
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
InfoExample.new.b
|
37
|
-
InfoExample.new.a
|
38
|
-
InfoExample.new.c
|
3
|
+
i = InfoExample.new
|
4
|
+
i.b
|
5
|
+
i.c
|
6
|
+
i.d
|
data/test/examples/kill.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
byebug
|
2
|
-
|
2
|
+
KillExample.kill_me
|
data/test/examples/list.rb
CHANGED
data/test/examples/method.rb
CHANGED
data/test/examples/quit.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
byebug
|
2
|
-
|
2
|
+
DummyObject.new
|
data/test/examples/reload.rb
CHANGED
data/test/examples/restart.rb
CHANGED
data/test/examples/show.rb
CHANGED
data/test/examples/stepping.rb
CHANGED
@@ -1,25 +1,8 @@
|
|
1
1
|
byebug
|
2
2
|
|
3
|
-
|
4
|
-
def a
|
5
|
-
z = 2
|
6
|
-
b
|
7
|
-
end
|
8
|
-
|
9
|
-
def b
|
10
|
-
v2 = 5 if 1 == 2 ; [1,2,3].map { |a| a.to_f }
|
11
|
-
c
|
12
|
-
end
|
13
|
-
|
14
|
-
def c
|
15
|
-
z = 4
|
16
|
-
5
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
ex = SteppingExample.new.a
|
3
|
+
ex = SteppingExample.a(7)
|
21
4
|
2.times do
|
22
5
|
ex += 1
|
23
6
|
end
|
24
7
|
|
25
|
-
ex
|
8
|
+
SteppingExample.b(ex)
|
data/test/examples/thread.rb
CHANGED
@@ -1,31 +1,4 @@
|
|
1
1
|
byebug
|
2
|
-
class ThreadExample
|
3
|
-
def initialize
|
4
|
-
Thread.main[:should_break] = false
|
5
|
-
end
|
6
|
-
|
7
|
-
def launch
|
8
|
-
@t1 = Thread.new do
|
9
|
-
while true
|
10
|
-
break if Thread.main[:should_break]
|
11
|
-
sleep 0.02
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
@t2 = Thread.new do
|
16
|
-
while true
|
17
|
-
sleep 0.02
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
@t1.join
|
22
|
-
Thread.main[:should_break]
|
23
|
-
end
|
24
|
-
|
25
|
-
def kill
|
26
|
-
@t2.kill
|
27
|
-
end
|
28
|
-
end
|
29
2
|
|
30
3
|
t = ThreadExample.new
|
31
4
|
t.launch
|
data/test/examples/variables.rb
CHANGED
@@ -1,26 +1,4 @@
|
|
1
1
|
byebug
|
2
|
-
class VariablesExample
|
3
|
-
SOMECONST = 'foo' unless defined?(SOMECONST)
|
4
|
-
|
5
|
-
def initialize
|
6
|
-
$glob = 100
|
7
|
-
@inst_a = 1
|
8
|
-
@inst_b = 2
|
9
|
-
@inst_c = "1" * 40
|
10
|
-
@inst_d = BasicObject.new
|
11
|
-
@@class_c = 3
|
12
|
-
end
|
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
|
-
|
22
|
-
end
|
23
2
|
|
24
3
|
v = VariablesExample.new
|
25
4
|
v.run
|
26
|
-
v
|