byebug 1.1.0 → 1.1.1

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 (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
@@ -1,53 +0,0 @@
1
- #include <byebug.h>
2
-
3
- static locked_thread_t *locked_head = NULL;
4
- static locked_thread_t *locked_tail = NULL;
5
-
6
- extern int
7
- is_in_locked(VALUE thread)
8
- {
9
- locked_thread_t *node;
10
-
11
- if(!locked_head) return 0;
12
-
13
- for(node = locked_head; node != locked_tail; node = node->next)
14
- {
15
- if(node->thread == thread) return 1;
16
- }
17
- return 0;
18
- }
19
-
20
- extern void
21
- add_to_locked(VALUE thread)
22
- {
23
- locked_thread_t *node;
24
-
25
- if(is_in_locked(thread)) return;
26
-
27
- node = ALLOC(locked_thread_t);
28
- node->thread = thread;
29
- node->next = NULL;
30
- if(locked_tail)
31
- locked_tail->next = node;
32
- locked_tail = node;
33
- if(!locked_head)
34
- locked_head = node;
35
- }
36
-
37
- extern VALUE
38
- remove_from_locked()
39
- {
40
- VALUE thread;
41
- locked_thread_t *node;
42
-
43
- if(locked_head == NULL)
44
- return Qnil;
45
-
46
- node = locked_head;
47
- locked_head = locked_head->next;
48
- if(locked_tail == node)
49
- locked_tail = NULL;
50
- thread = node->thread;
51
- xfree(node);
52
- return thread;
53
- }
@@ -1,190 +0,0 @@
1
- module Byebug
2
-
3
- module ThreadFunctions
4
- def display_context(c, show_top_frame=true)
5
- c_flag = c.thread == Thread.current ? '+' : ' '
6
- c_flag = '$' if c.suspended?
7
- d_flag = c.ignored? ? '!' : ' '
8
- print "%s%s", c_flag, d_flag
9
- print "%d ", c.thnum
10
- print "%s\t", c.thread.inspect
11
- if c.stack_size > 0 and show_top_frame
12
- print "%s:%d", c.frame_file(0), c.frame_line(0)
13
- end
14
- print "\n"
15
- end
16
-
17
- def parse_thread_num(subcmd, arg)
18
- if '' == arg
19
- errmsg "'%s' needs a thread number\n" % subcmd
20
- nil
21
- else
22
- thread_num = get_int(arg, "thread #{subcmd}", 1)
23
- return nil unless thread_num
24
- get_context(thread_num)
25
- end
26
- end
27
-
28
- def parse_thread_num_for_cmd(subcmd, arg)
29
- c = parse_thread_num(subcmd, arg)
30
- return nil unless c
31
- case
32
- when nil == c
33
- errmsg "No such thread.\n"
34
- when @state.context == c
35
- errmsg "It's the current thread.\n"
36
- when c.ignored?
37
- errmsg "Can't #{subcmd} to byebug's thread #{arg}.\n"
38
- else # Everything is okay
39
- return c
40
- end
41
- return nil
42
- end
43
- end
44
-
45
- class ThreadListCommand < Command
46
- self.allow_in_control = true
47
-
48
- def regexp
49
- /^\s*th(?:read)?\s+l(?:ist)?\s*$/
50
- end
51
-
52
- def execute
53
- threads = Byebug.contexts.sort_by{|c| c.thnum}.each do |c|
54
- display_context(c)
55
- end
56
- end
57
-
58
- class << self
59
- def help_command
60
- 'thread'
61
- end
62
-
63
- def help(cmd)
64
- %{
65
- th[read] l[ist]\t\t\tlist all threads
66
- }
67
- end
68
- end
69
- end
70
-
71
- class ThreadStopCommand < Command
72
- self.allow_in_control = true
73
- self.allow_in_post_mortem = false
74
- self.need_context = true
75
-
76
- def regexp
77
- /^\s*th(?:read)?\s+stop\s*(\S*)\s*$/
78
- end
79
-
80
- def execute
81
- c = parse_thread_num_for_cmd("thread stop", @match[1])
82
- return unless c
83
- c.suspend
84
- display_context(c)
85
- end
86
-
87
- class << self
88
- def help_command
89
- 'thread'
90
- end
91
-
92
- def help(cmd)
93
- %{
94
- th[read] stop <nnn>\t\tstop thread nnn
95
- }
96
- end
97
- end
98
- end
99
-
100
- class ThreadResumeCommand < Command
101
- self.allow_in_post_mortem = false
102
- self.allow_in_control = true
103
- self.need_context = true
104
-
105
- def regexp
106
- /^\s*th(?:read)?\s+resume\s*(\S*)\s*$/
107
- end
108
-
109
- def execute
110
- c = parse_thread_num_for_cmd("thread resume", @match[1])
111
- return unless c
112
- if !c.thread.stop?
113
- print "Already running."
114
- return
115
- end
116
- c.resume
117
- display_context(c)
118
- end
119
-
120
- class << self
121
- def help_command
122
- 'thread'
123
- end
124
-
125
- def help(cmd)
126
- %{
127
- th[read] resume <nnn>\t\tresume thread nnn
128
- }
129
- end
130
- end
131
- end
132
-
133
- # Thread switch Must come after "Thread resume" because "switch" is
134
- # optional
135
-
136
- class ThreadSwitchCommand < Command
137
- self.allow_in_control = true
138
- self.allow_in_post_mortem = false
139
- self.need_context = true
140
-
141
- def regexp
142
- /^\s*th(?:read)?\s*(?:sw(?:itch)?)?\s+(\S+)\s*$/
143
- end
144
-
145
- def execute
146
- c = parse_thread_num_for_cmd("thread switch", @match[1])
147
- return unless c
148
- display_context(c)
149
- c.stop_next = 1
150
- c.thread.run
151
- @state.proceed
152
- end
153
-
154
- class << self
155
- def help_command
156
- 'thread'
157
- end
158
-
159
- def help(cmd)
160
- %{
161
- th[read] [sw[itch]] <nnn>\tswitch thread context to nnn
162
- }
163
- end
164
- end
165
- end
166
-
167
- class ThreadCurrentCommand < Command
168
- self.need_context = true
169
-
170
- def regexp
171
- /^\s*th(?:read)?\s*(?:cur(?:rent)?)?\s*$/
172
- end
173
-
174
- def execute
175
- display_context(@state.context)
176
- end
177
-
178
- class << self
179
- def help_command
180
- 'thread'
181
- end
182
-
183
- def help(cmd)
184
- %{
185
- th[read] [cur[rent]]\t\tshow current thread
186
- }
187
- end
188
- end
189
- end
190
- end
@@ -1,31 +0,0 @@
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
@@ -1,48 +0,0 @@
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
- @break = true
47
- t1.join
48
- A.new.c
@@ -1,32 +0,0 @@
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
@@ -1,20 +0,0 @@
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