byebug 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -2
- data/bin/byebug +2 -4
- data/ext/byebug/byebug.c +10 -10
- data/lib/byebug/command.rb +15 -9
- data/lib/byebug/commands/breakpoints.rb +4 -3
- data/lib/byebug/commands/enable.rb +57 -61
- data/lib/byebug/commands/eval.rb +35 -31
- data/lib/byebug/commands/frame.rb +24 -19
- data/lib/byebug/commands/info.rb +74 -95
- data/lib/byebug/commands/list.rb +3 -0
- data/lib/byebug/commands/set.rb +147 -158
- data/lib/byebug/commands/show.rb +46 -41
- data/lib/byebug/commands/trace.rb +6 -6
- data/lib/byebug/context.rb +1 -2
- data/lib/byebug/processor.rb +10 -7
- data/lib/byebug/version.rb +1 -1
- data/old_doc/byebug.texi +426 -461
- data/test/eval_test.rb +35 -29
- data/test/frame_test.rb +48 -47
- data/test/info_test.rb +4 -4
- data/test/list_test.rb +1 -4
- data/test/reload_test.rb +35 -30
- data/test/show_test.rb +4 -6
- data/test/source_test.rb +33 -30
- data/test/stepping_test.rb +0 -1
- data/test/support/test_dsl.rb +0 -4
- data/test/test_helper.rb +0 -5
- data/test/trace_test.rb +65 -69
- metadata +2 -3
- data/old_doc/byebug.html +0 -6178
@@ -78,6 +78,17 @@ module Byebug
|
|
78
78
|
return call_str
|
79
79
|
end
|
80
80
|
|
81
|
+
def print_backtrace
|
82
|
+
(0...@state.context.stack_size).each do |idx|
|
83
|
+
if idx == @state.frame_pos
|
84
|
+
print "--> "
|
85
|
+
else
|
86
|
+
print " "
|
87
|
+
end
|
88
|
+
print_frame(idx)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
81
92
|
def print_frame(pos, adjust = false, context=@state.context)
|
82
93
|
file = context.frame_file(pos)
|
83
94
|
line = context.frame_line(pos)
|
@@ -91,12 +102,12 @@ module Byebug
|
|
91
102
|
end
|
92
103
|
end
|
93
104
|
|
94
|
-
frame_num = "##{pos}"
|
105
|
+
frame_num = "##{pos} "
|
95
106
|
call_str = get_frame_call(frame_num, pos, context)
|
96
|
-
file_line = "at
|
107
|
+
file_line = "at #{CommandProcessor.canonic_file(file)}:#{line}\n"
|
97
108
|
print frame_num
|
98
109
|
unless call_str.empty?
|
99
|
-
print call_str
|
110
|
+
print "#{call_str} "
|
100
111
|
if call_str.size + frame_num.size + file_line.size > self.class.settings[:width]
|
101
112
|
print "\n "
|
102
113
|
end
|
@@ -159,17 +170,9 @@ module Byebug
|
|
159
170
|
end
|
160
171
|
|
161
172
|
def execute
|
162
|
-
|
163
|
-
if idx == @state.frame_pos
|
164
|
-
print "--> "
|
165
|
-
else
|
166
|
-
print " "
|
167
|
-
end
|
168
|
-
print_frame(idx)
|
169
|
-
|
170
|
-
end
|
173
|
+
print_backtrace
|
171
174
|
if truncated_callstack?(@state.context, Byebug.start_sentinal)
|
172
|
-
|
175
|
+
print "Warning: saved frames may be incomplete; compare with caller(0).\n"
|
173
176
|
end
|
174
177
|
end
|
175
178
|
|
@@ -182,17 +185,19 @@ module Byebug
|
|
182
185
|
s = if cmd == 'where'
|
183
186
|
%{
|
184
187
|
w[here]\tdisplay stack frames
|
185
|
-
|
188
|
+
}
|
186
189
|
else
|
187
190
|
%{
|
188
191
|
bt|backtrace\t\talias for where - display stack frames
|
189
|
-
|
192
|
+
}
|
190
193
|
end
|
191
194
|
s += %{
|
192
|
-
Print the entire stack frame. Each frame is numbered, the most
|
193
|
-
frame is 0. frame number can be referred to in the "frame"
|
194
|
-
"up" and "down" add or subtract respectively to frame
|
195
|
-
The position of the current frame is marked with
|
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
|
+
}
|
196
201
|
end
|
197
202
|
end
|
198
203
|
end
|
data/lib/byebug/commands/info.rb
CHANGED
@@ -14,53 +14,55 @@ module Byebug
|
|
14
14
|
print "No exceptions set to be caught.\n"
|
15
15
|
end
|
16
16
|
end
|
17
|
-
|
18
17
|
end
|
19
18
|
|
20
19
|
# Implements byebug "info" command.
|
21
20
|
class InfoCommand < Command
|
22
21
|
self.allow_in_control = true
|
23
|
-
Subcommands =
|
24
|
-
[
|
25
|
-
|
26
|
-
'
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
'
|
32
|
-
'
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
'
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
# '
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
# '
|
53
|
-
#
|
54
|
-
#
|
55
|
-
|
56
|
-
'
|
22
|
+
Subcommands =
|
23
|
+
[
|
24
|
+
['args', 1, 'Argument variables of current stack frame'],
|
25
|
+
['breakpoints', 1, 'Status of user-settable breakpoints',
|
26
|
+
'Without argument, list info about all breakpoints. With an integer ' \
|
27
|
+
'argument, list info on that breakpoint.'],
|
28
|
+
['catch', 3,
|
29
|
+
'Exceptions that can be caught in the current stack frame'],
|
30
|
+
['display', 2, 'Expressions to display when program stops'],
|
31
|
+
['file', 4, 'Info about a particular file read in',
|
32
|
+
'After the file name is supplied, you can list file attributes that ' \
|
33
|
+
'you wish to see. Attributes include: "all", "basic", "breakpoint", ' \
|
34
|
+
'"lines", "mtime", "path" and "sha1".'],
|
35
|
+
['files', 5, 'File names and timestamps of files read in'],
|
36
|
+
['global_variables', 2, 'Global variables'],
|
37
|
+
['instance_variables', 2,
|
38
|
+
'Instance variables of the current stack frame'],
|
39
|
+
['line', 2,
|
40
|
+
'Line number and file name of current position in source file'],
|
41
|
+
['locals', 2, 'Local variables of the current stack frame'],
|
42
|
+
['program', 2, 'Execution status of the program'],
|
43
|
+
['stack', 2, 'Backtrace of the stack'],
|
44
|
+
# ['thread', 6, 'List info about thread NUM',
|
45
|
+
# 'If no thread number is given, we list info for all threads. "terse"' \
|
46
|
+
# ' and "verbose" options are possible. If "terse", just give summary ' \
|
47
|
+
# 'thread name information. See "help info threads" for more detail ' \
|
48
|
+
# 'about this summary information. If "verbose" is appended to the end' \
|
49
|
+
# ' of the command, then the entire stack trace is given for each ' \
|
50
|
+
# 'thread.'],
|
51
|
+
# ['threads', 7, 'information of currently-known threads',
|
52
|
+
# 'This information includes whether the thread is the current thread ' \
|
53
|
+
# '(+), it\'s suspended ($) or it\'s ignored (!), plus the thread ' \
|
54
|
+
# 'number and the top stack item. If "verbose" is given then the ' \
|
55
|
+
# 'entire stack frame is shown.'],
|
56
|
+
['variables', 1,
|
57
|
+
'Local and instance variables of the current stack frame']
|
57
58
|
].map do |name, min, short_help, long_help|
|
58
59
|
SubcmdStruct.new(name, min, short_help, long_help)
|
59
60
|
end unless defined?(Subcommands)
|
60
61
|
|
61
|
-
InfoFileSubcommands =
|
62
|
-
|
63
|
-
|
62
|
+
InfoFileSubcommands =
|
63
|
+
[
|
64
|
+
['all', 1, 'All file information available - breakpoints, lines, ' \
|
65
|
+
'mtime, path and sha1'],
|
64
66
|
['basic', 2, 'basic information - path, number of lines'],
|
65
67
|
['breakpoints', 2, 'Show trace line numbers',
|
66
68
|
'These are the line number where a breakpoint can be set.'],
|
@@ -72,7 +74,8 @@ module Byebug
|
|
72
74
|
SubcmdStruct.new(name, min, short_help, long_help)
|
73
75
|
end unless defined?(InfoFileSubcommands)
|
74
76
|
|
75
|
-
# InfoThreadSubcommands =
|
77
|
+
# InfoThreadSubcommands =
|
78
|
+
# [
|
76
79
|
# ['terse', 1, 'summary information'],
|
77
80
|
# ['verbose', 1, 'summary information and stack frame info'],
|
78
81
|
# ].map do |name, min, short_help, long_help|
|
@@ -84,17 +87,15 @@ module Byebug
|
|
84
87
|
end
|
85
88
|
|
86
89
|
def execute
|
87
|
-
|
88
|
-
|
90
|
+
return print_subcmds(Subcommands) unless @match[1]
|
91
|
+
|
92
|
+
args = @match[1].split(/[ \t]+/)
|
93
|
+
param = args.shift
|
94
|
+
subcmd = find(Subcommands, param)
|
95
|
+
if subcmd
|
96
|
+
send("info_#{subcmd.name}", *args)
|
89
97
|
else
|
90
|
-
|
91
|
-
param = args.shift
|
92
|
-
subcmd = find(Subcommands, param)
|
93
|
-
if subcmd
|
94
|
-
send("info_#{subcmd.name}", *args)
|
95
|
-
else
|
96
|
-
errmsg "Unknown info command #{param}\n"
|
97
|
-
end
|
98
|
+
errmsg "Unknown info command #{param}\n"
|
98
99
|
end
|
99
100
|
end
|
100
101
|
|
@@ -167,24 +168,17 @@ module Byebug
|
|
167
168
|
end
|
168
169
|
|
169
170
|
def info_file(*args)
|
170
|
-
unless args[0]
|
171
|
-
info_files
|
172
|
-
return
|
173
|
-
end
|
171
|
+
return info_files unless args[0]
|
174
172
|
file = args[0]
|
175
|
-
param = args[1]
|
176
173
|
|
177
|
-
param = 'basic'
|
174
|
+
param = args[1] ? args[1] : 'basic'
|
175
|
+
|
178
176
|
subcmd = find(InfoFileSubcommands, param)
|
179
|
-
unless subcmd
|
180
|
-
errmsg "Invalid parameter #{param}\n"
|
181
|
-
return
|
182
|
-
end
|
177
|
+
return errmsg "Invalid parameter #{param}\n" unless subcmd
|
183
178
|
|
184
179
|
unless LineCache::cached?(file)
|
185
180
|
unless LineCache::cached_script?(file)
|
186
|
-
print "File #{file} is not cached\n"
|
187
|
-
return
|
181
|
+
return print "File #{file} is not cached\n"
|
188
182
|
end
|
189
183
|
LineCache::cache(file, Command.settings[:reload_source_on_change])
|
190
184
|
end
|
@@ -192,10 +186,9 @@ module Byebug
|
|
192
186
|
print "File #{file}"
|
193
187
|
path = LineCache.path(file)
|
194
188
|
if %w(all basic path).member?(subcmd.name) and path != file
|
195
|
-
print " -
|
196
|
-
else
|
197
|
-
print "\n"
|
189
|
+
print " - #{path}"
|
198
190
|
end
|
191
|
+
print "\n"
|
199
192
|
|
200
193
|
if %w(all basic lines).member?(subcmd.name)
|
201
194
|
lines = LineCache.size(file)
|
@@ -214,6 +207,7 @@ module Byebug
|
|
214
207
|
stat = LineCache.stat(file)
|
215
208
|
print "\t%s\n", stat.mtime if stat
|
216
209
|
end
|
210
|
+
|
217
211
|
if %w(all sha1).member?(subcmd.name)
|
218
212
|
print "\t%s\n", LineCache.sha1(file)
|
219
213
|
end
|
@@ -304,14 +298,7 @@ module Byebug
|
|
304
298
|
errmsg "info stack not available here.\n"
|
305
299
|
return
|
306
300
|
end
|
307
|
-
|
308
|
-
if idx == @state.frame_pos
|
309
|
-
print "--> "
|
310
|
-
else
|
311
|
-
print " "
|
312
|
-
end
|
313
|
-
print_frame(idx)
|
314
|
-
end
|
301
|
+
print_backtrace
|
315
302
|
end
|
316
303
|
|
317
304
|
# def info_thread_preamble(arg)
|
@@ -407,33 +394,25 @@ module Byebug
|
|
407
394
|
end
|
408
395
|
|
409
396
|
def help(args)
|
397
|
+
# specific subcommand help
|
410
398
|
if args[1]
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
str
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
(s.size >= try_subcmd.min) and
|
422
|
-
(try_subcmd.name[0..s.size-1] == s)
|
423
|
-
end
|
424
|
-
if subsubcmd
|
425
|
-
str += "\n" + subsubcmd.short_help + '.'
|
426
|
-
else
|
427
|
-
str += "\nInvalid file attribute #{args[2]}."
|
428
|
-
end
|
429
|
-
else
|
430
|
-
str += "\n" + subcmd.long_help if subcmd.long_help
|
431
|
-
end
|
432
|
-
return str
|
399
|
+
subcmd = find(Subcommands, args[1])
|
400
|
+
return "Invalid \"info\" subcommand \"#{args[1]}\"." unless subcmd
|
401
|
+
|
402
|
+
str = subcmd.short_help + '.'
|
403
|
+
if 'file' == subcmd.name and args[2]
|
404
|
+
subsubcmd = find(InfoFileSubcommands, args[2])
|
405
|
+
return str += "\nInvalid \"file\" attribute \"#{args[2]}\"." \
|
406
|
+
unless subsubcmd
|
407
|
+
|
408
|
+
str += "\n" + subsubcmd.short_help + '.'
|
433
409
|
else
|
434
|
-
|
410
|
+
str += "\n" + subcmd.long_help if subcmd.long_help
|
435
411
|
end
|
412
|
+
return str
|
436
413
|
end
|
414
|
+
|
415
|
+
# general help
|
437
416
|
s = %{
|
438
417
|
Generic command for showing things about the program being debugged.
|
439
418
|
--
|
data/lib/byebug/commands/list.rb
CHANGED
data/lib/byebug/commands/set.rb
CHANGED
@@ -4,35 +4,37 @@ module Byebug
|
|
4
4
|
class SetCommand < Command
|
5
5
|
SubcmdStruct2=Struct.new(:name, :min, :is_bool, :short_help,
|
6
6
|
:long_help) unless defined?(SubcmdStruct2)
|
7
|
-
Subcommands =
|
8
|
-
[
|
9
|
-
'
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
'
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
'
|
23
|
-
|
24
|
-
|
25
|
-
'
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
'
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
7
|
+
Subcommands =
|
8
|
+
[
|
9
|
+
['annotate', 2, false, 'Set annotation level',
|
10
|
+
'0 == normal. ' \
|
11
|
+
'2 == output annotated suitably for use by programs that control ' \
|
12
|
+
'byebug.'],
|
13
|
+
['args', 2, false,
|
14
|
+
'Set argument list to give program being debugged when it is started'],
|
15
|
+
['autoeval', 4, true, 'Evaluate every unrecognized command'],
|
16
|
+
['autolist', 4, true, 'Execute "list" command on every breakpoint'],
|
17
|
+
['autoirb', 4, true, 'Invoke IRB on every stop'],
|
18
|
+
['autoreload', 4, true, 'Reload source code when changed'],
|
19
|
+
['basename', 1, true, 'Report file basename only showing file names'],
|
20
|
+
['callstyle', 2, false, 'Set how you want call parameters displayed'],
|
21
|
+
['byebugtesting', 8, false, 'Used when testing byebug'],
|
22
|
+
['forcestep', 2, true,
|
23
|
+
'Make sure "next/step" commands always move to a new line'],
|
24
|
+
['fullpath', 2, true, 'Display full file names in frames'],
|
25
|
+
['history', 2, false,
|
26
|
+
'Generic command for setting command history parameters',
|
27
|
+
'set history filename -- Set the filename in which to record the ' \
|
28
|
+
'command history. ' \
|
29
|
+
'set history save -- Set saving of the history record on exit. ' \
|
30
|
+
'set history size -- Set the size of the command history'],
|
31
|
+
['linetrace+', 10, true,
|
32
|
+
'Set line execution tracing to show different lines'],
|
33
|
+
['linetrace', 3, true, 'Set line execution tracing'],
|
34
|
+
['listsize', 3, false, 'Set number of source lines to list by default'],
|
35
|
+
['trace', 1, true, 'Display stack trace when "eval" raises exception'],
|
36
|
+
['width', 1, false,
|
37
|
+
'Number of characters per line for byebug\'s output']
|
36
38
|
].map do |name, min, is_bool, short_help, long_help|
|
37
39
|
SubcmdStruct2.new(name, min, is_bool, short_help, long_help)
|
38
40
|
end unless defined?(Subcommands)
|
@@ -44,129 +46,119 @@ module Byebug
|
|
44
46
|
end
|
45
47
|
|
46
48
|
def execute
|
47
|
-
|
48
|
-
|
49
|
+
# "Set" alone just prints subcommands
|
50
|
+
return print_subcmds(Subcommands) unless @match[1]
|
51
|
+
|
52
|
+
args = @match[1].split(/[ \t]+/)
|
53
|
+
try_subcmd = args.shift
|
54
|
+
try_subcmd.downcase!
|
55
|
+
if try_subcmd =~ /^no/i
|
56
|
+
set_on = false
|
57
|
+
try_subcmd = try_subcmd[2..-1]
|
49
58
|
else
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
59
|
+
set_on = true
|
60
|
+
end
|
61
|
+
|
62
|
+
subcmd = find(Subcommands, try_subcmd)
|
63
|
+
|
64
|
+
# Subcommand not found...
|
65
|
+
return print "Unknown set command \"#{try_subcmd}\"\n" unless subcmd
|
66
|
+
|
67
|
+
set_on = get_onoff(args[0]) if subcmd.is_bool and args.size > 0
|
68
|
+
|
69
|
+
case subcmd.name
|
70
|
+
when /^annotate$/
|
71
|
+
level = get_int(args[0], "Set annotate", 0, 3, 0)
|
72
|
+
if level
|
73
|
+
Byebug.annotate = level
|
56
74
|
else
|
57
|
-
|
75
|
+
return
|
76
|
+
end
|
77
|
+
if defined?(Byebug::RDEBUG_SCRIPT)
|
78
|
+
# byebug was called initially. 1st arg is script name.
|
79
|
+
Command.settings[:argv][1..-1] = args
|
80
|
+
else
|
81
|
+
# byebug wasn't called initially. 1st arg is not script name.
|
82
|
+
Command.settings[:argv] = args
|
83
|
+
end
|
84
|
+
when /^args$/
|
85
|
+
Command.settings[:argv][1..-1] = args
|
86
|
+
when /^autolist$/
|
87
|
+
Command.settings[:autolist] = (set_on ? 1 : 0)
|
88
|
+
when /^autoeval$/
|
89
|
+
Command.settings[:autoeval] = set_on
|
90
|
+
when /^basename$/
|
91
|
+
Command.settings[:basename] = set_on
|
92
|
+
when /^callstyle$/
|
93
|
+
if args[0]
|
94
|
+
arg = args[0].downcase.to_sym
|
95
|
+
case arg
|
96
|
+
when :short, :last, :tracked
|
97
|
+
Command.settings[:callstyle] = arg
|
98
|
+
else
|
99
|
+
print "Invalid call style #{arg}. Should be one of: " \
|
100
|
+
"'short', 'last' or 'tracked'.\n"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
when /^trace$/
|
104
|
+
Command.settings[:stack_trace_on_error] = set_on
|
105
|
+
when /^fullpath$/
|
106
|
+
Command.settings[:full_path] = set_on
|
107
|
+
when /^autoreload$/
|
108
|
+
Command.settings[:reload_source_on_change] = set_on
|
109
|
+
when /^autoirb$/
|
110
|
+
Command.settings[:autoirb] = (set_on ? 1 : 0)
|
111
|
+
when /^byebugtesting$/
|
112
|
+
Command.settings[:byebugtesting] = set_on
|
113
|
+
if set_on
|
114
|
+
Command.settings[:basename] = true
|
58
115
|
end
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
if defined?(Byebug::RDEBUG_SCRIPT)
|
77
|
-
# byebug was called initially. 1st arg is script name.
|
78
|
-
Command.settings[:argv][1..-1] = args
|
79
|
-
else
|
80
|
-
# byebug wasn't called initially. 1st arg is not script name.
|
81
|
-
Command.settings[:argv] = args
|
82
|
-
end
|
83
|
-
when /^args$/
|
84
|
-
Command.settings[:argv][1..-1] = args
|
85
|
-
when /^autolist$/
|
86
|
-
Command.settings[:autolist] = (set_on ? 1 : 0)
|
87
|
-
when /^autoeval$/
|
88
|
-
Command.settings[:autoeval] = set_on
|
89
|
-
when /^basename$/
|
90
|
-
Command.settings[:basename] = set_on
|
91
|
-
when /^callstyle$/
|
92
|
-
if args[0]
|
93
|
-
arg = args[0].downcase.to_sym
|
94
|
-
case arg
|
95
|
-
when :short, :last, :tracked
|
96
|
-
Command.settings[:callstyle] = arg
|
97
|
-
else
|
98
|
-
print "Invalid call style #{arg}. Should be one of: " \
|
99
|
-
"'short', 'last' or 'tracked'.\n"
|
100
|
-
end
|
101
|
-
end
|
102
|
-
when /^trace$/
|
103
|
-
Command.settings[:stack_trace_on_error] = set_on
|
104
|
-
when /^fullpath$/
|
105
|
-
Command.settings[:full_path] = set_on
|
106
|
-
when /^autoreload$/
|
107
|
-
Command.settings[:reload_source_on_change] = set_on
|
108
|
-
when /^autoirb$/
|
109
|
-
Command.settings[:autoirb] = (set_on ? 1 : 0)
|
110
|
-
when /^byebugtesting$/
|
111
|
-
Command.settings[:byebugtesting] = set_on
|
112
|
-
if set_on
|
113
|
-
Command.settings[:basename] = true
|
114
|
-
end
|
115
|
-
when /^forcestep$/
|
116
|
-
self.class.settings[:force_stepping] = set_on
|
117
|
-
when /^history$/
|
118
|
-
if 2 == args.size
|
119
|
-
interface = @state.interface
|
120
|
-
case args[0]
|
121
|
-
when /^save$/
|
122
|
-
interface.history_save = get_onoff(args[1])
|
123
|
-
when /^size$/
|
124
|
-
interface.history_length =
|
125
|
-
get_int(args[1], "Set history size")
|
126
|
-
when /^filename$/
|
127
|
-
interface.histfile =
|
128
|
-
File.join(ENV["HOME"]||ENV["HOMEPATH"]||".", args[1])
|
129
|
-
else
|
130
|
-
print "Invalid history parameter #{args[0]}. Should be " \
|
131
|
-
"'filename', 'save' or 'size'.\n"
|
132
|
-
end
|
133
|
-
else
|
134
|
-
print "Need two parameters for 'set history'; got " \
|
135
|
-
"#{args.size}.\n"
|
136
|
-
return
|
137
|
-
end
|
138
|
-
when /^linetrace\+$/
|
139
|
-
self.class.settings[:tracing_plus] = set_on
|
140
|
-
when /^linetrace$/
|
141
|
-
Command.settings[:tracing] = set_on
|
142
|
-
when /^listsize$/
|
143
|
-
listsize = get_int(args[0], "Set listsize", 1, nil, 10)
|
144
|
-
if listsize
|
145
|
-
self.class.settings[:listsize] = listsize
|
146
|
-
else
|
147
|
-
return
|
148
|
-
end
|
149
|
-
when /^width$/
|
150
|
-
width = get_int(args[0], "Set width", 10, nil, 80)
|
151
|
-
if width
|
152
|
-
self.class.settings[:width] = width
|
153
|
-
ENV['COLUMNS'] = width.to_s
|
154
|
-
else
|
155
|
-
return
|
156
|
-
end
|
157
|
-
else
|
158
|
-
print "Unknown setting #{@match[1]}.\n"
|
159
|
-
return
|
160
|
-
end
|
161
|
-
print "#{show_setting(try_subcmd.name)}\n"
|
162
|
-
return
|
163
|
-
rescue RuntimeError
|
164
|
-
return
|
165
|
-
end
|
116
|
+
when /^forcestep$/
|
117
|
+
self.class.settings[:force_stepping] = set_on
|
118
|
+
when /^history$/
|
119
|
+
if 2 == args.size
|
120
|
+
interface = @state.interface
|
121
|
+
case args[0]
|
122
|
+
when /^save$/
|
123
|
+
interface.history_save = get_onoff(args[1])
|
124
|
+
when /^size$/
|
125
|
+
interface.history_length =
|
126
|
+
get_int(args[1], "Set history size")
|
127
|
+
when /^filename$/
|
128
|
+
interface.histfile =
|
129
|
+
File.join(ENV["HOME"]||ENV["HOMEPATH"]||".", args[1])
|
130
|
+
else
|
131
|
+
print "Invalid history parameter #{args[0]}. Should be " \
|
132
|
+
"'filename', 'save' or 'size'.\n"
|
166
133
|
end
|
134
|
+
else
|
135
|
+
print "Need two parameters for 'set history'; got " \
|
136
|
+
"#{args.size}.\n"
|
137
|
+
return
|
138
|
+
end
|
139
|
+
when /^linetrace\+$/
|
140
|
+
self.class.settings[:tracing_plus] = set_on
|
141
|
+
when /^linetrace$/
|
142
|
+
Command.settings[:tracing] = set_on
|
143
|
+
when /^listsize$/
|
144
|
+
listsize = get_int(args[0], "Set listsize", 1, nil, 10)
|
145
|
+
if listsize
|
146
|
+
self.class.settings[:listsize] = listsize
|
147
|
+
else
|
148
|
+
return
|
149
|
+
end
|
150
|
+
when /^width$/
|
151
|
+
width = get_int(args[0], "Set width", 10, nil, 80)
|
152
|
+
if width
|
153
|
+
self.class.settings[:width] = width
|
154
|
+
ENV['COLUMNS'] = width.to_s
|
155
|
+
else
|
156
|
+
return
|
167
157
|
end
|
168
|
-
|
158
|
+
else
|
159
|
+
return print "Unknown setting #{@match[1]}.\n"
|
169
160
|
end
|
161
|
+
return print "#{show_setting(subcmd.name)}\n"
|
170
162
|
end
|
171
163
|
|
172
164
|
class << self
|
@@ -175,20 +167,17 @@ module Byebug
|
|
175
167
|
end
|
176
168
|
|
177
169
|
def help(args)
|
170
|
+
# specific subcommand help
|
178
171
|
if args[1]
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
str = subcmd.short_help + '.'
|
186
|
-
str += "\n" + subcmd.long_help if subcmd.long_help
|
187
|
-
return str
|
188
|
-
else
|
189
|
-
return "Invalid 'set' subcommand '#{args[1]}'."
|
190
|
-
end
|
172
|
+
subcmd = find(Subcommands, args[1])
|
173
|
+
return "Invalid \"set\" subcommand \"#{args[1]}\"." unless subcmd
|
174
|
+
|
175
|
+
str = subcmd.short_help + '.'
|
176
|
+
str += "\n" + subcmd.long_help if subcmd.long_help
|
177
|
+
return str
|
191
178
|
end
|
179
|
+
|
180
|
+
# general help
|
192
181
|
s = %{
|
193
182
|
Modifies parts of byebug environment. Boolean values take
|
194
183
|
on, off, 1 or 0.
|