byebug 10.0.2 → 11.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +365 -287
  3. data/CONTRIBUTING.md +6 -34
  4. data/GUIDE.md +9 -8
  5. data/LICENSE +18 -18
  6. data/README.md +83 -79
  7. data/ext/byebug/byebug.c +4 -9
  8. data/ext/byebug/byebug.h +4 -2
  9. data/ext/byebug/context.c +15 -2
  10. data/lib/byebug.rb +1 -1
  11. data/lib/byebug/attacher.rb +4 -4
  12. data/lib/byebug/command.rb +2 -2
  13. data/lib/byebug/command_list.rb +1 -1
  14. data/lib/byebug/commands.rb +38 -37
  15. data/lib/byebug/commands/break.rb +10 -14
  16. data/lib/byebug/commands/catch.rb +4 -8
  17. data/lib/byebug/commands/condition.rb +3 -5
  18. data/lib/byebug/commands/continue.rb +27 -9
  19. data/lib/byebug/commands/debug.rb +2 -2
  20. data/lib/byebug/commands/delete.rb +3 -5
  21. data/lib/byebug/commands/disable.rb +4 -4
  22. data/lib/byebug/commands/disable/breakpoints.rb +1 -1
  23. data/lib/byebug/commands/disable/display.rb +1 -1
  24. data/lib/byebug/commands/display.rb +2 -2
  25. data/lib/byebug/commands/down.rb +3 -3
  26. data/lib/byebug/commands/edit.rb +2 -1
  27. data/lib/byebug/commands/enable.rb +3 -3
  28. data/lib/byebug/commands/enable/breakpoints.rb +1 -1
  29. data/lib/byebug/commands/enable/display.rb +1 -1
  30. data/lib/byebug/commands/finish.rb +2 -2
  31. data/lib/byebug/commands/frame.rb +3 -3
  32. data/lib/byebug/commands/help.rb +2 -2
  33. data/lib/byebug/commands/history.rb +2 -2
  34. data/lib/byebug/commands/info.rb +6 -6
  35. data/lib/byebug/commands/info/breakpoints.rb +2 -4
  36. data/lib/byebug/commands/info/display.rb +1 -3
  37. data/lib/byebug/commands/info/file.rb +2 -4
  38. data/lib/byebug/commands/interrupt.rb +1 -1
  39. data/lib/byebug/commands/irb.rb +2 -4
  40. data/lib/byebug/commands/kill.rb +3 -5
  41. data/lib/byebug/commands/list.rb +4 -4
  42. data/lib/byebug/commands/method.rb +2 -2
  43. data/lib/byebug/commands/next.rb +2 -2
  44. data/lib/byebug/commands/pry.rb +3 -5
  45. data/lib/byebug/commands/quit.rb +4 -4
  46. data/lib/byebug/commands/restart.rb +3 -3
  47. data/lib/byebug/commands/save.rb +1 -1
  48. data/lib/byebug/commands/set.rb +3 -3
  49. data/lib/byebug/commands/show.rb +1 -1
  50. data/lib/byebug/commands/skip.rb +85 -0
  51. data/lib/byebug/commands/source.rb +2 -4
  52. data/lib/byebug/commands/step.rb +2 -2
  53. data/lib/byebug/commands/thread.rb +6 -6
  54. data/lib/byebug/commands/thread/current.rb +1 -1
  55. data/lib/byebug/commands/thread/list.rb +1 -1
  56. data/lib/byebug/commands/thread/resume.rb +2 -4
  57. data/lib/byebug/commands/thread/stop.rb +1 -1
  58. data/lib/byebug/commands/thread/switch.rb +1 -1
  59. data/lib/byebug/commands/tracevar.rb +2 -5
  60. data/lib/byebug/commands/undisplay.rb +5 -6
  61. data/lib/byebug/commands/untracevar.rb +1 -1
  62. data/lib/byebug/commands/up.rb +3 -3
  63. data/lib/byebug/commands/var.rb +8 -8
  64. data/lib/byebug/commands/var/all.rb +1 -1
  65. data/lib/byebug/commands/var/args.rb +1 -1
  66. data/lib/byebug/commands/var/const.rb +2 -4
  67. data/lib/byebug/commands/var/instance.rb +1 -1
  68. data/lib/byebug/commands/var/local.rb +1 -1
  69. data/lib/byebug/commands/where.rb +2 -2
  70. data/lib/byebug/context.rb +4 -4
  71. data/lib/byebug/core.rb +10 -9
  72. data/lib/byebug/frame.rb +2 -2
  73. data/lib/byebug/helpers/frame.rb +1 -1
  74. data/lib/byebug/helpers/parse.rb +1 -3
  75. data/lib/byebug/helpers/string.rb +0 -3
  76. data/lib/byebug/helpers/toggle.rb +2 -4
  77. data/lib/byebug/helpers/var.rb +1 -1
  78. data/lib/byebug/history.rb +1 -1
  79. data/lib/byebug/interface.rb +6 -6
  80. data/lib/byebug/interfaces/local_interface.rb +21 -2
  81. data/lib/byebug/interfaces/remote_interface.rb +1 -1
  82. data/lib/byebug/interfaces/script_interface.rb +2 -1
  83. data/lib/byebug/printers/base.rb +4 -5
  84. data/lib/byebug/printers/plain.rb +1 -1
  85. data/lib/byebug/processors/command_processor.rb +2 -2
  86. data/lib/byebug/processors/control_processor.rb +1 -1
  87. data/lib/byebug/processors/post_mortem_processor.rb +1 -1
  88. data/lib/byebug/processors/script_processor.rb +1 -1
  89. data/lib/byebug/remote.rb +3 -3
  90. data/lib/byebug/remote/client.rb +2 -0
  91. data/lib/byebug/runner.rb +7 -7
  92. data/lib/byebug/setting.rb +2 -2
  93. data/lib/byebug/settings/autoirb.rb +2 -2
  94. data/lib/byebug/settings/autolist.rb +2 -2
  95. data/lib/byebug/settings/autopry.rb +2 -2
  96. data/lib/byebug/settings/autosave.rb +1 -1
  97. data/lib/byebug/settings/basename.rb +1 -1
  98. data/lib/byebug/settings/callstyle.rb +2 -2
  99. data/lib/byebug/settings/fullpath.rb +1 -1
  100. data/lib/byebug/settings/histfile.rb +1 -1
  101. data/lib/byebug/settings/histsize.rb +1 -1
  102. data/lib/byebug/settings/linetrace.rb +1 -1
  103. data/lib/byebug/settings/listsize.rb +1 -1
  104. data/lib/byebug/settings/post_mortem.rb +1 -1
  105. data/lib/byebug/settings/savefile.rb +1 -1
  106. data/lib/byebug/settings/stack_on_error.rb +1 -1
  107. data/lib/byebug/settings/width.rb +1 -1
  108. data/lib/byebug/source_file_formatter.rb +2 -2
  109. data/lib/byebug/subcommands.rb +2 -2
  110. data/lib/byebug/version.rb +1 -1
  111. metadata +9 -9
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/helpers/toggle"
3
+ require_relative "../../helpers/toggle"
4
4
 
5
5
  module Byebug
6
6
  #
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/helpers/toggle"
3
+ require_relative "../../helpers/toggle"
4
4
 
5
5
  module Byebug
6
6
  #
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
4
- require "byebug/helpers/parse"
3
+ require_relative "../command"
4
+ require_relative "../helpers/parse"
5
5
 
6
6
  module Byebug
7
7
  #
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "pathname"
4
- require "byebug/command"
5
- require "byebug/helpers/frame"
6
- require "byebug/helpers/parse"
4
+ require_relative "../command"
5
+ require_relative "../helpers/frame"
6
+ require_relative "../helpers/parse"
7
7
 
8
8
  module Byebug
9
9
  #
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
4
- require "byebug/errors"
3
+ require_relative "../command"
4
+ require_relative "../errors"
5
5
 
6
6
  module Byebug
7
7
  #
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
4
- require "byebug/helpers/parse"
3
+ require_relative "../command"
4
+ require_relative "../helpers/parse"
5
5
 
6
6
  module Byebug
7
7
  #
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/subcommands"
3
+ require_relative "../subcommands"
4
4
 
5
- require "byebug/commands/info/breakpoints"
6
- require "byebug/commands/info/display"
7
- require "byebug/commands/info/file"
8
- require "byebug/commands/info/line"
9
- require "byebug/commands/info/program"
5
+ require_relative "../commands/info/breakpoints"
6
+ require_relative "../commands/info/display"
7
+ require_relative "../commands/info/file"
8
+ require_relative "../commands/info/line"
9
+ require_relative "../commands/info/program"
10
10
 
11
11
  module Byebug
12
12
  #
@@ -35,9 +35,7 @@ module Byebug
35
35
  if @match[1]
36
36
  indices = @match[1].split(/ +/).map(&:to_i)
37
37
  breakpoints = breakpoints.select { |b| indices.member?(b.id) }
38
- if breakpoints.empty?
39
- return errmsg("No breakpoints found among list given")
40
- end
38
+ return errmsg("No breakpoints found among list given") if breakpoints.empty?
41
39
  end
42
40
 
43
41
  puts "Num Enb What"
@@ -57,7 +55,7 @@ module Byebug
57
55
  )
58
56
  puts interp
59
57
  hits = brkpt.hit_count
60
- return unless hits > 0
58
+ return unless hits.positive?
61
59
 
62
60
  s = hits > 1 ? "s" : ""
63
61
  puts " breakpoint already hit #{hits} time#{s}"
@@ -28,9 +28,7 @@ module Byebug
28
28
  end
29
29
 
30
30
  def execute
31
- unless Byebug.displays.find { |d| d[0] }
32
- return puts("There are no auto-display expressions now.")
33
- end
31
+ return puts("There are no auto-display expressions now.") unless Byebug.displays.find { |d| d[0] }
34
32
 
35
33
  puts "Auto-display expressions now in effect:"
36
34
  puts "Num Enb Expression"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/helpers/file"
3
+ require_relative "../../helpers/file"
4
4
 
5
5
  module Byebug
6
6
  #
@@ -37,9 +37,7 @@ module Byebug
37
37
 
38
38
  def execute
39
39
  file = @match[1] || frame.file
40
- unless File.exist?(file)
41
- return errmsg(pr("info.errors.undefined_file", file: file))
42
- end
40
+ return errmsg(pr("info.errors.undefined_file", file: file)) unless File.exist?(file)
43
41
 
44
42
  puts prettify <<-RUBY
45
43
  File #{info_file_basic(file)}
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
3
+ require_relative "../command"
4
4
 
5
5
  module Byebug
6
6
  #
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
3
+ require_relative "../command"
4
4
  require "irb"
5
5
  require "English"
6
6
 
@@ -28,9 +28,7 @@ module Byebug
28
28
  end
29
29
 
30
30
  def execute
31
- unless processor.interface.instance_of?(LocalInterface)
32
- return errmsg(pr("base.errors.only_local"))
33
- end
31
+ return errmsg(pr("base.errors.only_local")) unless processor.interface.instance_of?(LocalInterface)
34
32
 
35
33
  # @todo IRB tries to parse $ARGV so we must clear it (see #197). Add a
36
34
  # test case for it so we can remove this comment.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
3
+ require_relative "../command"
4
4
 
5
5
  module Byebug
6
6
  #
@@ -10,7 +10,7 @@ module Byebug
10
10
  self.allow_in_control = true
11
11
 
12
12
  def self.regexp
13
- /^\s* (?:kill) \s* (?:\s+(\S+))? \s*$/x
13
+ /^\s* kill \s* (?:\s+(\S+))? \s*$/x
14
14
  end
15
15
 
16
16
  def self.description
@@ -31,9 +31,7 @@ module Byebug
31
31
  if @match[1]
32
32
  signame = @match[1]
33
33
 
34
- unless Signal.list.member?(signame)
35
- return errmsg("signal name #{signame} is not a signal I know about\n")
36
- end
34
+ return errmsg("signal name #{signame} is not a signal I know about\n") unless Signal.list.member?(signame)
37
35
  else
38
36
  return unless confirm("Really kill? (y/n) ")
39
37
 
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
4
- require "byebug/source_file_formatter"
5
- require "byebug/helpers/file"
6
- require "byebug/helpers/parse"
3
+ require_relative "../command"
4
+ require_relative "../source_file_formatter"
5
+ require_relative "../helpers/file"
6
+ require_relative "../helpers/parse"
7
7
 
8
8
  module Byebug
9
9
  #
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
4
- require "byebug/helpers/eval"
3
+ require_relative "../command"
4
+ require_relative "../helpers/eval"
5
5
 
6
6
  module Byebug
7
7
  #
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
4
- require "byebug/helpers/parse"
3
+ require_relative "../command"
4
+ require_relative "../helpers/parse"
5
5
 
6
6
  module Byebug
7
7
  #
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
4
- require "byebug/helpers/eval"
3
+ require_relative "../command"
4
+ require_relative "../helpers/eval"
5
5
 
6
6
  module Byebug
7
7
  #
@@ -27,9 +27,7 @@ module Byebug
27
27
  end
28
28
 
29
29
  def execute
30
- unless processor.interface.instance_of?(LocalInterface)
31
- return errmsg(pr("base.errors.only_local"))
32
- end
30
+ return errmsg(pr("base.errors.only_local")) unless processor.interface.instance_of?(LocalInterface)
33
31
 
34
32
  begin
35
33
  require "pry"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
3
+ require_relative "../command"
4
4
 
5
5
  module Byebug
6
6
  #
@@ -16,12 +16,12 @@ module Byebug
16
16
 
17
17
  def self.description
18
18
  <<-DESCRIPTION
19
- q[uit] [!|unconditionally]
19
+ q[uit][!| unconditionally]
20
20
 
21
21
  #{short_description}
22
22
 
23
- Normally we prompt before exiting. However if the parameter
24
- "unconditionally" is given or command is suffixed with !, we exit
23
+ Normally we prompt before exiting. However, if the parameter
24
+ "unconditionally" is given or command is suffixed with "!", we exit
25
25
  without asking further questions.
26
26
  DESCRIPTION
27
27
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
4
- require "byebug/helpers/bin"
5
- require "byebug/helpers/path"
3
+ require_relative "../command"
4
+ require_relative "../helpers/bin"
5
+ require_relative "../helpers/path"
6
6
  require "shellwords"
7
7
  require "English"
8
8
  require "rbconfig"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
3
+ require_relative "../command"
4
4
 
5
5
  module Byebug
6
6
  #
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
4
- require "byebug/helpers/parse"
3
+ require_relative "../command"
4
+ require_relative "../helpers/parse"
5
5
 
6
6
  module Byebug
7
7
  #
@@ -50,7 +50,7 @@ module Byebug
50
50
  if !setting.boolean? && value.nil?
51
51
  err = pr("set.errors.must_specify_value", key: key)
52
52
  elsif setting.boolean?
53
- value, err = get_onoff(value, key =~ /^no/ ? false : true)
53
+ value, err = get_onoff(value, /^no/.match?(key) ? false : true)
54
54
  elsif setting.integer?
55
55
  value, err = get_int(value, setting.to_sym, 1)
56
56
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
3
+ require_relative "../command"
4
4
 
5
5
  module Byebug
6
6
  #
@@ -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
- require "byebug/command"
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
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug/command"
4
- require "byebug/helpers/parse"
3
+ require_relative "../command"
4
+ require_relative "../helpers/parse"
5
5
 
6
6
  module Byebug
7
7
  #