byebug 10.0.0 → 11.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +350 -284
- data/CONTRIBUTING.md +6 -34
- data/GUIDE.md +9 -8
- data/LICENSE +18 -18
- data/README.md +83 -70
- data/exe/byebug +1 -1
- data/ext/byebug/breakpoint.c +1 -1
- data/ext/byebug/byebug.c +10 -15
- data/ext/byebug/byebug.h +11 -9
- data/ext/byebug/context.c +21 -8
- data/ext/byebug/locker.c +4 -4
- data/ext/byebug/threads.c +4 -4
- data/lib/byebug.rb +1 -1
- data/lib/byebug/attacher.rb +4 -4
- data/lib/byebug/command.rb +2 -2
- data/lib/byebug/command_list.rb +1 -1
- data/lib/byebug/commands.rb +38 -37
- data/lib/byebug/commands/break.rb +10 -14
- data/lib/byebug/commands/catch.rb +4 -8
- data/lib/byebug/commands/condition.rb +3 -5
- data/lib/byebug/commands/continue.rb +27 -9
- data/lib/byebug/commands/debug.rb +2 -2
- data/lib/byebug/commands/delete.rb +3 -5
- data/lib/byebug/commands/disable.rb +4 -4
- data/lib/byebug/commands/disable/breakpoints.rb +1 -1
- data/lib/byebug/commands/disable/display.rb +1 -1
- data/lib/byebug/commands/display.rb +2 -2
- data/lib/byebug/commands/down.rb +3 -3
- data/lib/byebug/commands/edit.rb +2 -1
- data/lib/byebug/commands/enable.rb +3 -3
- data/lib/byebug/commands/enable/breakpoints.rb +1 -1
- data/lib/byebug/commands/enable/display.rb +1 -1
- data/lib/byebug/commands/finish.rb +2 -2
- data/lib/byebug/commands/frame.rb +3 -3
- data/lib/byebug/commands/help.rb +2 -2
- data/lib/byebug/commands/history.rb +2 -2
- data/lib/byebug/commands/info.rb +6 -6
- data/lib/byebug/commands/info/breakpoints.rb +2 -4
- data/lib/byebug/commands/info/display.rb +1 -3
- data/lib/byebug/commands/info/file.rb +2 -4
- data/lib/byebug/commands/interrupt.rb +1 -1
- data/lib/byebug/commands/irb.rb +2 -4
- data/lib/byebug/commands/kill.rb +3 -5
- data/lib/byebug/commands/list.rb +4 -4
- data/lib/byebug/commands/method.rb +2 -2
- data/lib/byebug/commands/next.rb +2 -2
- data/lib/byebug/commands/pry.rb +3 -5
- data/lib/byebug/commands/quit.rb +4 -4
- data/lib/byebug/commands/restart.rb +3 -3
- data/lib/byebug/commands/save.rb +1 -1
- data/lib/byebug/commands/set.rb +3 -3
- data/lib/byebug/commands/show.rb +1 -1
- data/lib/byebug/commands/skip.rb +85 -0
- data/lib/byebug/commands/source.rb +2 -4
- data/lib/byebug/commands/step.rb +2 -2
- data/lib/byebug/commands/thread.rb +6 -6
- data/lib/byebug/commands/thread/current.rb +1 -1
- data/lib/byebug/commands/thread/list.rb +1 -1
- data/lib/byebug/commands/thread/resume.rb +2 -4
- data/lib/byebug/commands/thread/stop.rb +1 -1
- data/lib/byebug/commands/thread/switch.rb +1 -1
- data/lib/byebug/commands/tracevar.rb +2 -5
- data/lib/byebug/commands/undisplay.rb +5 -6
- data/lib/byebug/commands/untracevar.rb +1 -1
- data/lib/byebug/commands/up.rb +3 -3
- data/lib/byebug/commands/var.rb +8 -8
- data/lib/byebug/commands/var/all.rb +1 -1
- data/lib/byebug/commands/var/args.rb +1 -1
- data/lib/byebug/commands/var/const.rb +2 -4
- data/lib/byebug/commands/var/instance.rb +1 -1
- data/lib/byebug/commands/var/local.rb +1 -1
- data/lib/byebug/commands/where.rb +2 -2
- data/lib/byebug/context.rb +4 -4
- data/lib/byebug/core.rb +11 -10
- data/lib/byebug/frame.rb +2 -2
- data/lib/byebug/helpers/bin.rb +2 -2
- data/lib/byebug/helpers/eval.rb +7 -7
- data/lib/byebug/helpers/frame.rb +3 -3
- data/lib/byebug/helpers/parse.rb +1 -3
- data/lib/byebug/helpers/string.rb +0 -3
- data/lib/byebug/helpers/toggle.rb +2 -4
- data/lib/byebug/helpers/var.rb +1 -1
- data/lib/byebug/history.rb +5 -5
- data/lib/byebug/interface.rb +6 -6
- data/lib/byebug/interfaces/local_interface.rb +1 -1
- data/lib/byebug/interfaces/remote_interface.rb +1 -1
- data/lib/byebug/interfaces/script_interface.rb +2 -1
- data/lib/byebug/printers/base.rb +4 -5
- data/lib/byebug/printers/plain.rb +2 -2
- data/lib/byebug/processors/command_processor.rb +2 -2
- data/lib/byebug/processors/control_processor.rb +1 -1
- data/lib/byebug/processors/post_mortem_processor.rb +1 -1
- data/lib/byebug/processors/script_processor.rb +1 -1
- data/lib/byebug/remote.rb +3 -3
- data/lib/byebug/remote/client.rb +2 -0
- data/lib/byebug/runner.rb +7 -7
- data/lib/byebug/setting.rb +2 -2
- data/lib/byebug/settings/autoirb.rb +4 -4
- data/lib/byebug/settings/autolist.rb +4 -4
- data/lib/byebug/settings/autopry.rb +4 -4
- data/lib/byebug/settings/autosave.rb +1 -1
- data/lib/byebug/settings/basename.rb +1 -1
- data/lib/byebug/settings/callstyle.rb +2 -2
- data/lib/byebug/settings/fullpath.rb +1 -1
- data/lib/byebug/settings/histfile.rb +1 -1
- data/lib/byebug/settings/histsize.rb +1 -1
- data/lib/byebug/settings/linetrace.rb +3 -3
- data/lib/byebug/settings/listsize.rb +1 -1
- data/lib/byebug/settings/post_mortem.rb +3 -3
- data/lib/byebug/settings/savefile.rb +1 -1
- data/lib/byebug/settings/stack_on_error.rb +1 -1
- data/lib/byebug/settings/width.rb +1 -1
- data/lib/byebug/source_file_formatter.rb +2 -2
- data/lib/byebug/subcommands.rb +2 -2
- data/lib/byebug/version.rb +1 -1
- metadata +9 -9
data/lib/byebug/frame.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "helpers/file"
|
4
4
|
|
5
5
|
module Byebug
|
6
6
|
#
|
@@ -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("%-2<pos>d", pos: pos)
|
122
122
|
end
|
123
123
|
|
124
124
|
#
|
data/lib/byebug/helpers/bin.rb
CHANGED
data/lib/byebug/helpers/eval.rb
CHANGED
@@ -63,22 +63,22 @@ module Byebug
|
|
63
63
|
yield(e)
|
64
64
|
end
|
65
65
|
|
66
|
-
def msg(
|
67
|
-
msg = Setting[:stack_on_error] ? error_msg(
|
66
|
+
def msg(exception)
|
67
|
+
msg = Setting[:stack_on_error] ? error_msg(exception) : warning_msg(exception)
|
68
68
|
|
69
69
|
pr("eval.exception", text_message: msg)
|
70
70
|
end
|
71
71
|
|
72
|
-
def error_msg(
|
73
|
-
at =
|
72
|
+
def error_msg(exception)
|
73
|
+
at = exception.backtrace
|
74
74
|
|
75
|
-
locations = ["#{at.shift}: #{warning_msg(
|
75
|
+
locations = ["#{at.shift}: #{warning_msg(exception)}"]
|
76
76
|
locations += at.map { |path| " from #{path}" }
|
77
77
|
locations.join("\n")
|
78
78
|
end
|
79
79
|
|
80
|
-
def warning_msg(
|
81
|
-
"#{
|
80
|
+
def warning_msg(exception)
|
81
|
+
"#{exception.class} Exception: #{exception.message}"
|
82
82
|
end
|
83
83
|
|
84
84
|
#
|
data/lib/byebug/helpers/frame.rb
CHANGED
@@ -21,7 +21,7 @@ module Byebug
|
|
21
21
|
|
22
22
|
def adjust_frame(new_frame)
|
23
23
|
return frame_err("too_low") if new_frame >= context.stack_size
|
24
|
-
return frame_err("too_high") if new_frame
|
24
|
+
return frame_err("too_high") if new_frame.negative?
|
25
25
|
|
26
26
|
context.frame = new_frame
|
27
27
|
processor.prev_line = nil
|
@@ -67,8 +67,8 @@ module Byebug
|
|
67
67
|
#
|
68
68
|
# @param i [Integer] Integer to be converted in a proper positive index.
|
69
69
|
#
|
70
|
-
def index_from_start(
|
71
|
-
|
70
|
+
def index_from_start(index)
|
71
|
+
index >= 0 ? index : context.stack_size + index
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
data/lib/byebug/helpers/parse.rb
CHANGED
@@ -15,9 +15,7 @@ module Byebug
|
|
15
15
|
# purpose.
|
16
16
|
#
|
17
17
|
def get_int(str, cmd, min = nil, max = nil)
|
18
|
-
|
19
|
-
return nil, pr("parse.errors.int.not_number", cmd: cmd, str: str)
|
20
|
-
end
|
18
|
+
return nil, pr("parse.errors.int.not_number", cmd: cmd, str: str) unless /\A-?[0-9]+\z/.match?(str)
|
21
19
|
|
22
20
|
int = str.to_i
|
23
21
|
if min && int < min
|
@@ -25,9 +25,6 @@ module Byebug
|
|
25
25
|
#
|
26
26
|
# Removes a number of leading whitespace for each input line.
|
27
27
|
#
|
28
|
-
# @note Might be unnecessary when Ruby 2.2 support is dropped and we can
|
29
|
-
# use squiggly heredoc's.
|
30
|
-
#
|
31
28
|
def deindent(str, leading_spaces: 6)
|
32
29
|
str.gsub(/^ {#{leading_spaces}}/, "")
|
33
30
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "parse"
|
4
4
|
|
5
5
|
module Byebug
|
6
6
|
module Helpers
|
@@ -15,9 +15,7 @@ module Byebug
|
|
15
15
|
|
16
16
|
select_breakpoints(is_enable, args).each do |b|
|
17
17
|
enabled = (is_enable == "enable")
|
18
|
-
if enabled && !syntax_valid?(b.expr)
|
19
|
-
raise pr("toggle.errors.expression", expr: b.expr)
|
20
|
-
end
|
18
|
+
raise pr("toggle.errors.expression", expr: b.expr) if enabled && !syntax_valid?(b.expr)
|
21
19
|
|
22
20
|
puts pr("toggle.messages.toggled", bpnum: b.id,
|
23
21
|
endis: enabled ? "en" : "dis")
|
data/lib/byebug/helpers/var.rb
CHANGED
data/lib/byebug/history.rb
CHANGED
@@ -45,7 +45,7 @@ module Byebug
|
|
45
45
|
def save
|
46
46
|
n_cmds = Setting[:histsize] > size ? size : Setting[:histsize]
|
47
47
|
|
48
|
-
open(Setting[:histfile], "w") do |file|
|
48
|
+
File.open(Setting[:histfile], "w") do |file|
|
49
49
|
n_cmds.times { file.puts(pop) }
|
50
50
|
end
|
51
51
|
|
@@ -91,10 +91,10 @@ module Byebug
|
|
91
91
|
end
|
92
92
|
|
93
93
|
#
|
94
|
-
# Array of ids of the last
|
94
|
+
# Array of ids of the last +number+ commands.
|
95
95
|
#
|
96
|
-
def last_ids(
|
97
|
-
(1 + size -
|
96
|
+
def last_ids(number)
|
97
|
+
(1 + size - number..size).to_a
|
98
98
|
end
|
99
99
|
|
100
100
|
#
|
@@ -121,7 +121,7 @@ module Byebug
|
|
121
121
|
# For now, empty lines and consecutive duplicates.
|
122
122
|
#
|
123
123
|
def ignore?(buf)
|
124
|
-
return true if /^\s
|
124
|
+
return true if /^\s*$/.match?(buf)
|
125
125
|
return false if Readline::HISTORY.empty?
|
126
126
|
|
127
127
|
buffer[Readline::HISTORY.length - 1] == buf
|
data/lib/byebug/interface.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
require_relative "setting"
|
4
|
+
require_relative "history"
|
5
|
+
require_relative "helpers/file"
|
6
6
|
|
7
7
|
#
|
8
8
|
# Namespace for all of byebug's code
|
@@ -141,6 +141,6 @@ module Byebug
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
|
-
|
145
|
-
|
146
|
-
|
144
|
+
require_relative "interfaces/local_interface"
|
145
|
+
require_relative "interfaces/script_interface"
|
146
|
+
require_relative "interfaces/remote_interface"
|
data/lib/byebug/printers/base.rb
CHANGED
@@ -11,7 +11,7 @@ module Byebug
|
|
11
11
|
class MissedPath < StandardError; end
|
12
12
|
class MissedArgument < StandardError; end
|
13
13
|
|
14
|
-
SEPARATOR = "."
|
14
|
+
SEPARATOR = "."
|
15
15
|
|
16
16
|
def type
|
17
17
|
self.class.name.split("::").last.downcase
|
@@ -23,11 +23,12 @@ module Byebug
|
|
23
23
|
result = nil
|
24
24
|
contents.each_value do |contents|
|
25
25
|
result = parts(path).reduce(contents) do |r, part|
|
26
|
-
r
|
26
|
+
r&.key?(part) ? r[part] : nil
|
27
27
|
end
|
28
28
|
break if result
|
29
29
|
end
|
30
30
|
raise MissedPath, "Can't find part path '#{path}'" unless result
|
31
|
+
|
31
32
|
result
|
32
33
|
end
|
33
34
|
|
@@ -35,9 +36,7 @@ module Byebug
|
|
35
36
|
# they may contain #{} string interpolation
|
36
37
|
string.gsub(/\|\w+$/, "").gsub(/([^#]?){([^}]*)}/) do
|
37
38
|
key = Regexp.last_match[2].to_s
|
38
|
-
unless args.key?(key.to_sym)
|
39
|
-
raise MissedArgument, "Missed argument #{key} for '#{string}'"
|
40
|
-
end
|
39
|
+
raise MissedArgument, "Missed argument #{key} for '#{string}'" unless args.key?(key.to_sym)
|
41
40
|
|
42
41
|
"#{Regexp.last_match[1]}#{args[key.to_sym]}"
|
43
42
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "base"
|
4
4
|
|
5
5
|
module Byebug
|
6
6
|
module Printers
|
@@ -22,7 +22,7 @@ module Byebug
|
|
22
22
|
lines.join
|
23
23
|
end
|
24
24
|
|
25
|
-
def print_variables(variables, *
|
25
|
+
def print_variables(variables, *_unused)
|
26
26
|
print_collection("variable.variable", variables) do |(key, value), _|
|
27
27
|
value = value.nil? ? "nil" : value.to_s
|
28
28
|
if "#{key} = #{value}".size > Setting[:width]
|
data/lib/byebug/remote.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "socket"
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
require_relative "processors/control_processor"
|
5
|
+
require_relative "remote/server"
|
6
|
+
require_relative "remote/client"
|
7
7
|
|
8
8
|
#
|
9
9
|
# Remote debugging functionality.
|
data/lib/byebug/remote/client.rb
CHANGED
@@ -26,10 +26,12 @@ module Byebug
|
|
26
26
|
when /^PROMPT (.*)$/
|
27
27
|
input = interface.read_command(Regexp.last_match[1])
|
28
28
|
break unless input
|
29
|
+
|
29
30
|
socket.puts input
|
30
31
|
when /^CONFIRM (.*)$/
|
31
32
|
input = interface.readline(Regexp.last_match[1])
|
32
33
|
break unless input
|
34
|
+
|
33
35
|
socket.puts input
|
34
36
|
else
|
35
37
|
interface.puts line
|
data/lib/byebug/runner.rb
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
require "optparse"
|
4
4
|
require "English"
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
require_relative "core"
|
6
|
+
require_relative "version"
|
7
|
+
require_relative "helpers/bin"
|
8
|
+
require_relative "helpers/parse"
|
9
|
+
require_relative "helpers/string"
|
10
|
+
require_relative "option_setter"
|
11
|
+
require_relative "processors/control_processor"
|
12
12
|
|
13
13
|
module Byebug
|
14
14
|
#
|
data/lib/byebug/setting.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "helpers/string"
|
4
4
|
|
5
5
|
module Byebug
|
6
6
|
#
|
@@ -52,7 +52,7 @@ module Byebug
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def find(shortcut)
|
55
|
-
abbr =
|
55
|
+
abbr = /^no/.match?(shortcut) ? shortcut[2..-1] : shortcut
|
56
56
|
matches = settings.select do |key, value|
|
57
57
|
key =~ (value.boolean? ? /#{abbr}/ : /#{shortcut}/)
|
58
58
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require_relative "../setting"
|
4
|
+
require_relative "../commands/irb"
|
5
5
|
|
6
6
|
module Byebug
|
7
7
|
#
|
@@ -18,8 +18,8 @@ module Byebug
|
|
18
18
|
"Invoke IRB on every stop"
|
19
19
|
end
|
20
20
|
|
21
|
-
def value=(
|
22
|
-
IrbCommand.always_run =
|
21
|
+
def value=(val)
|
22
|
+
IrbCommand.always_run = val ? 1 : 0
|
23
23
|
end
|
24
24
|
|
25
25
|
def value
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require_relative "../setting"
|
4
|
+
require_relative "../commands/list"
|
5
5
|
|
6
6
|
module Byebug
|
7
7
|
#
|
@@ -18,8 +18,8 @@ module Byebug
|
|
18
18
|
"Invoke list command on every stop"
|
19
19
|
end
|
20
20
|
|
21
|
-
def value=(
|
22
|
-
ListCommand.always_run =
|
21
|
+
def value=(val)
|
22
|
+
ListCommand.always_run = val ? 1 : 0
|
23
23
|
end
|
24
24
|
|
25
25
|
def value
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require_relative "../setting"
|
4
|
+
require_relative "../commands/pry"
|
5
5
|
|
6
6
|
module Byebug
|
7
7
|
#
|
@@ -18,8 +18,8 @@ module Byebug
|
|
18
18
|
"Invoke Pry on every stop"
|
19
19
|
end
|
20
20
|
|
21
|
-
def value=(
|
22
|
-
PryCommand.always_run =
|
21
|
+
def value=(val)
|
22
|
+
PryCommand.always_run = val ? 1 : 0
|
23
23
|
end
|
24
24
|
|
25
25
|
def value
|