byebug 9.1.0 → 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +24 -3
- data/CONTRIBUTING.md +39 -18
- data/GUIDE.md +16 -17
- data/README.md +64 -52
- data/exe/byebug +6 -0
- data/ext/byebug/breakpoint.c +1 -1
- data/ext/byebug/byebug.c +16 -16
- data/ext/byebug/byebug.h +40 -26
- data/ext/byebug/context.c +26 -26
- data/ext/byebug/extconf.rb +7 -5
- data/ext/byebug/threads.c +8 -8
- data/lib/byebug.rb +3 -1
- data/lib/byebug/attacher.rb +17 -3
- data/lib/byebug/breakpoint.rb +25 -3
- data/lib/byebug/command.rb +20 -14
- data/lib/byebug/command_list.rb +3 -1
- data/lib/byebug/commands.rb +39 -37
- data/lib/byebug/commands/break.rb +33 -15
- data/lib/byebug/commands/catch.rb +16 -14
- data/lib/byebug/commands/condition.rb +11 -9
- data/lib/byebug/commands/continue.rb +9 -7
- data/lib/byebug/commands/debug.rb +7 -5
- data/lib/byebug/commands/delete.rb +11 -9
- data/lib/byebug/commands/disable.rb +8 -6
- data/lib/byebug/commands/disable/breakpoints.rb +7 -5
- data/lib/byebug/commands/disable/display.rb +7 -5
- data/lib/byebug/commands/display.rb +11 -9
- data/lib/byebug/commands/down.rb +10 -8
- data/lib/byebug/commands/edit.rb +10 -8
- data/lib/byebug/commands/enable.rb +8 -6
- data/lib/byebug/commands/enable/breakpoints.rb +7 -5
- data/lib/byebug/commands/enable/display.rb +7 -5
- data/lib/byebug/commands/finish.rb +8 -6
- data/lib/byebug/commands/frame.rb +11 -9
- data/lib/byebug/commands/help.rb +7 -5
- data/lib/byebug/commands/history.rb +7 -5
- data/lib/byebug/commands/info.rb +11 -9
- data/lib/byebug/commands/info/breakpoints.rb +17 -11
- data/lib/byebug/commands/info/display.rb +16 -7
- data/lib/byebug/commands/info/file.rb +12 -10
- data/lib/byebug/commands/info/line.rb +5 -3
- data/lib/byebug/commands/info/program.rb +8 -6
- data/lib/byebug/commands/interrupt.rb +8 -4
- data/lib/byebug/commands/irb.rb +9 -7
- data/lib/byebug/commands/kill.rb +9 -7
- data/lib/byebug/commands/list.rb +41 -46
- data/lib/byebug/commands/method.rb +10 -8
- data/lib/byebug/commands/next.rb +8 -6
- data/lib/byebug/commands/pry.rb +10 -8
- data/lib/byebug/commands/quit.rb +7 -5
- data/lib/byebug/commands/restart.rb +13 -11
- data/lib/byebug/commands/save.rb +9 -7
- data/lib/byebug/commands/set.rb +12 -10
- data/lib/byebug/commands/show.rb +7 -5
- data/lib/byebug/commands/source.rb +7 -5
- data/lib/byebug/commands/step.rb +8 -6
- data/lib/byebug/commands/thread.rb +11 -9
- data/lib/byebug/commands/thread/current.rb +6 -4
- data/lib/byebug/commands/thread/list.rb +7 -5
- data/lib/byebug/commands/thread/resume.rb +7 -5
- data/lib/byebug/commands/thread/stop.rb +6 -4
- data/lib/byebug/commands/thread/switch.rb +6 -4
- data/lib/byebug/commands/tracevar.rb +10 -8
- data/lib/byebug/commands/undisplay.rb +10 -8
- data/lib/byebug/commands/untracevar.rb +8 -6
- data/lib/byebug/commands/up.rb +10 -8
- data/lib/byebug/commands/var.rb +12 -10
- data/lib/byebug/commands/var/all.rb +7 -5
- data/lib/byebug/commands/var/args.rb +6 -4
- data/lib/byebug/commands/var/const.rb +9 -7
- data/lib/byebug/commands/var/global.rb +5 -3
- data/lib/byebug/commands/var/instance.rb +6 -4
- data/lib/byebug/commands/var/local.rb +6 -4
- data/lib/byebug/commands/where.rb +9 -7
- data/lib/byebug/context.rb +7 -5
- data/lib/byebug/core.rb +25 -25
- data/lib/byebug/errors.rb +4 -2
- data/lib/byebug/frame.rb +16 -16
- data/lib/byebug/helpers/bin.rb +28 -7
- data/lib/byebug/helpers/eval.rb +8 -6
- data/lib/byebug/helpers/file.rb +4 -2
- data/lib/byebug/helpers/frame.rb +5 -3
- data/lib/byebug/helpers/parse.rb +5 -3
- data/lib/byebug/helpers/path.rb +7 -5
- data/lib/byebug/helpers/reflection.rb +2 -0
- data/lib/byebug/helpers/string.rb +4 -2
- data/lib/byebug/helpers/thread.rb +10 -8
- data/lib/byebug/helpers/toggle.rb +10 -8
- data/lib/byebug/helpers/var.rb +8 -6
- data/lib/byebug/history.rb +7 -5
- data/lib/byebug/interface.rb +13 -11
- data/lib/byebug/interfaces/local_interface.rb +4 -4
- data/lib/byebug/interfaces/remote_interface.rb +21 -9
- data/lib/byebug/interfaces/script_interface.rb +2 -0
- data/lib/byebug/interfaces/test_interface.rb +5 -3
- data/lib/byebug/option_setter.rb +14 -12
- data/lib/byebug/printers/base.rb +6 -6
- data/lib/byebug/printers/plain.rb +8 -6
- data/lib/byebug/printers/texts/base.yml +3 -3
- data/lib/byebug/processors/command_processor.rb +11 -12
- data/lib/byebug/processors/control_processor.rb +4 -6
- data/lib/byebug/processors/post_mortem_processor.rb +4 -2
- data/lib/byebug/processors/script_processor.rb +7 -3
- data/lib/byebug/remote.rb +45 -65
- data/lib/byebug/remote/client.rb +55 -0
- data/lib/byebug/remote/server.rb +47 -0
- data/lib/byebug/runner.rb +26 -19
- data/lib/byebug/setting.rb +10 -4
- data/lib/byebug/settings/autoirb.rb +5 -3
- data/lib/byebug/settings/autolist.rb +5 -3
- data/lib/byebug/settings/autopry.rb +5 -3
- data/lib/byebug/settings/autosave.rb +4 -2
- data/lib/byebug/settings/basename.rb +4 -2
- data/lib/byebug/settings/callstyle.rb +3 -3
- data/lib/byebug/settings/fullpath.rb +4 -2
- data/lib/byebug/settings/histfile.rb +5 -3
- data/lib/byebug/settings/histsize.rb +4 -2
- data/lib/byebug/settings/linetrace.rb +4 -2
- data/lib/byebug/settings/listsize.rb +4 -2
- data/lib/byebug/settings/post_mortem.rb +4 -2
- data/lib/byebug/settings/savefile.rb +4 -2
- data/lib/byebug/settings/stack_on_error.rb +4 -2
- data/lib/byebug/settings/width.rb +3 -1
- data/lib/byebug/source_file_formatter.rb +71 -0
- data/lib/byebug/subcommands.rb +6 -4
- data/lib/byebug/version.rb +1 -1
- metadata +8 -5
- data/bin/byebug +0 -9
data/lib/byebug/errors.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Byebug
|
2
4
|
#
|
3
5
|
# Custom exception exception to signal "command not found" errors
|
@@ -17,11 +19,11 @@ module Byebug
|
|
17
19
|
end
|
18
20
|
|
19
21
|
def help
|
20
|
-
build_cmd(
|
22
|
+
build_cmd("help", @parent)
|
21
23
|
end
|
22
24
|
|
23
25
|
def build_cmd(*args)
|
24
|
-
args.compact.join(
|
26
|
+
args.compact.join(" ")
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
data/lib/byebug/frame.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "byebug/helpers/file"
|
4
4
|
|
5
5
|
module Byebug
|
6
6
|
#
|
@@ -70,11 +70,11 @@ module Byebug
|
|
70
70
|
# +callstyle+ setting is 'short'
|
71
71
|
#
|
72
72
|
def deco_class
|
73
|
-
Setting[:callstyle] ==
|
73
|
+
Setting[:callstyle] == "short" || _class.to_s.empty? ? "" : "#{_class}."
|
74
74
|
end
|
75
75
|
|
76
76
|
def deco_block
|
77
|
-
_method[/(?:block(?: \(\d+ levels\))?|rescue) in /] ||
|
77
|
+
_method[/(?:block(?: \(\d+ levels\))?|rescue) in /] || ""
|
78
78
|
end
|
79
79
|
|
80
80
|
def deco_method
|
@@ -87,12 +87,12 @@ module Byebug
|
|
87
87
|
# setting
|
88
88
|
#
|
89
89
|
def deco_args
|
90
|
-
return
|
90
|
+
return "" if args.empty?
|
91
91
|
|
92
92
|
my_args = args.map do |arg|
|
93
93
|
prefix, default = prefix_and_default(arg[0])
|
94
94
|
|
95
|
-
kls = use_short_style?(arg) ?
|
95
|
+
kls = use_short_style?(arg) ? "" : "##{locals[arg[1]].class}"
|
96
96
|
|
97
97
|
"#{prefix}#{arg[1] || default}#{kls}"
|
98
98
|
end
|
@@ -118,7 +118,7 @@ module Byebug
|
|
118
118
|
# Properly formatted frame number of frame
|
119
119
|
#
|
120
120
|
def deco_pos
|
121
|
-
format(
|
121
|
+
format("%-2d", pos)
|
122
122
|
end
|
123
123
|
|
124
124
|
#
|
@@ -129,10 +129,10 @@ module Byebug
|
|
129
129
|
# marks regular frames
|
130
130
|
#
|
131
131
|
def mark
|
132
|
-
return
|
133
|
-
return
|
132
|
+
return "-->" if current?
|
133
|
+
return " ͱ--" if c_frame?
|
134
134
|
|
135
|
-
|
135
|
+
" "
|
136
136
|
end
|
137
137
|
|
138
138
|
#
|
@@ -156,13 +156,13 @@ module Byebug
|
|
156
156
|
private
|
157
157
|
|
158
158
|
def c_args
|
159
|
-
return [] unless _self.to_s !=
|
159
|
+
return [] unless _self.to_s != "main"
|
160
160
|
|
161
161
|
_class.instance_method(_method).parameters
|
162
162
|
end
|
163
163
|
|
164
164
|
def ruby_args
|
165
|
-
meth_name = _binding.eval(
|
165
|
+
meth_name = _binding.eval("__method__")
|
166
166
|
return [] unless meth_name
|
167
167
|
|
168
168
|
meth_obj = _class.instance_method(meth_name)
|
@@ -172,14 +172,14 @@ module Byebug
|
|
172
172
|
end
|
173
173
|
|
174
174
|
def use_short_style?(arg)
|
175
|
-
Setting[:callstyle] ==
|
175
|
+
Setting[:callstyle] == "short" || arg[1].nil? || locals.empty?
|
176
176
|
end
|
177
177
|
|
178
178
|
def prefix_and_default(arg_type)
|
179
|
-
return [
|
180
|
-
return [
|
179
|
+
return ["&", "block"] if arg_type == :block
|
180
|
+
return ["*", "args"] if arg_type == :rest
|
181
181
|
|
182
|
-
[
|
182
|
+
["", nil]
|
183
183
|
end
|
184
184
|
end
|
185
185
|
end
|
data/lib/byebug/helpers/bin.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Byebug
|
2
4
|
module Helpers
|
3
5
|
#
|
@@ -6,21 +8,40 @@ module Byebug
|
|
6
8
|
module BinHelper
|
7
9
|
#
|
8
10
|
# Cross-platform way of finding an executable in the $PATH.
|
9
|
-
#
|
11
|
+
# Adapted from: https://gist.github.com/steakknife/88b6c3837a5e90a08296
|
10
12
|
#
|
11
13
|
def which(cmd)
|
12
14
|
return File.expand_path(cmd) if File.exist?(cmd)
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
[nil, *search_paths].each do |path|
|
17
|
+
exe = find_executable(path, cmd)
|
18
|
+
return exe if exe
|
19
|
+
end
|
20
|
+
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def find_executable(path, cmd)
|
25
|
+
executable_file_extensions.each do |ext|
|
26
|
+
exe = File.expand_path(cmd + ext, path)
|
27
|
+
|
28
|
+
return exe if real_executable?(exe)
|
20
29
|
end
|
21
30
|
|
22
31
|
nil
|
23
32
|
end
|
33
|
+
|
34
|
+
def search_paths
|
35
|
+
ENV["PATH"].split(File::PATH_SEPARATOR)
|
36
|
+
end
|
37
|
+
|
38
|
+
def executable_file_extensions
|
39
|
+
ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [""]
|
40
|
+
end
|
41
|
+
|
42
|
+
def real_executable?(f)
|
43
|
+
File.executable?(f) && !File.directory?(f)
|
44
|
+
end
|
24
45
|
end
|
25
46
|
end
|
26
47
|
end
|
data/lib/byebug/helpers/eval.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Byebug
|
2
4
|
module Helpers
|
3
5
|
#
|
@@ -56,7 +58,7 @@ module Byebug
|
|
56
58
|
private
|
57
59
|
|
58
60
|
def safe_eval(str, binding)
|
59
|
-
binding.eval(str.gsub(/\Aeval /,
|
61
|
+
binding.eval(str.gsub(/\Aeval /, ""), "(byebug)", 1)
|
60
62
|
rescue StandardError, ScriptError => e
|
61
63
|
yield(e)
|
62
64
|
end
|
@@ -64,7 +66,7 @@ module Byebug
|
|
64
66
|
def msg(e)
|
65
67
|
msg = Setting[:stack_on_error] ? error_msg(e) : warning_msg(e)
|
66
68
|
|
67
|
-
pr(
|
69
|
+
pr("eval.exception", text_message: msg)
|
68
70
|
end
|
69
71
|
|
70
72
|
def error_msg(e)
|
@@ -98,7 +100,7 @@ module Byebug
|
|
98
100
|
|
99
101
|
#
|
100
102
|
# Runs the given block in a new thread, waits for it to finish and
|
101
|
-
# returns the new
|
103
|
+
# returns the new thread's result.
|
102
104
|
#
|
103
105
|
def in_new_thread
|
104
106
|
res = nil
|
@@ -110,14 +112,14 @@ module Byebug
|
|
110
112
|
|
111
113
|
def safe_inspect(var)
|
112
114
|
var.inspect
|
113
|
-
rescue
|
115
|
+
rescue StandardError
|
114
116
|
safe_to_s(var)
|
115
117
|
end
|
116
118
|
|
117
119
|
def safe_to_s(var)
|
118
120
|
var.to_s
|
119
|
-
rescue
|
120
|
-
|
121
|
+
rescue StandardError
|
122
|
+
"*Error in evaluation*"
|
121
123
|
end
|
122
124
|
end
|
123
125
|
end
|
data/lib/byebug/helpers/file.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Byebug
|
2
4
|
module Helpers
|
3
5
|
#
|
@@ -47,14 +49,14 @@ module Byebug
|
|
47
49
|
components = Pathname(fullpath).each_filename.to_a
|
48
50
|
return fullpath if components.size <= 2
|
49
51
|
|
50
|
-
File.join(
|
52
|
+
File.join("...", components[-3..-1])
|
51
53
|
end
|
52
54
|
|
53
55
|
#
|
54
56
|
# True for special files like -e, false otherwise
|
55
57
|
#
|
56
58
|
def virtual_file?(name)
|
57
|
-
[
|
59
|
+
["(irb)", "-e", "(byebug)", "(eval)"].include?(name)
|
58
60
|
end
|
59
61
|
end
|
60
62
|
end
|
data/lib/byebug/helpers/frame.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Byebug
|
2
4
|
module Helpers
|
3
5
|
#
|
@@ -6,7 +8,7 @@ module Byebug
|
|
6
8
|
module FrameHelper
|
7
9
|
def switch_to_frame(frame)
|
8
10
|
new_frame = index_from_start(frame)
|
9
|
-
return frame_err(
|
11
|
+
return frame_err("c_frame") if Frame.new(context, new_frame).c_frame?
|
10
12
|
|
11
13
|
adjust_frame(new_frame)
|
12
14
|
end
|
@@ -18,8 +20,8 @@ module Byebug
|
|
18
20
|
private
|
19
21
|
|
20
22
|
def adjust_frame(new_frame)
|
21
|
-
return frame_err(
|
22
|
-
return frame_err(
|
23
|
+
return frame_err("too_low") if new_frame >= context.stack_size
|
24
|
+
return frame_err("too_high") if new_frame < 0
|
23
25
|
|
24
26
|
context.frame = new_frame
|
25
27
|
processor.prev_line = nil
|
data/lib/byebug/helpers/parse.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Byebug
|
2
4
|
module Helpers
|
3
5
|
#
|
@@ -14,15 +16,15 @@ module Byebug
|
|
14
16
|
#
|
15
17
|
def get_int(str, cmd, min = nil, max = nil)
|
16
18
|
if str !~ /\A-?[0-9]+\z/
|
17
|
-
return nil, pr(
|
19
|
+
return nil, pr("parse.errors.int.not_number", cmd: cmd, str: str)
|
18
20
|
end
|
19
21
|
|
20
22
|
int = str.to_i
|
21
23
|
if min && int < min
|
22
|
-
err = pr(
|
24
|
+
err = pr("parse.errors.int.too_low", cmd: cmd, str: str, min: min)
|
23
25
|
return nil, err
|
24
26
|
elsif max && int > max
|
25
|
-
err = pr(
|
27
|
+
err = pr("parse.errors.int.too_high", cmd: cmd, str: str, max: max)
|
26
28
|
return nil, err
|
27
29
|
end
|
28
30
|
|
data/lib/byebug/helpers/path.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Byebug
|
2
4
|
module Helpers
|
3
5
|
#
|
@@ -5,19 +7,19 @@ module Byebug
|
|
5
7
|
#
|
6
8
|
module PathHelper
|
7
9
|
def bin_file
|
8
|
-
@bin_file ||= File.join(root_path,
|
10
|
+
@bin_file ||= File.join(root_path, "exe", "byebug")
|
9
11
|
end
|
10
12
|
|
11
13
|
def root_path
|
12
|
-
@root_path ||= File.expand_path(File.join(
|
14
|
+
@root_path ||= File.expand_path(File.join("..", "..", ".."), __dir__)
|
13
15
|
end
|
14
16
|
|
15
17
|
def lib_files
|
16
|
-
@lib_files ||= glob_for(
|
18
|
+
@lib_files ||= glob_for("lib")
|
17
19
|
end
|
18
20
|
|
19
21
|
def test_files
|
20
|
-
@test_files ||= glob_for(
|
22
|
+
@test_files ||= glob_for("test")
|
21
23
|
end
|
22
24
|
|
23
25
|
def gem_files
|
@@ -31,7 +33,7 @@ module Byebug
|
|
31
33
|
private
|
32
34
|
|
33
35
|
def glob_for(dir)
|
34
|
-
Dir.glob(File.join(root_path, dir,
|
36
|
+
Dir.glob(File.join(root_path, dir, "**", "*.rb"))
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Byebug
|
2
4
|
module Helpers
|
3
5
|
#
|
@@ -9,7 +11,7 @@ module Byebug
|
|
9
11
|
# ACamelizedString.
|
10
12
|
#
|
11
13
|
def camelize(str)
|
12
|
-
str.dup.split(/[_-]/).map(&:capitalize).join(
|
14
|
+
str.dup.split(/[_-]/).map(&:capitalize).join("")
|
13
15
|
end
|
14
16
|
|
15
17
|
#
|
@@ -27,7 +29,7 @@ module Byebug
|
|
27
29
|
# use squiggly heredoc's.
|
28
30
|
#
|
29
31
|
def deindent(str, leading_spaces: 6)
|
30
|
-
str.gsub(/^ {#{leading_spaces}}/,
|
32
|
+
str.gsub(/^ {#{leading_spaces}}/, "")
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Byebug
|
2
4
|
module Helpers
|
3
5
|
#
|
@@ -5,7 +7,7 @@ module Byebug
|
|
5
7
|
#
|
6
8
|
module ThreadHelper
|
7
9
|
def display_context(ctx)
|
8
|
-
puts pr(
|
10
|
+
puts pr("thread.context", thread_arguments(ctx))
|
9
11
|
end
|
10
12
|
|
11
13
|
def thread_arguments(ctx)
|
@@ -29,11 +31,11 @@ module Byebug
|
|
29
31
|
ctx = Byebug.contexts.find { |c| c.thnum.to_s == thnum }
|
30
32
|
|
31
33
|
err = if ctx.nil?
|
32
|
-
pr(
|
34
|
+
pr("thread.errors.no_thread")
|
33
35
|
elsif ctx == context
|
34
|
-
pr(
|
36
|
+
pr("thread.errors.current_thread")
|
35
37
|
elsif ctx.ignored?
|
36
|
-
pr(
|
38
|
+
pr("thread.errors.ignored", arg: thnum)
|
37
39
|
end
|
38
40
|
|
39
41
|
[ctx, err]
|
@@ -46,19 +48,19 @@ module Byebug
|
|
46
48
|
return context.location if ctx == Byebug.current_context
|
47
49
|
|
48
50
|
backtrace = ctx.thread.backtrace_locations
|
49
|
-
return
|
51
|
+
return "" unless backtrace && backtrace[0]
|
50
52
|
|
51
53
|
"#{backtrace[0].path}:#{backtrace[0].lineno}"
|
52
54
|
end
|
53
55
|
|
54
56
|
def status_flag(ctx)
|
55
|
-
return
|
57
|
+
return "$" if ctx.suspended?
|
56
58
|
|
57
|
-
current_thread?(ctx) ?
|
59
|
+
current_thread?(ctx) ? "+" : " "
|
58
60
|
end
|
59
61
|
|
60
62
|
def debug_flag(ctx)
|
61
|
-
ctx.ignored? ?
|
63
|
+
ctx.ignored? ? "!" : " "
|
62
64
|
end
|
63
65
|
end
|
64
66
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/helpers/parse"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
module Helpers
|
@@ -9,22 +11,22 @@ module Byebug
|
|
9
11
|
include ParseHelper
|
10
12
|
|
11
13
|
def enable_disable_breakpoints(is_enable, args)
|
12
|
-
raise pr(
|
14
|
+
raise pr("toggle.errors.no_breakpoints") if Breakpoint.none?
|
13
15
|
|
14
16
|
select_breakpoints(is_enable, args).each do |b|
|
15
|
-
enabled = (is_enable ==
|
17
|
+
enabled = (is_enable == "enable")
|
16
18
|
if enabled && !syntax_valid?(b.expr)
|
17
|
-
raise pr(
|
19
|
+
raise pr("toggle.errors.expression", expr: b.expr)
|
18
20
|
end
|
19
21
|
|
20
|
-
puts pr(
|
21
|
-
endis: enabled ?
|
22
|
+
puts pr("toggle.messages.toggled", bpnum: b.id,
|
23
|
+
endis: enabled ? "en" : "dis")
|
22
24
|
b.enabled = enabled
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
26
28
|
def enable_disable_display(is_enable, args)
|
27
|
-
raise pr(
|
29
|
+
raise pr("toggle.errors.no_display") if n_displays.zero?
|
28
30
|
|
29
31
|
selected_displays = args ? args.split(/ +/) : [1..n_displays + 1]
|
30
32
|
|
@@ -32,7 +34,7 @@ module Byebug
|
|
32
34
|
pos, err = get_int(pos, "#{is_enable} display", 1, n_displays)
|
33
35
|
raise err unless err.nil?
|
34
36
|
|
35
|
-
Byebug.displays[pos - 1][0] = (is_enable ==
|
37
|
+
Byebug.displays[pos - 1][0] = (is_enable == "enable")
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|