byebug 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/.gitignore +10 -0
  2. data/.travis.yml +8 -0
  3. data/AUTHORS +10 -0
  4. data/CHANGELOG.md +2 -0
  5. data/CONTRIBUTING.md +1 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE +20 -0
  8. data/README.md +5 -0
  9. data/Rakefile +28 -0
  10. data/bin/byebug +395 -0
  11. data/byebug.gemspec +29 -0
  12. data/doc/hanoi.rb +35 -0
  13. data/doc/primes.rb +28 -0
  14. data/doc/rdebug-emacs.texi +1030 -0
  15. data/doc/test-tri2.rb +18 -0
  16. data/doc/tri3.rb +8 -0
  17. data/doc/triangle.rb +12 -0
  18. data/ext/byebug/breakpoint.c +476 -0
  19. data/ext/byebug/byebug.c +512 -0
  20. data/ext/byebug/byebug.h +131 -0
  21. data/ext/byebug/context.c +424 -0
  22. data/ext/byebug/extconf.rb +21 -0
  23. data/ext/byebug/locker.c +53 -0
  24. data/lib/byebug.rb +404 -0
  25. data/lib/byebug/command.rb +232 -0
  26. data/lib/byebug/commands/breakpoints.rb +153 -0
  27. data/lib/byebug/commands/catchpoint.rb +56 -0
  28. data/lib/byebug/commands/condition.rb +49 -0
  29. data/lib/byebug/commands/continue.rb +38 -0
  30. data/lib/byebug/commands/control.rb +110 -0
  31. data/lib/byebug/commands/display.rb +122 -0
  32. data/lib/byebug/commands/edit.rb +48 -0
  33. data/lib/byebug/commands/enable.rb +202 -0
  34. data/lib/byebug/commands/eval.rb +176 -0
  35. data/lib/byebug/commands/finish.rb +43 -0
  36. data/lib/byebug/commands/frame.rb +303 -0
  37. data/lib/byebug/commands/help.rb +56 -0
  38. data/lib/byebug/commands/info.rb +462 -0
  39. data/lib/byebug/commands/irb.rb +123 -0
  40. data/lib/byebug/commands/jump.rb +66 -0
  41. data/lib/byebug/commands/kill.rb +51 -0
  42. data/lib/byebug/commands/list.rb +94 -0
  43. data/lib/byebug/commands/method.rb +84 -0
  44. data/lib/byebug/commands/quit.rb +39 -0
  45. data/lib/byebug/commands/reload.rb +40 -0
  46. data/lib/byebug/commands/save.rb +90 -0
  47. data/lib/byebug/commands/set.rb +210 -0
  48. data/lib/byebug/commands/show.rb +246 -0
  49. data/lib/byebug/commands/skip.rb +35 -0
  50. data/lib/byebug/commands/source.rb +36 -0
  51. data/lib/byebug/commands/stepping.rb +83 -0
  52. data/lib/byebug/commands/threads.rb +189 -0
  53. data/lib/byebug/commands/tmate.rb +36 -0
  54. data/lib/byebug/commands/trace.rb +56 -0
  55. data/lib/byebug/commands/variables.rb +199 -0
  56. data/lib/byebug/context.rb +58 -0
  57. data/lib/byebug/helper.rb +69 -0
  58. data/lib/byebug/interface.rb +223 -0
  59. data/lib/byebug/processor.rb +468 -0
  60. data/lib/byebug/version.rb +3 -0
  61. data/man/rdebug.1 +241 -0
  62. data/test/breakpoints_test.rb +357 -0
  63. data/test/conditions_test.rb +77 -0
  64. data/test/continue_test.rb +44 -0
  65. data/test/display_test.rb +141 -0
  66. data/test/edit_test.rb +56 -0
  67. data/test/eval_test.rb +92 -0
  68. data/test/examples/breakpoint1.rb +15 -0
  69. data/test/examples/breakpoint2.rb +7 -0
  70. data/test/examples/conditions.rb +4 -0
  71. data/test/examples/continue.rb +4 -0
  72. data/test/examples/display.rb +5 -0
  73. data/test/examples/edit.rb +3 -0
  74. data/test/examples/edit2.rb +3 -0
  75. data/test/examples/eval.rb +4 -0
  76. data/test/examples/finish.rb +20 -0
  77. data/test/examples/frame.rb +20 -0
  78. data/test/examples/frame_threads.rb +31 -0
  79. data/test/examples/help.rb +2 -0
  80. data/test/examples/info.rb +38 -0
  81. data/test/examples/info2.rb +3 -0
  82. data/test/examples/info_threads.rb +48 -0
  83. data/test/examples/irb.rb +6 -0
  84. data/test/examples/jump.rb +14 -0
  85. data/test/examples/kill.rb +2 -0
  86. data/test/examples/list.rb +12 -0
  87. data/test/examples/method.rb +15 -0
  88. data/test/examples/post_mortem.rb +19 -0
  89. data/test/examples/quit.rb +2 -0
  90. data/test/examples/reload.rb +6 -0
  91. data/test/examples/restart.rb +6 -0
  92. data/test/examples/save.rb +3 -0
  93. data/test/examples/set.rb +3 -0
  94. data/test/examples/set_annotate.rb +12 -0
  95. data/test/examples/settings.rb +1 -0
  96. data/test/examples/show.rb +2 -0
  97. data/test/examples/source.rb +3 -0
  98. data/test/examples/stepping.rb +21 -0
  99. data/test/examples/thread.rb +32 -0
  100. data/test/examples/tmate.rb +10 -0
  101. data/test/examples/trace.rb +7 -0
  102. data/test/examples/trace_threads.rb +20 -0
  103. data/test/examples/variables.rb +26 -0
  104. data/test/finish_test.rb +48 -0
  105. data/test/frame_test.rb +143 -0
  106. data/test/help_test.rb +50 -0
  107. data/test/info_test.rb +313 -0
  108. data/test/irb_test.rb +81 -0
  109. data/test/jump_test.rb +70 -0
  110. data/test/kill_test.rb +48 -0
  111. data/test/list_test.rb +145 -0
  112. data/test/method_test.rb +70 -0
  113. data/test/post_mortem_test.rb +27 -0
  114. data/test/quit_test.rb +56 -0
  115. data/test/reload_test.rb +44 -0
  116. data/test/restart_test.rb +164 -0
  117. data/test/save_test.rb +92 -0
  118. data/test/set_test.rb +177 -0
  119. data/test/show_test.rb +293 -0
  120. data/test/source_test.rb +45 -0
  121. data/test/stepping_test.rb +130 -0
  122. data/test/support/breakpoint.rb +13 -0
  123. data/test/support/context.rb +14 -0
  124. data/test/support/matchers.rb +67 -0
  125. data/test/support/mocha_extensions.rb +72 -0
  126. data/test/support/processor.rb +7 -0
  127. data/test/support/test_dsl.rb +206 -0
  128. data/test/support/test_interface.rb +68 -0
  129. data/test/test_helper.rb +10 -0
  130. data/test/tmate_test.rb +44 -0
  131. data/test/trace_test.rb +159 -0
  132. data/test/variables_test.rb +119 -0
  133. metadata +265 -0
@@ -0,0 +1,5 @@
1
+ byebug
2
+ d = 4
3
+ d = d + 2
4
+ d = d + 3
5
+ d = d + 6
@@ -0,0 +1,3 @@
1
+ byebug
2
+ d = 1
3
+ b = 2
@@ -0,0 +1,3 @@
1
+ byebug
2
+ d = 1
3
+ b = 2
@@ -0,0 +1,4 @@
1
+ byebug
2
+ b = 5
3
+ c = b + 5
4
+ c
@@ -0,0 +1,20 @@
1
+ byebug
2
+
3
+ class A
4
+ def a
5
+ b
6
+ end
7
+ def b
8
+ c
9
+ 2
10
+ end
11
+ def c
12
+ d
13
+ 3
14
+ end
15
+ def d
16
+ 5
17
+ end
18
+ end
19
+
20
+ A.new.a
@@ -0,0 +1,20 @@
1
+ byebug
2
+
3
+ class A
4
+ def a
5
+ b
6
+ end
7
+ def b
8
+ c
9
+ 2
10
+ end
11
+ def c
12
+ d('a')
13
+ 3
14
+ end
15
+ def d(e)
16
+ 5
17
+ end
18
+ end
19
+
20
+ A.new.a
@@ -0,0 +1,31 @@
1
+ byebug
2
+
3
+ @should_break = false
4
+
5
+ t = Thread.new do
6
+ while !@should_break
7
+ A.new.a
8
+ sleep 0.1
9
+ end
10
+ end
11
+
12
+ class A
13
+ def a
14
+ b
15
+ end
16
+ def b
17
+ c
18
+ 2
19
+ end
20
+ def c
21
+ d('a')
22
+ 3
23
+ end
24
+ def d(e)
25
+ 5
26
+ end
27
+ end
28
+
29
+ A.new.a
30
+ @should_break = true
31
+ t.join
@@ -0,0 +1,2 @@
1
+ byebug
2
+ 1
@@ -0,0 +1,38 @@
1
+ byebug
2
+ def bla(a, b)
3
+ a + b
4
+ end
5
+ 2
6
+ 3
7
+ 4
8
+ 5
9
+ 6
10
+ bla("a" * 30, "b")
11
+
12
+ class A
13
+ def initialize
14
+ @foo = "bar"
15
+ @bla = "blabla"
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
+ A.new.b
37
+ A.new.a
38
+ A.new.c
@@ -0,0 +1,3 @@
1
+ 1
2
+ 2
3
+ 3
@@ -0,0 +1,48 @@
1
+ byebug
2
+ def bla(a, b)
3
+ a + b
4
+ end
5
+ 2
6
+ 3
7
+ 4
8
+ 5
9
+ 6
10
+ bla("a" * 30, "b")
11
+
12
+ class A
13
+ def initialize
14
+ @foo = "bar"
15
+ @bla = "blabla"
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
+ @break = false
37
+ t1 = Thread.new do
38
+ while true
39
+ break if @break
40
+ sleep 0.02
41
+ end
42
+ end
43
+
44
+ A.new.b
45
+ A.new.a
46
+ A.new.c
47
+ @break = true
48
+ t1.join
@@ -0,0 +1,6 @@
1
+ byebug
2
+ 2
3
+ 3
4
+ 4
5
+ 5
6
+ 6
@@ -0,0 +1,14 @@
1
+ byebug
2
+
3
+ class A
4
+ def a
5
+ a = 2
6
+ b = 3
7
+ c = 4
8
+ d = 5
9
+ e = 6
10
+ f = 7
11
+ end
12
+ end
13
+
14
+ A.new.a
@@ -0,0 +1,2 @@
1
+ byebug
2
+ 1
@@ -0,0 +1,12 @@
1
+ byebug
2
+ 2
3
+ 3
4
+ 4
5
+ 5
6
+ 6
7
+ 7
8
+ 8
9
+ 9
10
+ 10
11
+ 11
12
+ 12
@@ -0,0 +1,15 @@
1
+ byebug
2
+ class MethodEx
3
+ def initialize
4
+ @a = 'b'
5
+ @c = 'd'
6
+ end
7
+ def self.foo
8
+ "asdf"
9
+ end
10
+ def bla
11
+ "asdf"
12
+ end
13
+ end
14
+ a = MethodEx.new
15
+ a
@@ -0,0 +1,19 @@
1
+ byebug
2
+
3
+ class CatchExample
4
+ def a
5
+ begin
6
+ Byebug.post_mortem do
7
+ z = 4
8
+ raise 'blabla'
9
+ x = 6
10
+ end
11
+ rescue => e
12
+ e
13
+ end
14
+ end
15
+ end
16
+
17
+ c = CatchExample.new
18
+ c.a
19
+ c
@@ -0,0 +1,2 @@
1
+ byebug
2
+ 1
@@ -0,0 +1,6 @@
1
+ byebug
2
+ 2
3
+ 3
4
+ 4
5
+ 5
6
+ 6
@@ -0,0 +1,6 @@
1
+ byebug
2
+
3
+ a = ARGV[0]
4
+ b = ARGV[1]
5
+ c = ARGV[2]
6
+ d = a.to_s + b.to_s + c.to_s
@@ -0,0 +1,3 @@
1
+ byebug
2
+ 2
3
+ 3
@@ -0,0 +1,3 @@
1
+ byebug
2
+ 2
3
+ 3
@@ -0,0 +1,12 @@
1
+ byebug
2
+
3
+ class AnnotateExample
4
+ def a
5
+ @b = 3
6
+ @@c = 4
7
+ d = 5
8
+ e = 6
9
+ end
10
+ end
11
+
12
+ AnnotateExample.new.a
@@ -0,0 +1 @@
1
+ byebug
@@ -0,0 +1,2 @@
1
+ byebug
2
+ 2
@@ -0,0 +1,3 @@
1
+ byebug
2
+ 2
3
+ 3
@@ -0,0 +1,21 @@
1
+ byebug
2
+
3
+ class SteppingExample
4
+ def a
5
+ z = 2
6
+ b
7
+ end
8
+
9
+ def b
10
+ [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
21
+ ex
@@ -0,0 +1,32 @@
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
+
30
+ t = ThreadExample.new
31
+ t.launch
32
+ t.kill
@@ -0,0 +1,10 @@
1
+ byebug
2
+ class TmateExample
3
+ def a
4
+ b
5
+ end
6
+ def b
7
+ 3
8
+ end
9
+ end
10
+ TmateExample.new.a
@@ -0,0 +1,7 @@
1
+ $bla = 2
2
+ byebug
3
+ $bla = 3
4
+ $bla = 4
5
+ $bla = 5
6
+ $bla = 6
7
+ $bla = 7
@@ -0,0 +1,20 @@
1
+ a = 2
2
+ byebug
3
+ b = 3
4
+ @break1 = false
5
+ @break2 = false
6
+
7
+ t1 = Thread.new do
8
+ until @break1
9
+ sleep 0.02
10
+ @break2 = true
11
+ end
12
+ end
13
+
14
+ until @break2
15
+ sleep 0.02
16
+ @break1 = true
17
+ end
18
+
19
+ t1.join
20
+ t1
@@ -0,0 +1,26 @@
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
+
24
+ v = VariablesExample.new
25
+ v.run
26
+ v