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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Rakefile +0 -1
- data/bin/byebug +51 -114
- data/byebug.gemspec +1 -1
- data/ext/byebug/byebug.c +23 -106
- data/ext/byebug/byebug.h +10 -30
- data/ext/byebug/context.c +16 -102
- data/ext/byebug/extconf.rb +0 -9
- data/lib/byebug.rb +8 -122
- data/lib/byebug/command.rb +35 -29
- data/lib/byebug/commands/breakpoints.rb +17 -12
- data/lib/byebug/commands/catchpoint.rb +5 -5
- data/lib/byebug/commands/condition.rb +9 -7
- data/lib/byebug/commands/continue.rb +7 -4
- data/lib/byebug/commands/control.rb +4 -32
- data/lib/byebug/commands/display.rb +15 -14
- data/lib/byebug/commands/edit.rb +14 -13
- data/lib/byebug/commands/enable.rb +33 -35
- data/lib/byebug/commands/eval.rb +22 -29
- data/lib/byebug/commands/finish.rb +11 -9
- data/lib/byebug/commands/frame.rb +24 -50
- data/lib/byebug/commands/help.rb +21 -27
- data/lib/byebug/commands/info.rb +29 -92
- data/lib/byebug/commands/irb.rb +9 -11
- data/lib/byebug/commands/jump.rb +4 -4
- data/lib/byebug/commands/kill.rb +8 -8
- data/lib/byebug/commands/list.rb +2 -2
- data/lib/byebug/commands/method.rb +6 -6
- data/lib/byebug/commands/quit.rb +8 -8
- data/lib/byebug/commands/reload.rb +3 -3
- data/lib/byebug/commands/save.rb +10 -9
- data/lib/byebug/commands/set.rb +29 -26
- data/lib/byebug/commands/show.rb +17 -18
- data/lib/byebug/commands/skip.rb +8 -8
- data/lib/byebug/commands/source.rb +15 -13
- data/lib/byebug/commands/stepping.rb +7 -7
- data/lib/byebug/commands/trace.rb +8 -13
- data/lib/byebug/commands/variables.rb +18 -18
- data/lib/byebug/context.rb +3 -3
- data/lib/byebug/interface.rb +2 -7
- data/lib/byebug/processor.rb +9 -22
- data/lib/byebug/version.rb +1 -1
- data/old_doc/byebug.1 +3 -35
- data/old_doc/byebug.texi +69 -201
- data/old_doc/test-tri2.rb +1 -1
- data/test/breakpoints_test.rb +8 -1
- data/test/frame_test.rb +0 -8
- data/test/help_test.rb +13 -19
- data/test/info_test.rb +8 -32
- data/test/irb_test.rb +3 -4
- data/test/jump_test.rb +4 -4
- data/test/save_test.rb +2 -2
- data/test/set_test.rb +16 -8
- data/test/source_test.rb +10 -1
- data/test/support/context.rb +1 -1
- data/test/support/mocha_extensions.rb +16 -15
- data/test/support/test_dsl.rb +2 -2
- data/test/trace_test.rb +0 -45
- metadata +4 -10
- data/ext/byebug/locker.c +0 -53
- data/lib/byebug/commands/threads.rb +0 -190
- data/test/examples/frame_threads.rb +0 -31
- data/test/examples/info_threads.rb +0 -48
- data/test/examples/thread.rb +0 -32
- data/test/examples/trace_threads.rb +0 -20
data/lib/byebug/commands/eval.rb
CHANGED
@@ -53,22 +53,15 @@ module Byebug
|
|
53
53
|
end
|
54
54
|
|
55
55
|
class << self
|
56
|
-
def
|
57
|
-
%w
|
56
|
+
def names
|
57
|
+
%w(p eval)
|
58
58
|
end
|
59
59
|
|
60
|
-
def
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
else
|
66
|
-
%{
|
67
|
-
e[val] expression\tevaluate expression and print its value,
|
68
|
-
\t\t\talias for p.
|
69
|
-
* NOTE - to turn on autoeval, use 'set autoeval'
|
70
|
-
}
|
71
|
-
end
|
60
|
+
def description
|
61
|
+
%{
|
62
|
+
(p|e[val]) expression\tevaluate expression and print its value
|
63
|
+
* NOTE - to turn on autoeval, use 'set autoeval'
|
64
|
+
}
|
72
65
|
end
|
73
66
|
end
|
74
67
|
end
|
@@ -91,14 +84,14 @@ module Byebug
|
|
91
84
|
end
|
92
85
|
|
93
86
|
class << self
|
94
|
-
def
|
95
|
-
|
87
|
+
def names
|
88
|
+
%w(pp)
|
96
89
|
end
|
97
90
|
|
98
|
-
def
|
91
|
+
def description
|
99
92
|
%{
|
100
|
-
|
101
|
-
|
93
|
+
pp expression\tevaluate expression and pretty-print its value
|
94
|
+
}
|
102
95
|
end
|
103
96
|
end
|
104
97
|
end
|
@@ -128,14 +121,14 @@ module Byebug
|
|
128
121
|
end
|
129
122
|
|
130
123
|
class << self
|
131
|
-
def
|
132
|
-
|
124
|
+
def names
|
125
|
+
%w(putl)
|
133
126
|
end
|
134
127
|
|
135
|
-
def
|
128
|
+
def description
|
136
129
|
%{
|
137
|
-
|
138
|
-
|
130
|
+
putl expression\tevaluate expression, an array, and columnize its value
|
131
|
+
}
|
139
132
|
end
|
140
133
|
end
|
141
134
|
end
|
@@ -167,14 +160,14 @@ module Byebug
|
|
167
160
|
end
|
168
161
|
|
169
162
|
class << self
|
170
|
-
def
|
171
|
-
|
163
|
+
def names
|
164
|
+
%w(ps)
|
172
165
|
end
|
173
166
|
|
174
|
-
def
|
167
|
+
def description
|
175
168
|
%{
|
176
|
-
|
177
|
-
|
169
|
+
ps expression\tevaluate expression, an array, sort and columnize its value
|
170
|
+
}
|
178
171
|
end
|
179
172
|
end
|
180
173
|
end
|
@@ -17,24 +17,26 @@ module Byebug
|
|
17
17
|
frame_pos = get_int(@match[1], "Finish", 0, max_frame-1, 0)
|
18
18
|
return nil unless frame_pos
|
19
19
|
end
|
20
|
-
@state.context.
|
20
|
+
@state.context.step_out frame_pos
|
21
21
|
@state.frame_pos = 0
|
22
22
|
@state.proceed
|
23
23
|
end
|
24
24
|
|
25
25
|
class << self
|
26
|
-
def
|
27
|
-
|
26
|
+
def names
|
27
|
+
%w(finish)
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
30
|
+
def description
|
31
31
|
%{
|
32
|
-
fin[ish]
|
32
|
+
fin[ish][ frame-number]\tExecute until selected stack frame returns.
|
33
33
|
|
34
|
-
If no frame number is given, we run until the currently selected frame
|
35
|
-
The currently selected frame starts out the most-recent frame
|
36
|
-
positioning (e.g "up", "down" or "frame") has been
|
37
|
-
|
34
|
+
If no frame number is given, we run until the currently selected frame
|
35
|
+
returns. The currently selected frame starts out the most-recent frame
|
36
|
+
or 0 if no frame positioning (e.g "up", "down" or "frame") has been
|
37
|
+
performed.
|
38
|
+
|
39
|
+
If a frame number is given we run until that frame returns.
|
38
40
|
}
|
39
41
|
end
|
40
42
|
end
|
@@ -113,11 +113,6 @@ module Byebug
|
|
113
113
|
end
|
114
114
|
|
115
115
|
print frame_str
|
116
|
-
#if ENV['EMACS'] && adjust
|
117
|
-
# fmt = (Byebug.annotate.to_i > 1 ?
|
118
|
-
# "\032\032source %s:%d\n" : "\032\032%s:%d\n")
|
119
|
-
# print fmt % [CommandProcessor.canonic_file(file), line]
|
120
|
-
#end
|
121
116
|
end
|
122
117
|
|
123
118
|
##
|
@@ -172,37 +167,29 @@ module Byebug
|
|
172
167
|
def execute
|
173
168
|
print_backtrace
|
174
169
|
if truncated_callstack?(@state.context, Byebug.start_sentinal)
|
175
|
-
print "Warning: saved frames may be incomplete; compare with caller(0)
|
170
|
+
print "Warning: saved frames may be incomplete; compare with caller(0)"
|
176
171
|
end
|
177
172
|
end
|
178
173
|
|
179
174
|
class << self
|
180
|
-
def
|
181
|
-
%w
|
175
|
+
def names
|
176
|
+
%w(where backtrace)
|
182
177
|
end
|
183
178
|
|
184
|
-
def
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
end
|
194
|
-
s += %{
|
195
|
-
Print the entire stack frame. Each frame is numbered, the most
|
196
|
-
recent frame is 0. frame number can be referred to in the "frame"
|
197
|
-
command; "up" and "down" add or subtract respectively to frame
|
198
|
-
numbers shown. The position of the current frame is marked with
|
199
|
-
-->.
|
200
|
-
}
|
179
|
+
def description
|
180
|
+
%{
|
181
|
+
w[here]|bt|backtrace\tdisplay stack frames
|
182
|
+
|
183
|
+
Print the entire stack frame. Each frame is numbered, the most recent
|
184
|
+
frame is 0. frame number can be referred to in the "frame" command;
|
185
|
+
"up" and "down" add or subtract respectively to frame numbers shown.
|
186
|
+
The position of the current frame is marked with -->.
|
187
|
+
}
|
201
188
|
end
|
202
189
|
end
|
203
190
|
end
|
204
191
|
|
205
|
-
class UpCommand < Command
|
192
|
+
class UpCommand < Command
|
206
193
|
def regexp
|
207
194
|
/^\s* u(?:p)? (?:\s+(.*))?$/x
|
208
195
|
end
|
@@ -214,13 +201,13 @@ module Byebug
|
|
214
201
|
end
|
215
202
|
|
216
203
|
class << self
|
217
|
-
def
|
218
|
-
|
204
|
+
def names
|
205
|
+
%w(up)
|
219
206
|
end
|
220
207
|
|
221
|
-
def
|
208
|
+
def description
|
222
209
|
%{
|
223
|
-
up[count]\tmove to higher frame
|
210
|
+
up[ count]\tmove to higher frame
|
224
211
|
}
|
225
212
|
end
|
226
213
|
end
|
@@ -238,13 +225,13 @@ module Byebug
|
|
238
225
|
end
|
239
226
|
|
240
227
|
class << self
|
241
|
-
def
|
242
|
-
|
228
|
+
def names
|
229
|
+
%w(down)
|
243
230
|
end
|
244
231
|
|
245
|
-
def
|
232
|
+
def description
|
246
233
|
%{
|
247
|
-
down[count]\tmove to lower frame
|
234
|
+
down[ count]\tmove to lower frame
|
248
235
|
}
|
249
236
|
end
|
250
237
|
end
|
@@ -255,7 +242,6 @@ module Byebug
|
|
255
242
|
/ ^\s*
|
256
243
|
f(?:rame)?
|
257
244
|
(?: \s+ (\S+))? \s*
|
258
|
-
(?: thread \s+ (.*))? \s*
|
259
245
|
$/x
|
260
246
|
end
|
261
247
|
|
@@ -266,26 +252,17 @@ module Byebug
|
|
266
252
|
pos = get_int(@match[1], "Frame")
|
267
253
|
return unless pos
|
268
254
|
end
|
269
|
-
#if @match[2]
|
270
|
-
# context = parse_thread_num('frame', @match[2])
|
271
|
-
# unless context
|
272
|
-
# errmsg "Thread #{@match[2]} doesn't exist.\n"
|
273
|
-
# return
|
274
|
-
# end
|
275
|
-
#else
|
276
|
-
# context = @state.context
|
277
|
-
#end
|
278
255
|
adjust_frame(pos, true)
|
279
256
|
end
|
280
257
|
|
281
258
|
class << self
|
282
|
-
def
|
283
|
-
|
259
|
+
def names
|
260
|
+
%w(frame)
|
284
261
|
end
|
285
262
|
|
286
263
|
def help(cmd)
|
287
264
|
%{
|
288
|
-
f[rame]
|
265
|
+
f[rame][ frame-number]
|
289
266
|
|
290
267
|
Move the current frame to the specified frame number, or the 0 if no
|
291
268
|
frame-number has been given.
|
@@ -296,9 +273,6 @@ module Byebug
|
|
296
273
|
Without an argument, the command prints the current stack frame. Since
|
297
274
|
the current position is redisplayed, it may trigger a resyncronization
|
298
275
|
if there is a front end also watching over things.
|
299
|
-
|
300
|
-
If a thread number is given then we set the context for evaluating
|
301
|
-
expressions to that frame of that thread.
|
302
276
|
}
|
303
277
|
end
|
304
278
|
end
|
data/lib/byebug/commands/help.rb
CHANGED
@@ -3,6 +3,7 @@ module Byebug
|
|
3
3
|
# Implements byebug "help" command.
|
4
4
|
class HelpCommand < Command
|
5
5
|
include Columnize
|
6
|
+
|
6
7
|
self.allow_in_control = true
|
7
8
|
|
8
9
|
def regexp
|
@@ -12,41 +13,34 @@ module Byebug
|
|
12
13
|
def execute
|
13
14
|
if @match[1]
|
14
15
|
args = @match[1].split
|
15
|
-
cmds = @state.commands.select
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
unless cmds.empty?
|
23
|
-
help = cmds.map{ |cmd| cmd.help(args) }.join
|
24
|
-
help = help.split("\n").map{|l| l.gsub(/^ +/, '')}
|
25
|
-
help.shift if help.first && help.first.empty?
|
26
|
-
help.pop if help.last && help.last.empty?
|
27
|
-
print help.join("\n")
|
28
|
-
else
|
29
|
-
if args and args[0]
|
30
|
-
errmsg "Undefined command: \"#{args[0]}\". Try \"help\"."
|
16
|
+
cmds = @state.commands.select { |cmd| cmd.names.include?(args[0]) }
|
17
|
+
unless cmds.empty?
|
18
|
+
help = cmds.map{ |cmd| cmd.help(args) }.join
|
19
|
+
help = help.split("\n").map{|l| l.gsub(/^ +/, '')}
|
20
|
+
help.shift if help.first && help.first.empty?
|
21
|
+
help.pop if help.last && help.last.empty?
|
22
|
+
return print help.join("\n") + "\n"
|
31
23
|
else
|
32
|
-
|
33
|
-
|
34
|
-
print "Type 'help <command-name>' for help on a specific command\n\n"
|
35
|
-
print "Available commands:\n"
|
36
|
-
cmds = @state.commands.map{ |cmd| cmd.help_command }
|
37
|
-
cmds = cmds.flatten.uniq.sort
|
38
|
-
print columnize(cmds, Command.settings[:width])
|
24
|
+
return errmsg "Undefined command: \"#{args[0]}\". Try \"help\".\n" if
|
25
|
+
args[0]
|
39
26
|
end
|
40
27
|
end
|
41
|
-
|
28
|
+
|
29
|
+
print "byebug help v#{Byebug::VERSION}\n" unless
|
30
|
+
Command.settings[:testing]
|
31
|
+
|
32
|
+
print "Type \"help <command-name>\" for help on a specific command\n\n"
|
33
|
+
print "Available commands:\n"
|
34
|
+
cmds = @state.commands.map{ |cmd| cmd.names }.flatten.uniq.sort
|
35
|
+
print columnize(cmds, Command.settings[:width])
|
42
36
|
end
|
43
37
|
|
44
38
|
class << self
|
45
|
-
def
|
46
|
-
|
39
|
+
def names
|
40
|
+
%w(help)
|
47
41
|
end
|
48
42
|
|
49
|
-
def
|
43
|
+
def description
|
50
44
|
%{
|
51
45
|
h[elp]\t\tprint this help
|
52
46
|
h[elp] command\tprint help on command
|
data/lib/byebug/commands/info.rb
CHANGED
@@ -43,18 +43,6 @@ module Byebug
|
|
43
43
|
['locals', 2, 'Local variables of the current stack frame'],
|
44
44
|
['program', 2, 'Execution status of the program'],
|
45
45
|
['stack', 2, 'Backtrace of the stack'],
|
46
|
-
['thread', 6, 'List info about thread NUM',
|
47
|
-
'If no thread number is given, we list info for all threads. "terse"' \
|
48
|
-
' and "verbose" options are possible. If "terse", just give summary ' \
|
49
|
-
'thread name information. See "help info threads" for more detail ' \
|
50
|
-
'about this summary information. If "verbose" is appended to the end' \
|
51
|
-
' of the command, then the entire stack trace is given for each ' \
|
52
|
-
'thread.'],
|
53
|
-
['threads', 7, 'information of currently-known threads',
|
54
|
-
'This information includes whether the thread is the current thread ' \
|
55
|
-
'(+), it\'s suspended ($) or it\'s ignored (!), plus the thread ' \
|
56
|
-
'number and the top stack item. If "verbose" is given then the ' \
|
57
|
-
'entire stack frame is shown.'],
|
58
46
|
['variables', 1,
|
59
47
|
'Local and instance variables of the current stack frame']
|
60
48
|
].map do |name, min, short_help, long_help|
|
@@ -76,20 +64,12 @@ module Byebug
|
|
76
64
|
SubcmdStruct.new(name, min, short_help, long_help)
|
77
65
|
end unless defined?(InfoFileSubcommands)
|
78
66
|
|
79
|
-
InfoThreadSubcommands =
|
80
|
-
[
|
81
|
-
['terse', 1, 'summary information'],
|
82
|
-
['verbose', 1, 'summary information and stack frame info'],
|
83
|
-
].map do |name, min, short_help, long_help|
|
84
|
-
SubcmdStruct.new(name, min, short_help, long_help)
|
85
|
-
end unless defined?(InfoThreadSubcommands)
|
86
|
-
|
87
67
|
def regexp
|
88
68
|
/^\s* i(?:nfo)? (?:\s+(.*))?$/ix
|
89
69
|
end
|
90
70
|
|
91
71
|
def execute
|
92
|
-
return
|
72
|
+
return help(@match) unless @match[1]
|
93
73
|
|
94
74
|
args = @match[1].split(/[ \t]+/)
|
95
75
|
param = args.shift
|
@@ -311,57 +291,6 @@ module Byebug
|
|
311
291
|
print_backtrace
|
312
292
|
end
|
313
293
|
|
314
|
-
def info_thread_preamble(arg)
|
315
|
-
if not @state.context
|
316
|
-
errmsg "info threads not available here.\n"
|
317
|
-
return false, false
|
318
|
-
end
|
319
|
-
verbose = if arg
|
320
|
-
subcmd = find(InfoThreadSubcommands, arg)
|
321
|
-
unless subcmd
|
322
|
-
errmsg "'terse' or 'verbose' expected. Got '#{arg}'\n"
|
323
|
-
return false, false
|
324
|
-
end
|
325
|
-
'verbose' == subcmd.name
|
326
|
-
else
|
327
|
-
false
|
328
|
-
end
|
329
|
-
return true, verbose
|
330
|
-
end
|
331
|
-
private :info_thread_preamble
|
332
|
-
|
333
|
-
def info_threads(*args)
|
334
|
-
ok, verbose = info_thread_preamble(args[0])
|
335
|
-
return unless ok
|
336
|
-
threads = Byebug.contexts.sort_by{|c| c.thnum}.each do |c|
|
337
|
-
display_context(c, !verbose)
|
338
|
-
if verbose and not c.ignored?
|
339
|
-
(0...c.stack_size).each do |idx|
|
340
|
-
print "\t"
|
341
|
-
print_frame(idx, true, c)
|
342
|
-
end
|
343
|
-
end
|
344
|
-
end
|
345
|
-
end
|
346
|
-
|
347
|
-
def info_thread(*args)
|
348
|
-
unless args[0]
|
349
|
-
info_threads(args[0])
|
350
|
-
return
|
351
|
-
end
|
352
|
-
ok, verbose = info_thread_preamble(args[1])
|
353
|
-
return unless ok
|
354
|
-
c = parse_thread_num("info thread" , args[0])
|
355
|
-
return unless c
|
356
|
-
display_context(c, !verbose)
|
357
|
-
if verbose and not c.ignored?
|
358
|
-
(0...c.stack_size).each do |idx|
|
359
|
-
print "\t"
|
360
|
-
print_frame(idx, true, c)
|
361
|
-
end
|
362
|
-
end
|
363
|
-
end
|
364
|
-
|
365
294
|
def info_global_variables(*args)
|
366
295
|
unless @state.context
|
367
296
|
errmsg "info global_variables not available here.\n"
|
@@ -398,35 +327,43 @@ module Byebug
|
|
398
327
|
var_class_self
|
399
328
|
end
|
400
329
|
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
def help(args)
|
407
|
-
# specific subcommand help
|
408
|
-
if args[1]
|
409
|
-
subcmd = find(Subcommands, args[1])
|
410
|
-
return "Invalid \"info\" subcommand \"#{args[1]}\"." unless subcmd
|
411
|
-
|
330
|
+
def help(args)
|
331
|
+
if args[1]
|
332
|
+
subcmd = find(Subcommands, args[1])
|
333
|
+
if subcmd
|
412
334
|
str = subcmd.short_help + '.'
|
413
335
|
if 'file' == subcmd.name and args[2]
|
414
336
|
subsubcmd = find(InfoFileSubcommands, args[2])
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
337
|
+
if subsubcmd
|
338
|
+
str += "\nInvalid \"file\" attribute \"#{args[2]}\"."
|
339
|
+
else
|
340
|
+
str += "\n" + subsubcmd.short_help + '.'
|
341
|
+
end
|
419
342
|
else
|
420
|
-
|
343
|
+
str += "\n" + subcmd.long_help if subcmd.long_help
|
421
344
|
end
|
345
|
+
else
|
346
|
+
str = "Invalid \"info\" subcommand \"#{args[1]}\"."
|
422
347
|
end
|
348
|
+
else
|
349
|
+
str = InfoCommand.description + format_subcmds(Subcommands)
|
350
|
+
end
|
351
|
+
print str
|
352
|
+
end
|
353
|
+
|
354
|
+
class << self
|
355
|
+
def names
|
356
|
+
%w(info)
|
357
|
+
end
|
423
358
|
|
424
|
-
|
425
|
-
|
426
|
-
|
359
|
+
def description
|
360
|
+
%{
|
361
|
+
info[ subcommand]
|
362
|
+
|
363
|
+
Generic command for showing things about the program being
|
427
364
|
}
|
428
|
-
str += format_subcmds(Subcommands)
|
429
365
|
end
|
430
366
|
end
|
431
367
|
end
|
368
|
+
|
432
369
|
end
|