byebug 9.1.0 → 10.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.
- 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/helpers/var.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/helpers/eval"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
module Helpers
|
@@ -13,7 +15,7 @@ module Byebug
|
|
13
15
|
[name, safe_inspect(silent_eval(name.to_s, binding))]
|
14
16
|
end
|
15
17
|
|
16
|
-
puts prv(vars,
|
18
|
+
puts prv(vars, "instance")
|
17
19
|
end
|
18
20
|
|
19
21
|
def var_global
|
@@ -25,7 +27,7 @@ module Byebug
|
|
25
27
|
end
|
26
28
|
|
27
29
|
def var_instance(str)
|
28
|
-
obj = warning_eval(str ||
|
30
|
+
obj = warning_eval(str || "self")
|
29
31
|
|
30
32
|
var_list(obj.instance_variables, obj.instance_eval { binding })
|
31
33
|
end
|
@@ -33,8 +35,8 @@ module Byebug
|
|
33
35
|
def var_local
|
34
36
|
locals = context.frame.locals
|
35
37
|
cur_self = context.frame._self
|
36
|
-
locals[:self] = cur_self unless cur_self.to_s ==
|
37
|
-
puts prv(locals.keys.sort.map { |k| [k, locals[k]] },
|
38
|
+
locals[:self] = cur_self unless cur_self.to_s == "main"
|
39
|
+
puts prv(locals.keys.sort.map { |k| [k, locals[k]] }, "instance")
|
38
40
|
end
|
39
41
|
|
40
42
|
def var_args
|
@@ -45,7 +47,7 @@ module Byebug
|
|
45
47
|
arg_values = args.map { |arg| arg[1] }
|
46
48
|
|
47
49
|
locals = all_locals.select { |k, _| arg_values.include?(k) }
|
48
|
-
puts prv(locals.keys.sort.map { |k| [k, locals[k]] },
|
50
|
+
puts prv(locals.keys.sort.map { |k| [k, locals[k]] }, "instance")
|
49
51
|
end
|
50
52
|
end
|
51
53
|
end
|
data/lib/byebug/history.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
begin
|
2
|
-
require
|
4
|
+
require "readline"
|
3
5
|
rescue LoadError
|
4
|
-
warn <<-
|
6
|
+
warn <<-MESSAGE
|
5
7
|
Sorry, you can't use byebug without Readline. To solve this, you need to
|
6
8
|
rebuild Ruby with Readline support. If using Ubuntu, try `sudo apt-get
|
7
9
|
install libreadline-dev` and then reinstall your Ruby.
|
8
|
-
|
10
|
+
MESSAGE
|
9
11
|
|
10
12
|
raise
|
11
13
|
end
|
@@ -43,7 +45,7 @@ module Byebug
|
|
43
45
|
def save
|
44
46
|
n_cmds = Setting[:histsize] > size ? size : Setting[:histsize]
|
45
47
|
|
46
|
-
open(Setting[:histfile],
|
48
|
+
open(Setting[:histfile], "w") do |file|
|
47
49
|
n_cmds.times { file.puts(pop) }
|
48
50
|
end
|
49
51
|
|
@@ -84,7 +86,7 @@ module Byebug
|
|
84
86
|
commands = buffer.last(show_size)
|
85
87
|
|
86
88
|
last_ids(show_size).zip(commands).map do |l|
|
87
|
-
format(
|
89
|
+
format("%<position>5d %<command>s", position: l[0], command: l[1])
|
88
90
|
end.join("\n") + "\n"
|
89
91
|
end
|
90
92
|
|
data/lib/byebug/interface.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/setting"
|
4
|
+
require "byebug/history"
|
5
|
+
require "byebug/helpers/file"
|
4
6
|
|
5
7
|
#
|
6
8
|
# Namespace for all of byebug's code
|
@@ -20,7 +22,7 @@ module Byebug
|
|
20
22
|
def initialize
|
21
23
|
@command_queue = []
|
22
24
|
@history = History.new
|
23
|
-
@last_line =
|
25
|
+
@last_line = ""
|
24
26
|
end
|
25
27
|
|
26
28
|
def last_if_empty(input)
|
@@ -97,7 +99,7 @@ module Byebug
|
|
97
99
|
# Confirms user introduced an affirmative response to the input stream.
|
98
100
|
#
|
99
101
|
def confirm(prompt)
|
100
|
-
readline(prompt) ==
|
102
|
+
readline(prompt) == "y"
|
101
103
|
end
|
102
104
|
|
103
105
|
def close
|
@@ -124,7 +126,7 @@ module Byebug
|
|
124
126
|
# array of commands: [cmd1, cmd2, ..., cmdN]
|
125
127
|
#
|
126
128
|
def split_commands(cmd_line)
|
127
|
-
return [
|
129
|
+
return [""] if cmd_line.empty?
|
128
130
|
|
129
131
|
cmd_line.split(/;/).each_with_object([]) do |v, m|
|
130
132
|
if m.empty? || m.last[-1] != '\\'
|
@@ -132,13 +134,13 @@ module Byebug
|
|
132
134
|
next
|
133
135
|
end
|
134
136
|
|
135
|
-
m.last[-1, 1] =
|
136
|
-
m.last <<
|
137
|
+
m.last[-1, 1] = ""
|
138
|
+
m.last << ";" << v
|
137
139
|
end
|
138
140
|
end
|
139
141
|
end
|
140
142
|
end
|
141
143
|
|
142
|
-
require
|
143
|
-
require
|
144
|
-
require
|
144
|
+
require "byebug/interfaces/local_interface"
|
145
|
+
require "byebug/interfaces/script_interface"
|
146
|
+
require "byebug/interfaces/remote_interface"
|
@@ -5,7 +5,7 @@ module Byebug
|
|
5
5
|
# Interface class for standard byebug use.
|
6
6
|
#
|
7
7
|
class LocalInterface < Interface
|
8
|
-
EOF_ALIAS =
|
8
|
+
EOF_ALIAS = "continue".freeze
|
9
9
|
|
10
10
|
def initialize
|
11
11
|
super()
|
@@ -32,13 +32,13 @@ module Byebug
|
|
32
32
|
# @note Any external 'INT' traps are overriden during this method.
|
33
33
|
#
|
34
34
|
def with_repl_like_sigint
|
35
|
-
orig_handler = trap(
|
35
|
+
orig_handler = trap("INT") { raise Interrupt }
|
36
36
|
yield
|
37
37
|
rescue Interrupt
|
38
|
-
puts(
|
38
|
+
puts("^C")
|
39
39
|
retry
|
40
40
|
ensure
|
41
|
-
trap(
|
41
|
+
trap("INT", orig_handler)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/history"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -14,25 +16,35 @@ module Byebug
|
|
14
16
|
|
15
17
|
def read_command(prompt)
|
16
18
|
super("PROMPT #{prompt}")
|
19
|
+
rescue Errno::EPIPE, Errno::ECONNABORTED
|
20
|
+
"continue"
|
17
21
|
end
|
18
22
|
|
19
23
|
def confirm(prompt)
|
20
24
|
super("CONFIRM #{prompt}")
|
25
|
+
rescue Errno::EPIPE, Errno::ECONNABORTED
|
26
|
+
false
|
27
|
+
end
|
28
|
+
|
29
|
+
def print(message)
|
30
|
+
super(message)
|
31
|
+
rescue Errno::EPIPE, Errno::ECONNABORTED
|
32
|
+
nil
|
33
|
+
end
|
34
|
+
|
35
|
+
def puts(message)
|
36
|
+
super(message)
|
37
|
+
rescue Errno::EPIPE, Errno::ECONNABORTED
|
38
|
+
nil
|
21
39
|
end
|
22
40
|
|
23
41
|
def close
|
24
42
|
output.close
|
25
|
-
rescue IOError
|
26
|
-
errmsg('Error closing the interface...')
|
27
43
|
end
|
28
44
|
|
29
45
|
def readline(prompt)
|
30
|
-
|
31
|
-
|
32
|
-
result = input.gets
|
33
|
-
raise IOError unless result
|
34
|
-
|
35
|
-
result.chomp
|
46
|
+
puts(prompt)
|
47
|
+
(input.gets || "continue").chomp
|
36
48
|
end
|
37
49
|
end
|
38
50
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Byebug
|
2
4
|
#
|
3
5
|
# Custom interface for easier assertions
|
@@ -41,9 +43,9 @@ module Byebug
|
|
41
43
|
|
42
44
|
def inspect
|
43
45
|
[
|
44
|
-
|
45
|
-
|
46
|
-
|
46
|
+
"Input:", input.join("\n"),
|
47
|
+
"Output:", output.join("\n"),
|
48
|
+
"Error:", error.join("\n")
|
47
49
|
].join("\n")
|
48
50
|
end
|
49
51
|
|
data/lib/byebug/option_setter.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Byebug
|
2
4
|
#
|
3
5
|
# Handles byebug's command line options
|
@@ -25,67 +27,67 @@ module Byebug
|
|
25
27
|
private
|
26
28
|
|
27
29
|
def debug
|
28
|
-
@opts.on
|
30
|
+
@opts.on "-d", "--debug", "Set $DEBUG=true" do
|
29
31
|
$DEBUG = true
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
33
35
|
def include_flag
|
34
|
-
@opts.on
|
35
|
-
$LOAD_PATH.push(list.split(
|
36
|
+
@opts.on "-I", "--include list", "Add to paths to $LOAD_PATH" do |list|
|
37
|
+
$LOAD_PATH.push(list.split(":")).flatten!
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|
39
41
|
def post_mortem
|
40
|
-
@opts.on
|
42
|
+
@opts.on "-m", "--[no-]post-mortem", "Use post-mortem mode" do |v|
|
41
43
|
Setting[:post_mortem] = v
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
45
47
|
def quit
|
46
|
-
@opts.on
|
48
|
+
@opts.on "-q", "--[no-]quit", "Quit when script finishes" do |v|
|
47
49
|
@runner.quit = v
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
51
53
|
def rc
|
52
|
-
@opts.on
|
54
|
+
@opts.on "-x", "--[no-]rc", "Run byebug initialization file" do |v|
|
53
55
|
@runner.init_script = v
|
54
56
|
end
|
55
57
|
end
|
56
58
|
|
57
59
|
def stop
|
58
|
-
@opts.on
|
60
|
+
@opts.on "-s", "--[no-]stop", "Stop when script is loaded" do |v|
|
59
61
|
@runner.stop = v
|
60
62
|
end
|
61
63
|
end
|
62
64
|
|
63
65
|
def require_flag
|
64
|
-
@opts.on
|
66
|
+
@opts.on "-r", "--require file", "Require library before script" do |lib|
|
65
67
|
require lib
|
66
68
|
end
|
67
69
|
end
|
68
70
|
|
69
71
|
def remote
|
70
|
-
@opts.on
|
72
|
+
@opts.on "-R", "--remote [host:]port", "Remote debug [host:]port" do |p|
|
71
73
|
@runner.remote = p
|
72
74
|
end
|
73
75
|
end
|
74
76
|
|
75
77
|
def trace
|
76
|
-
@opts.on
|
78
|
+
@opts.on "-t", "--[no-]trace", "Turn on line tracing" do |v|
|
77
79
|
Setting[:linetrace] = v
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
81
83
|
def version
|
82
|
-
@opts.on
|
84
|
+
@opts.on "-v", "--version", "Print program version" do
|
83
85
|
@runner.version = Byebug::VERSION
|
84
86
|
end
|
85
87
|
end
|
86
88
|
|
87
89
|
def help
|
88
|
-
@opts.on
|
90
|
+
@opts.on "-h", "--help", "Display this message" do
|
89
91
|
@runner.help = @opts.help
|
90
92
|
end
|
91
93
|
end
|
data/lib/byebug/printers/base.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "yaml"
|
4
4
|
|
5
5
|
module Byebug
|
6
6
|
module Printers
|
@@ -11,17 +11,17 @@ module Byebug
|
|
11
11
|
class MissedPath < StandardError; end
|
12
12
|
class MissedArgument < StandardError; end
|
13
13
|
|
14
|
-
SEPARATOR =
|
14
|
+
SEPARATOR = ".".freeze
|
15
15
|
|
16
16
|
def type
|
17
|
-
self.class.name.split(
|
17
|
+
self.class.name.split("::").last.downcase
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def locate(path)
|
23
23
|
result = nil
|
24
|
-
contents.
|
24
|
+
contents.each_value do |contents|
|
25
25
|
result = parts(path).reduce(contents) do |r, part|
|
26
26
|
r && r.key?(part) ? r[part] : nil
|
27
27
|
end
|
@@ -33,7 +33,7 @@ module Byebug
|
|
33
33
|
|
34
34
|
def translate(string, args = {})
|
35
35
|
# they may contain #{} string interpolation
|
36
|
-
string.gsub(/\|\w+$/,
|
36
|
+
string.gsub(/\|\w+$/, "").gsub(/([^#]?){([^}]*)}/) do
|
37
37
|
key = Regexp.last_match[2].to_s
|
38
38
|
unless args.key?(key.to_sym)
|
39
39
|
raise MissedArgument, "Missed argument #{key} for '#{string}'"
|
@@ -62,7 +62,7 @@ module Byebug
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def contents_files
|
65
|
-
[File.join(__dir__,
|
65
|
+
[File.join(__dir__, "texts", "base.yml")]
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/printers/base"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
module Printers
|
@@ -8,7 +10,7 @@ module Byebug
|
|
8
10
|
class Plain < Base
|
9
11
|
def print(path, args = {})
|
10
12
|
message = translate(locate(path), args)
|
11
|
-
tail = parts(path).include?(
|
13
|
+
tail = parts(path).include?("confirmations") ? " (y/n) " : "\n"
|
12
14
|
message << tail
|
13
15
|
end
|
14
16
|
|
@@ -21,11 +23,11 @@ module Byebug
|
|
21
23
|
end
|
22
24
|
|
23
25
|
def print_variables(variables, *_)
|
24
|
-
print_collection(
|
25
|
-
value = value.nil? ?
|
26
|
+
print_collection("variable.variable", variables) do |(key, value), _|
|
27
|
+
value = value.nil? ? "nil" : value.to_s
|
26
28
|
if "#{key} = #{value}".size > Setting[:width]
|
27
29
|
key_size = "#{key} = ".size
|
28
|
-
value = value[0..Setting[:width] - key_size - 4] +
|
30
|
+
value = value[0..Setting[:width] - key_size - 4] + "..."
|
29
31
|
end
|
30
32
|
|
31
33
|
{ key: key, value: value }
|
@@ -35,7 +37,7 @@ module Byebug
|
|
35
37
|
private
|
36
38
|
|
37
39
|
def contents_files
|
38
|
-
[File.join(__dir__,
|
40
|
+
[File.join(__dir__, "texts", "plain.yml")] + super
|
39
41
|
end
|
40
42
|
end
|
41
43
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
base:
|
2
2
|
errors:
|
3
|
-
only_local:
|
3
|
+
only_local: "Command is available only in local mode."
|
4
4
|
|
5
5
|
break:
|
6
6
|
errors:
|
7
|
-
line: "Line {line} is not a valid breakpoint in file {file}"
|
7
|
+
line: "Line {line} is not a valid breakpoint in file {file}.\n\nValid break points are:\n{valid_breakpoints}"
|
8
8
|
location: "Invalid breakpoint location"
|
9
9
|
state: "We are not in a state that has an associated file"
|
10
10
|
class: "Unknown class {klass}"
|
@@ -62,7 +62,7 @@ info:
|
|
62
62
|
|
63
63
|
pry:
|
64
64
|
errors:
|
65
|
-
not_installed:
|
65
|
+
not_installed: "You need to install pry in order to run this command"
|
66
66
|
|
67
67
|
quit:
|
68
68
|
confirmations:
|
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
|
3
|
+
require "forwardable"
|
4
|
+
|
5
|
+
require "byebug/helpers/eval"
|
6
|
+
require "byebug/errors"
|
5
7
|
|
6
8
|
module Byebug
|
7
9
|
#
|
@@ -16,19 +18,16 @@ module Byebug
|
|
16
18
|
include Helpers::EvalHelper
|
17
19
|
|
18
20
|
attr_accessor :prev_line
|
19
|
-
attr_reader :context
|
21
|
+
attr_reader :context, :interface
|
20
22
|
|
21
|
-
def initialize(context)
|
23
|
+
def initialize(context, interface = LocalInterface.new)
|
22
24
|
@context = context
|
25
|
+
@interface = interface
|
23
26
|
|
24
27
|
@proceed = false
|
25
28
|
@prev_line = nil
|
26
29
|
end
|
27
30
|
|
28
|
-
def interface
|
29
|
-
@interface ||= Context.interface
|
30
|
-
end
|
31
|
-
|
32
31
|
def printer
|
33
32
|
@printer ||= Printers::Plain.new
|
34
33
|
end
|
@@ -106,7 +105,7 @@ module Byebug
|
|
106
105
|
# Prompt shown before reading a command.
|
107
106
|
#
|
108
107
|
def prompt
|
109
|
-
|
108
|
+
"(byebug) "
|
110
109
|
end
|
111
110
|
|
112
111
|
def before_repl
|
@@ -129,7 +128,7 @@ module Byebug
|
|
129
128
|
cmd = interface.read_command(prompt)
|
130
129
|
return if cmd.nil?
|
131
130
|
|
132
|
-
next if cmd ==
|
131
|
+
next if cmd == ""
|
133
132
|
|
134
133
|
run_cmd(cmd)
|
135
134
|
end
|
@@ -167,7 +166,7 @@ module Byebug
|
|
167
166
|
|
168
167
|
def safely
|
169
168
|
yield
|
170
|
-
rescue => e
|
169
|
+
rescue StandardError => e
|
171
170
|
errmsg(e.message)
|
172
171
|
end
|
173
172
|
end
|