byebug 0.0.1 → 1.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.
- data/.gitignore +4 -0
- data/.travis.yml +0 -5
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/LICENSE +23 -20
- data/byebug.gemspec +5 -5
- data/ext/byebug/breakpoint.c +102 -134
- data/ext/byebug/byebug.c +110 -64
- data/ext/byebug/byebug.h +2 -3
- data/ext/byebug/context.c +72 -39
- data/lib/byebug.rb +34 -38
- data/lib/byebug/command.rb +19 -24
- data/lib/byebug/commands/breakpoints.rb +11 -12
- data/lib/byebug/commands/catchpoint.rb +1 -1
- data/lib/byebug/commands/control.rb +2 -4
- data/lib/byebug/commands/finish.rb +1 -1
- data/lib/byebug/commands/frame.rb +15 -17
- data/lib/byebug/commands/info.rb +29 -28
- data/lib/byebug/commands/irb.rb +23 -21
- data/lib/byebug/commands/method.rb +4 -4
- data/lib/byebug/commands/reload.rb +8 -6
- data/lib/byebug/commands/set.rb +27 -23
- data/lib/byebug/commands/show.rb +6 -4
- data/lib/byebug/commands/stepping.rb +2 -2
- data/lib/byebug/commands/threads.rb +10 -10
- data/lib/byebug/commands/trace.rb +13 -14
- data/lib/byebug/commands/variables.rb +14 -12
- data/lib/byebug/context.rb +2 -15
- data/lib/byebug/interface.rb +5 -0
- data/lib/byebug/processor.rb +59 -64
- data/lib/byebug/version.rb +2 -1
- data/old_doc/Makefile +20 -0
- data/{man/rdebug.1 → old_doc/byebug.1} +5 -5
- data/old_doc/byebug.html +6178 -0
- data/old_doc/byebug.texi +3775 -0
- data/{doc → old_doc}/hanoi.rb +0 -0
- data/{doc → old_doc}/primes.rb +0 -0
- data/{doc → old_doc}/test-tri2.rb +0 -0
- data/{doc → old_doc}/tri3.rb +0 -0
- data/{doc → old_doc}/triangle.rb +0 -0
- data/test/breakpoints_test.rb +96 -60
- data/test/conditions_test.rb +15 -12
- data/test/examples/info.rb +5 -5
- data/test/examples/stepping.rb +1 -1
- data/test/frame_test.rb +40 -39
- data/test/info_test.rb +105 -96
- data/test/irb_test.rb +66 -61
- data/test/jump_test.rb +18 -9
- data/test/list_test.rb +114 -107
- data/test/restart_test.rb +51 -58
- data/test/save_test.rb +8 -7
- data/test/set_test.rb +8 -11
- data/test/show_test.rb +3 -5
- data/test/stepping_test.rb +43 -53
- data/test/support/context.rb +1 -0
- data/test/support/processor.rb +10 -4
- data/test/support/test_dsl.rb +46 -18
- data/test/support/test_interface.rb +8 -5
- data/test/test_helper.rb +2 -2
- data/test/trace_test.rb +123 -124
- metadata +39 -17
- data/AUTHORS +0 -10
- data/doc/rdebug-emacs.texi +0 -1030
data/{doc → old_doc}/hanoi.rb
RENAMED
File without changes
|
data/{doc → old_doc}/primes.rb
RENAMED
File without changes
|
File without changes
|
data/{doc → old_doc}/tri3.rb
RENAMED
File without changes
|
data/{doc → old_doc}/triangle.rb
RENAMED
File without changes
|
data/test/breakpoints_test.rb
CHANGED
@@ -5,14 +5,15 @@ describe "Breakpoints" do
|
|
5
5
|
|
6
6
|
describe "setting breakpoint in the current file" do
|
7
7
|
before { enter 'break 10' }
|
8
|
-
subject {
|
8
|
+
subject { Byebug.breakpoints.first }
|
9
9
|
|
10
10
|
def check_subject(field, value)
|
11
11
|
debug_file("breakpoint1") { subject.send(field).must_equal value }
|
12
12
|
end
|
13
13
|
|
14
14
|
it("must have correct pos") { check_subject(:pos, 10) }
|
15
|
-
it("must have correct source") {
|
15
|
+
it("must have correct source") {
|
16
|
+
check_subject(:source, fullpath("breakpoint1")) }
|
16
17
|
it("must have correct expression") { check_subject(:expr, nil) }
|
17
18
|
it("must have correct hit count") { check_subject(:hit_count, 0) }
|
18
19
|
it("must have correct hit value") { check_subject(:hit_value, 0) }
|
@@ -20,7 +21,8 @@ describe "Breakpoints" do
|
|
20
21
|
it("must return right response") do
|
21
22
|
id = nil
|
22
23
|
debug_file('breakpoint1') { id = subject.id }
|
23
|
-
check_output_includes
|
24
|
+
check_output_includes \
|
25
|
+
"Created breakpoint #{id} at #{fullpath('breakpoint1')}:10"
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
@@ -40,7 +42,9 @@ describe "Breakpoints" do
|
|
40
42
|
|
41
43
|
it "must show an error" do
|
42
44
|
debug_file("breakpoint1")
|
43
|
-
check_output_includes
|
45
|
+
check_output_includes \
|
46
|
+
"There are only #{LineCache.size(fullpath('breakpoint1'))} lines in" \
|
47
|
+
" file #{fullpath('breakpoint1')}", interface.error_queue
|
44
48
|
end
|
45
49
|
end
|
46
50
|
|
@@ -54,7 +58,9 @@ describe "Breakpoints" do
|
|
54
58
|
|
55
59
|
it "must show an error" do
|
56
60
|
debug_file("breakpoint1")
|
57
|
-
check_output_includes
|
61
|
+
check_output_includes \
|
62
|
+
"Line 11 is not a stopping point in file #{fullpath('breakpoint1')}",
|
63
|
+
interface.error_queue
|
58
64
|
end
|
59
65
|
end
|
60
66
|
|
@@ -66,49 +72,63 @@ describe "Breakpoints" do
|
|
66
72
|
|
67
73
|
it "must stop at the correct file" do
|
68
74
|
enter 'break 14', 'cont'
|
69
|
-
debug_file("breakpoint1") {
|
75
|
+
debug_file("breakpoint1") {
|
76
|
+
state.file.must_equal fullpath("breakpoint1") }
|
70
77
|
end
|
71
78
|
|
72
79
|
describe "show a message" do
|
73
|
-
|
80
|
+
before do
|
81
|
+
@old_hashes = {}
|
82
|
+
set_tmp_hash(Byebug::Command.settings, :basename, false)
|
83
|
+
@id = nil
|
84
|
+
end
|
85
|
+
|
86
|
+
after do
|
87
|
+
restore_tmp_hash(Byebug::Command.settings, :basename)
|
88
|
+
end
|
74
89
|
|
75
90
|
it "must show a message with full filename" do
|
76
91
|
enter 'break 14', 'cont'
|
77
|
-
debug_file("breakpoint1")
|
78
|
-
check_output_includes
|
92
|
+
debug_file("breakpoint1") { @id = Byebug.breakpoints.first.id }
|
93
|
+
check_output_includes \
|
94
|
+
"Created breakpoint #{@id} at #{fullpath('breakpoint1')}:14"
|
79
95
|
end
|
80
96
|
|
81
97
|
it "must show a message with basename" do
|
82
98
|
enter 'set basename', 'break 14', 'cont'
|
83
|
-
debug_file("breakpoint1")
|
84
|
-
check_output_includes "
|
99
|
+
debug_file("breakpoint1") { @id = Byebug.breakpoints.first.id }
|
100
|
+
check_output_includes "Created breakpoint #{@id} at breakpoint1.rb:14"
|
85
101
|
end
|
86
102
|
end
|
87
103
|
end
|
88
104
|
|
89
|
-
|
90
105
|
describe "reloading source on change" do
|
91
|
-
temporary_change_hash_value(Byebug::Command.settings, :reload_source_on_change, false)
|
92
|
-
|
93
106
|
it "must not reload source if autoreload is not set" do
|
94
|
-
|
107
|
+
id = nil
|
108
|
+
enter \
|
95
109
|
'set noautoreload',
|
96
110
|
->{change_line_in_file(fullpath('breakpoint1'), 14, ''); 'break 14'},
|
97
|
-
->{change_line_in_file(fullpath('breakpoint1'), 14, 'c = a + b');
|
98
|
-
|
99
|
-
debug_file
|
100
|
-
check_output_includes
|
111
|
+
->{change_line_in_file(fullpath('breakpoint1'), 14, 'c = a + b');
|
112
|
+
'cont'}
|
113
|
+
debug_file("breakpoint1") { id = Byebug.breakpoints.first.id }
|
114
|
+
check_output_includes \
|
115
|
+
"Created breakpoint #{id} at #{fullpath('breakpoint1')}:14"
|
101
116
|
end
|
102
117
|
|
103
118
|
it "must reload source if autoreload is set" do
|
104
119
|
enter(
|
105
120
|
'set autoreload',
|
106
121
|
->{change_line_in_file(fullpath('breakpoint1'), 14, ''); 'break 14'},
|
107
|
-
# Setting second breakpoint just to reload the source code after rolling
|
108
|
-
|
122
|
+
# Setting second breakpoint just to reload the source code after rolling
|
123
|
+
# the file changes back
|
124
|
+
->{change_line_in_file(fullpath('breakpoint1'), 14, 'c = a + b');
|
125
|
+
'break 15'},
|
126
|
+
'cont'
|
109
127
|
)
|
110
128
|
debug_file "breakpoint1"
|
111
|
-
check_output_includes
|
129
|
+
check_output_includes \
|
130
|
+
"Line 14 is not a stopping point in file #{fullpath('breakpoint1')}",
|
131
|
+
interface.error_queue
|
112
132
|
end
|
113
133
|
end
|
114
134
|
|
@@ -123,7 +143,8 @@ describe "Breakpoints" do
|
|
123
143
|
end
|
124
144
|
|
125
145
|
it "must stop at the correct file" do
|
126
|
-
debug_file("breakpoint1") {
|
146
|
+
debug_file("breakpoint1") {
|
147
|
+
state.file.must_equal fullpath("breakpoint2") }
|
127
148
|
end
|
128
149
|
end
|
129
150
|
|
@@ -137,7 +158,8 @@ describe "Breakpoints" do
|
|
137
158
|
end
|
138
159
|
|
139
160
|
it "must ask about setting breakpoint anyway" do
|
140
|
-
check_output_includes
|
161
|
+
check_output_includes \
|
162
|
+
"Set breakpoint anyway? (y/n)", interface.confirm_queue
|
141
163
|
end
|
142
164
|
end
|
143
165
|
end
|
@@ -153,7 +175,8 @@ describe "Breakpoints" do
|
|
153
175
|
end
|
154
176
|
|
155
177
|
it "must stop at the correct file" do
|
156
|
-
debug_file("breakpoint1") {
|
178
|
+
debug_file("breakpoint1") {
|
179
|
+
state.file.must_equal fullpath("breakpoint1") }
|
157
180
|
end
|
158
181
|
end
|
159
182
|
|
@@ -167,7 +190,8 @@ describe "Breakpoints" do
|
|
167
190
|
end
|
168
191
|
|
169
192
|
it "must stop at the correct file" do
|
170
|
-
debug_file("breakpoint1") {
|
193
|
+
debug_file("breakpoint1") {
|
194
|
+
state.file.must_equal fullpath("breakpoint1") }
|
171
195
|
end
|
172
196
|
end
|
173
197
|
|
@@ -180,7 +204,6 @@ describe "Breakpoints" do
|
|
180
204
|
end
|
181
205
|
end
|
182
206
|
|
183
|
-
|
184
207
|
describe "set breakpoint to an invalid location" do
|
185
208
|
before { enter "break foo" }
|
186
209
|
|
@@ -190,19 +213,20 @@ describe "Breakpoints" do
|
|
190
213
|
|
191
214
|
it "must show an error" do
|
192
215
|
debug_file("breakpoint1")
|
193
|
-
check_output_includes
|
216
|
+
check_output_includes \
|
217
|
+
'Invalid breakpoint location: foo.', interface.error_queue
|
194
218
|
end
|
195
219
|
end
|
196
220
|
|
197
|
-
|
198
221
|
describe "disabling a breakpoint" do
|
199
222
|
describe "successfully" do
|
200
223
|
before { enter "break 14" }
|
201
224
|
|
202
225
|
describe "short syntax" do
|
203
|
-
before { enter ->{"disable #{
|
226
|
+
before { enter ->{"disable #{Byebug.breakpoints.first.id}"}, "break 15" }
|
204
227
|
it "must have a breakpoint with #enabled? returning false" do
|
205
|
-
debug_file("breakpoint1") {
|
228
|
+
debug_file("breakpoint1") {
|
229
|
+
Byebug.breakpoints.first.enabled?.must_equal false }
|
206
230
|
end
|
207
231
|
|
208
232
|
it "must not stop on the disabled breakpoint" do
|
@@ -212,9 +236,11 @@ describe "Breakpoints" do
|
|
212
236
|
end
|
213
237
|
|
214
238
|
describe "full syntax" do
|
215
|
-
before { enter ->{"disable breakpoints #{
|
239
|
+
before { enter ->{"disable breakpoints #{Byebug.breakpoints.first.id}"},
|
240
|
+
"break 15" }
|
216
241
|
it "must have a breakpoint with #enabled? returning false" do
|
217
|
-
debug_file("breakpoint1") {
|
242
|
+
debug_file("breakpoint1") {
|
243
|
+
Byebug.breakpoints.first.enabled?.must_equal false }
|
218
244
|
end
|
219
245
|
end
|
220
246
|
end
|
@@ -223,34 +249,40 @@ describe "Breakpoints" do
|
|
223
249
|
it "must show an error if syntax is incorrect" do
|
224
250
|
enter "disable"
|
225
251
|
debug_file("breakpoint1")
|
226
|
-
check_output_includes
|
227
|
-
'"disable" must be followed "display", "breakpoints" or breakpoint
|
228
|
-
interface.error_queue
|
229
|
-
|
252
|
+
check_output_includes \
|
253
|
+
'"disable" must be followed "display", "breakpoints" or breakpoint ' \
|
254
|
+
'numbers.', interface.error_queue
|
255
|
+
|
230
256
|
end
|
231
257
|
|
232
258
|
it "must show an error if no breakpoints is set" do
|
233
259
|
enter "disable 1"
|
234
260
|
debug_file("breakpoint1")
|
235
|
-
check_output_includes
|
261
|
+
check_output_includes \
|
262
|
+
'No breakpoints have been set.', interface.error_queue
|
236
263
|
end
|
237
264
|
|
238
|
-
it "must show an error if not a number is provided as an argument to
|
265
|
+
it "must show an error if not a number is provided as an argument to " \
|
266
|
+
" 'disable' command" do
|
239
267
|
enter "break 14", "disable foo"
|
240
268
|
debug_file("breakpoint1")
|
241
|
-
check_output_includes
|
269
|
+
check_output_includes \
|
270
|
+
"Disable breakpoints argument 'foo' needs to be a number."
|
242
271
|
end
|
243
272
|
end
|
244
273
|
end
|
245
274
|
|
246
275
|
describe "enabling a breakpoint" do
|
276
|
+
|
247
277
|
describe "successfully" do
|
248
278
|
before { enter "break 14" }
|
279
|
+
|
249
280
|
describe "short syntax" do
|
250
|
-
before { enter ->{"enable #{
|
281
|
+
before { enter ->{"enable #{Byebug.breakpoints.first.id}"}, "break 15" }
|
251
282
|
|
252
283
|
it "must have a breakpoint with #enabled? returning true" do
|
253
|
-
debug_file("breakpoint1") {
|
284
|
+
debug_file("breakpoint1") {
|
285
|
+
Byebug.breakpoints.first.enabled?.must_equal true }
|
254
286
|
end
|
255
287
|
|
256
288
|
it "must stop on the enabled breakpoint" do
|
@@ -260,10 +292,12 @@ describe "Breakpoints" do
|
|
260
292
|
end
|
261
293
|
|
262
294
|
describe "full syntax" do
|
263
|
-
before { enter ->{"enable breakpoints #{
|
295
|
+
before { enter ->{"enable breakpoints #{Byebug.breakpoints.first.id}"},
|
296
|
+
"break 15" }
|
264
297
|
|
265
298
|
it "must have a breakpoint with #enabled? returning true" do
|
266
|
-
debug_file("breakpoint1") {
|
299
|
+
debug_file("breakpoint1") {
|
300
|
+
Byebug.breakpoints.first.enabled?.must_equal true }
|
267
301
|
end
|
268
302
|
end
|
269
303
|
end
|
@@ -272,16 +306,15 @@ describe "Breakpoints" do
|
|
272
306
|
it "must show an error if syntax is incorrect" do
|
273
307
|
enter "enable"
|
274
308
|
debug_file("breakpoint1")
|
275
|
-
check_output_includes
|
276
|
-
'"
|
277
|
-
interface.error_queue
|
278
|
-
)
|
309
|
+
check_output_includes '"enable" must be followed "display", ' \
|
310
|
+
'"breakpoints" or breakpoint numbers.', interface.error_queue
|
279
311
|
end
|
280
312
|
end
|
281
313
|
end
|
282
314
|
|
283
315
|
describe "deleting a breakpoint" do
|
284
|
-
before { enter "break 14", ->{"delete #{
|
316
|
+
before { enter "break 14", ->{"delete #{Byebug.breakpoints.first.id}"},
|
317
|
+
"break 15" }
|
285
318
|
|
286
319
|
it "must have only one breakpoint" do
|
287
320
|
debug_file("breakpoint1") { Byebug.breakpoints.size.must_equal 1 }
|
@@ -307,42 +340,45 @@ describe "Breakpoints" do
|
|
307
340
|
it "must show an error when conditional syntax is wrong" do
|
308
341
|
enter "break 14 ifa b == 3", "break 15", "cont"
|
309
342
|
debug_file("breakpoint1") { state.line.must_equal 15 }
|
310
|
-
check_output_includes
|
343
|
+
check_output_includes \
|
344
|
+
"Expecting 'if' in breakpoint condition; got: ifa b == 3.",
|
345
|
+
interface.error_queue
|
311
346
|
end
|
312
347
|
|
313
348
|
describe "enabling with wrong conditional syntax" do
|
314
349
|
before do
|
315
350
|
enter(
|
316
351
|
"break 14",
|
317
|
-
->{"disable #{
|
318
|
-
->{"cond #{
|
319
|
-
->{"enable #{
|
352
|
+
->{"disable #{Byebug.breakpoints.first.id}"},
|
353
|
+
->{"cond #{Byebug.breakpoints.first.id} b -=( 3"},
|
354
|
+
->{"enable #{Byebug.breakpoints.first.id}"}
|
320
355
|
)
|
321
356
|
end
|
322
357
|
|
323
358
|
it "must not enable a breakpoint" do
|
324
|
-
debug_file("breakpoint1") {
|
359
|
+
debug_file("breakpoint1") {
|
360
|
+
Byebug.breakpoints.first.enabled?.must_equal false }
|
325
361
|
end
|
326
362
|
|
327
363
|
it "must show an error" do
|
328
364
|
debug_file("breakpoint1")
|
329
|
-
check_output_includes(
|
330
|
-
'
|
331
|
-
interface.error_queue
|
332
|
-
)
|
365
|
+
check_output_includes 'Expression "b -=( 3" syntactically incorrect; ' \
|
366
|
+
'breakpoint remains disabled.', interface.error_queue
|
333
367
|
end
|
334
368
|
end
|
335
369
|
|
336
370
|
it "must show an error if no file or line is specified" do
|
337
371
|
enter "break ifa b == 3", "break 15", "cont"
|
338
372
|
debug_file("breakpoint1") { state.line.must_equal 15 }
|
339
|
-
check_output_includes
|
373
|
+
check_output_includes \
|
374
|
+
"Invalid breakpoint location: ifa b == 3.", interface.error_queue
|
340
375
|
end
|
341
376
|
|
342
377
|
it "must show an error if expression syntax is invalid" do
|
343
378
|
enter "break if b -=) 3", "break 15", "cont"
|
344
379
|
debug_file("breakpoint1") { state.line.must_equal 15 }
|
345
|
-
check_output_includes 'Expression "b -=) 3" syntactically incorrect;
|
380
|
+
check_output_includes 'Expression "b -=) 3" syntactically incorrect; ' \
|
381
|
+
'breakpoint disabled.', interface.error_queue
|
346
382
|
end
|
347
383
|
end
|
348
384
|
|
data/test/conditions_test.rb
CHANGED
@@ -8,17 +8,18 @@ describe "Conditions" do
|
|
8
8
|
|
9
9
|
describe "successfully" do
|
10
10
|
it "must assign the expression to breakpoint" do
|
11
|
-
enter ->{"cond #{
|
12
|
-
debug_file('conditions') {
|
11
|
+
enter ->{"cond #{Byebug.breakpoints.first.id} b == 5"}, "cont"
|
12
|
+
debug_file('conditions') {
|
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 #{
|
17
|
+
enter ->{"cond #{Byebug.breakpoints.first.id} b == 5"}, "cont"
|
17
18
|
debug_file('conditions') { state.line.must_equal 3 }
|
18
19
|
end
|
19
20
|
|
20
21
|
it "must work with full command name too" do
|
21
|
-
enter ->{"condition #{
|
22
|
+
enter ->{"condition #{Byebug.breakpoints.first.id} b == 5"}, "cont"
|
22
23
|
debug_file('conditions') { state.line.must_equal 3 }
|
23
24
|
end
|
24
25
|
end
|
@@ -27,25 +28,27 @@ describe "Conditions" do
|
|
27
28
|
before { enter "break 4" }
|
28
29
|
|
29
30
|
it "must not stop at the breakpoint if condition is false" do
|
30
|
-
enter ->{"cond #{
|
31
|
+
enter ->{"cond #{Byebug.breakpoints.first.id} b == 3"}, "cont"
|
31
32
|
debug_file('conditions') { state.line.must_equal 4 }
|
32
33
|
end
|
33
34
|
it "must assign the expression to breakpoint in spite of incorrect syntax" do
|
34
|
-
enter ->{"cond #{
|
35
|
-
debug_file('conditions') {
|
35
|
+
enter ->{"cond #{Byebug.breakpoints.first.id} b =="}, "cont"
|
36
|
+
debug_file('conditions') {
|
37
|
+
Byebug.breakpoints.first.expr.must_equal "b ==" }
|
36
38
|
end
|
37
39
|
it "must ignore the condition if when incorrect syntax" do
|
38
|
-
enter ->{"cond #{
|
40
|
+
enter ->{"cond #{Byebug.breakpoints.first.id} b =="}, "cont"
|
39
41
|
debug_file('conditions') { state.line.must_equal 4 }
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
44
46
|
describe "removing conditions" do
|
45
|
-
before { enter "break 3 if b == 3", "break 4",
|
47
|
+
before { enter "break 3 if b == 3", "break 4",
|
48
|
+
->{"cond #{Byebug.breakpoints.first.id}"}, "cont" }
|
46
49
|
|
47
50
|
it "must remove the condition from the breakpoint" do
|
48
|
-
debug_file('conditions') {
|
51
|
+
debug_file('conditions') { Byebug.breakpoints.first.expr.must_be_nil }
|
49
52
|
end
|
50
53
|
|
51
54
|
it "must not stop on the breakpoint" do
|
@@ -69,8 +72,8 @@ describe "Conditions" do
|
|
69
72
|
describe "Post Mortem" do
|
70
73
|
it "must be able to set conditions in post-mortem mode" do
|
71
74
|
skip("No post morten mode for now")
|
72
|
-
|
73
|
-
|
75
|
+
enter 'cont', 'break 12', ->{"cond #{breakpoint.id} true"}, 'cont'
|
76
|
+
debug_file("post_mortem") { state.line.must_equal 12 }
|
74
77
|
end
|
75
78
|
end
|
76
79
|
|
data/test/examples/info.rb
CHANGED