byebug 10.0.1 → 11.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 +352 -285
- data/CONTRIBUTING.md +6 -34
- data/GUIDE.md +9 -8
- data/LICENSE +18 -18
- data/README.md +83 -72
- data/exe/byebug +1 -1
- data/ext/byebug/breakpoint.c +1 -1
- data/ext/byebug/byebug.c +9 -14
- data/ext/byebug/byebug.h +9 -7
- data/ext/byebug/context.c +19 -6
- data/ext/byebug/locker.c +4 -4
- data/ext/byebug/threads.c +3 -3
- 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 +10 -9
- data/lib/byebug/frame.rb +2 -2
- data/lib/byebug/helpers/frame.rb +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +2 -2
- data/lib/byebug/settings/autolist.rb +2 -2
- data/lib/byebug/settings/autopry.rb +2 -2
- 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 +1 -1
- data/lib/byebug/settings/listsize.rb +1 -1
- data/lib/byebug/settings/post_mortem.rb +1 -1
- 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
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../command"
|
4
|
+
require_relative "../helpers/parse"
|
5
|
+
|
6
|
+
module Byebug
|
7
|
+
#
|
8
|
+
# Allows the user to continue execution until the next breakpoint, as
|
9
|
+
# long as it is different from the current one
|
10
|
+
#
|
11
|
+
class SkipCommand < Command
|
12
|
+
include Helpers::ParseHelper
|
13
|
+
|
14
|
+
class << self
|
15
|
+
attr_writer :file_line, :file_path
|
16
|
+
attr_reader :previous_autolist
|
17
|
+
|
18
|
+
def file_line
|
19
|
+
@file_line ||= 0
|
20
|
+
end
|
21
|
+
|
22
|
+
def file_path
|
23
|
+
@file_path ||= ""
|
24
|
+
end
|
25
|
+
|
26
|
+
def setup_autolist(value)
|
27
|
+
@previous_autolist = ListCommand.always_run
|
28
|
+
ListCommand.always_run = value
|
29
|
+
end
|
30
|
+
|
31
|
+
def restore_autolist
|
32
|
+
ListCommand.always_run = @previous_autolist
|
33
|
+
@previous_autolist = nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.regexp
|
38
|
+
/^\s* sk(?:ip)? \s*$/x
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.description
|
42
|
+
<<-DESCRIPTION
|
43
|
+
sk[ip]
|
44
|
+
|
45
|
+
#{short_description}
|
46
|
+
DESCRIPTION
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.short_description
|
50
|
+
"Runs until the next breakpoint as long as it is different from the current one"
|
51
|
+
end
|
52
|
+
|
53
|
+
def initialize_attributes
|
54
|
+
self.class.always_run = 2
|
55
|
+
self.class.setup_autolist(0)
|
56
|
+
self.class.file_path = frame.file
|
57
|
+
self.class.file_line = frame.line
|
58
|
+
end
|
59
|
+
|
60
|
+
def keep_execution
|
61
|
+
[self.class.file_path, self.class.file_line] == [frame.file, frame.line]
|
62
|
+
end
|
63
|
+
|
64
|
+
def reset_attributes
|
65
|
+
self.class.always_run = 0
|
66
|
+
ListCommand.new(processor).execute if self.class.previous_autolist == 1
|
67
|
+
self.class.restore_autolist
|
68
|
+
end
|
69
|
+
|
70
|
+
def auto_run
|
71
|
+
return false unless self.class.always_run == 2
|
72
|
+
|
73
|
+
keep_execution ? processor.proceed! : reset_attributes
|
74
|
+
true
|
75
|
+
end
|
76
|
+
|
77
|
+
def execute
|
78
|
+
return if auto_run
|
79
|
+
|
80
|
+
initialize_attributes
|
81
|
+
processor.proceed!
|
82
|
+
Byebug.stop if Byebug.stoppable?
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "../command"
|
4
4
|
|
5
5
|
module Byebug
|
6
6
|
#
|
@@ -32,9 +32,7 @@ module Byebug
|
|
32
32
|
return puts(help) unless @match[1]
|
33
33
|
|
34
34
|
file = File.expand_path(@match[1]).strip
|
35
|
-
unless File.exist?(file)
|
36
|
-
return errmsg(pr("source.errors.not_found", file: file))
|
37
|
-
end
|
35
|
+
return errmsg(pr("source.errors.not_found", file: file)) unless File.exist?(file)
|
38
36
|
|
39
37
|
processor.interface.read_file(file)
|
40
38
|
end
|
data/lib/byebug/commands/step.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "../subcommands"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
require_relative "../commands/thread/current"
|
6
|
+
require_relative "../commands/thread/list"
|
7
|
+
require_relative "../commands/thread/resume"
|
8
|
+
require_relative "../commands/thread/stop"
|
9
|
+
require_relative "../commands/thread/switch"
|
10
10
|
|
11
11
|
module Byebug
|
12
12
|
#
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "../../helpers/thread"
|
4
4
|
|
5
5
|
module Byebug
|
6
6
|
#
|
@@ -35,9 +35,7 @@ module Byebug
|
|
35
35
|
context, err = context_from_thread(@match[1])
|
36
36
|
return errmsg(err) if err
|
37
37
|
|
38
|
-
unless context.suspended?
|
39
|
-
return errmsg(pr("thread.errors.already_running"))
|
40
|
-
end
|
38
|
+
return errmsg(pr("thread.errors.already_running")) unless context.suspended?
|
41
39
|
|
42
40
|
context.resume
|
43
41
|
display_context(context)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "../command"
|
4
4
|
|
5
5
|
module Byebug
|
6
6
|
#
|
@@ -32,10 +32,7 @@ module Byebug
|
|
32
32
|
def execute
|
33
33
|
var = @match[1]
|
34
34
|
return errmsg(pr("trace.errors.needs_global_variable")) unless var
|
35
|
-
|
36
|
-
unless global_variables.include?(:"#{var}")
|
37
|
-
return errmsg(pr("trace.errors.var_is_not_global", name: var))
|
38
|
-
end
|
35
|
+
return errmsg(pr("trace.errors.var_is_not_global", name: var)) unless global_variables.include?(:"#{var}")
|
39
36
|
|
40
37
|
stop = @match[2] && @match[2] !~ /nostop/
|
41
38
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require_relative "../command"
|
4
|
+
require_relative "../helpers/parse"
|
5
5
|
|
6
6
|
module Byebug
|
7
7
|
#
|
@@ -37,11 +37,10 @@ module Byebug
|
|
37
37
|
pos, err = get_int(@match[1], "Undisplay", 1, Byebug.displays.size)
|
38
38
|
return errmsg(err) unless err.nil?
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
end
|
40
|
+
last_display = Byebug.displays[pos - 1]
|
41
|
+
return errmsg(pr("display.errors.undefined", expr: pos)) unless last_display
|
43
42
|
|
44
|
-
|
43
|
+
last_display[0] = nil
|
45
44
|
else
|
46
45
|
return unless confirm(pr("display.confirmations.clear_all"))
|
47
46
|
|
data/lib/byebug/commands/up.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "pathname"
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
require_relative "../command"
|
5
|
+
require_relative "../helpers/frame"
|
6
|
+
require_relative "../helpers/parse"
|
7
7
|
|
8
8
|
module Byebug
|
9
9
|
#
|
data/lib/byebug/commands/var.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
require_relative "../subcommands"
|
4
|
+
|
5
|
+
require_relative "var/all"
|
6
|
+
require_relative "var/args"
|
7
|
+
require_relative "var/const"
|
8
|
+
require_relative "var/instance"
|
9
|
+
require_relative "var/local"
|
10
|
+
require_relative "var/global"
|
11
11
|
|
12
12
|
module Byebug
|
13
13
|
#
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "../../helpers/eval"
|
4
4
|
|
5
5
|
module Byebug
|
6
6
|
#
|
@@ -33,9 +33,7 @@ module Byebug
|
|
33
33
|
|
34
34
|
def execute
|
35
35
|
obj = warning_eval(str_obj)
|
36
|
-
unless obj.is_a?(Module)
|
37
|
-
return errmsg(pr("variable.errors.not_module", object: str_obj))
|
38
|
-
end
|
36
|
+
return errmsg(pr("variable.errors.not_module", object: str_obj)) unless obj.is_a?(Module)
|
39
37
|
|
40
38
|
constants = warning_eval("#{str_obj}.constants")
|
41
39
|
puts prv(constants.sort.map { |c| [c, obj.const_get(c)] }, "constant")
|
data/lib/byebug/context.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
require_relative "frame"
|
4
|
+
require_relative "helpers/path"
|
5
|
+
require_relative "helpers/file"
|
6
|
+
require_relative "processors/command_processor"
|
7
7
|
|
8
8
|
module Byebug
|
9
9
|
#
|
data/lib/byebug/core.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "helpers/reflection"
|
4
4
|
require "byebug/byebug"
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
require_relative "context"
|
6
|
+
require_relative "breakpoint"
|
7
|
+
require_relative "interface"
|
8
|
+
require_relative "processors/script_processor"
|
9
|
+
require_relative "processors/post_mortem_processor"
|
10
|
+
require_relative "commands"
|
11
|
+
require_relative "remote"
|
12
|
+
require_relative "printers/plain"
|
13
13
|
|
14
14
|
#
|
15
15
|
# Main debugger's container module. Everything is defined under this module
|
@@ -36,6 +36,7 @@ module Byebug
|
|
36
36
|
#
|
37
37
|
# * :attached => Attached to a running program through the `byebug` method.
|
38
38
|
# * :standalone => Started through `byebug` script.
|
39
|
+
# * :off => Ignoring any `byebug` method calls.
|
39
40
|
#
|
40
41
|
attr_accessor :mode
|
41
42
|
|
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/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
|
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")
|