byebug 9.0.5 → 11.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +399 -264
  3. data/CONTRIBUTING.md +12 -19
  4. data/GUIDE.md +40 -26
  5. data/LICENSE +18 -18
  6. data/README.md +103 -74
  7. data/exe/byebug +6 -0
  8. data/ext/byebug/breakpoint.c +2 -2
  9. data/ext/byebug/byebug.c +26 -31
  10. data/ext/byebug/byebug.h +44 -28
  11. data/ext/byebug/context.c +45 -32
  12. data/ext/byebug/extconf.rb +7 -5
  13. data/ext/byebug/locker.c +4 -4
  14. data/ext/byebug/threads.c +12 -12
  15. data/lib/byebug/attacher.rb +18 -4
  16. data/lib/byebug/breakpoint.rb +26 -6
  17. data/lib/byebug/command.rb +20 -14
  18. data/lib/byebug/command_list.rb +3 -1
  19. data/lib/byebug/commands/break.rb +36 -22
  20. data/lib/byebug/commands/catch.rb +16 -18
  21. data/lib/byebug/commands/condition.rb +11 -11
  22. data/lib/byebug/commands/continue.rb +32 -12
  23. data/lib/byebug/commands/debug.rb +7 -5
  24. data/lib/byebug/commands/delete.rb +13 -11
  25. data/lib/byebug/commands/disable/breakpoints.rb +7 -5
  26. data/lib/byebug/commands/disable/display.rb +7 -5
  27. data/lib/byebug/commands/disable.rb +8 -6
  28. data/lib/byebug/commands/display.rb +11 -9
  29. data/lib/byebug/commands/down.rb +10 -8
  30. data/lib/byebug/commands/edit.rb +11 -8
  31. data/lib/byebug/commands/enable/breakpoints.rb +7 -5
  32. data/lib/byebug/commands/enable/display.rb +7 -5
  33. data/lib/byebug/commands/enable.rb +8 -6
  34. data/lib/byebug/commands/finish.rb +9 -7
  35. data/lib/byebug/commands/frame.rb +11 -9
  36. data/lib/byebug/commands/help.rb +7 -5
  37. data/lib/byebug/commands/history.rb +7 -5
  38. data/lib/byebug/commands/info/breakpoints.rb +18 -14
  39. data/lib/byebug/commands/info/display.rb +16 -9
  40. data/lib/byebug/commands/info/file.rb +13 -14
  41. data/lib/byebug/commands/info/line.rb +5 -3
  42. data/lib/byebug/commands/info/program.rb +8 -6
  43. data/lib/byebug/commands/info.rb +11 -9
  44. data/lib/byebug/commands/interrupt.rb +8 -4
  45. data/lib/byebug/commands/irb.rb +13 -12
  46. data/lib/byebug/commands/kill.rb +11 -11
  47. data/lib/byebug/commands/list.rb +41 -46
  48. data/lib/byebug/commands/method.rb +10 -8
  49. data/lib/byebug/commands/next.rb +8 -6
  50. data/lib/byebug/commands/pry.rb +10 -10
  51. data/lib/byebug/commands/quit.rb +10 -8
  52. data/lib/byebug/commands/restart.rb +30 -11
  53. data/lib/byebug/commands/save.rb +10 -8
  54. data/lib/byebug/commands/set.rb +13 -11
  55. data/lib/byebug/commands/show.rb +7 -5
  56. data/lib/byebug/commands/skip.rb +85 -0
  57. data/lib/byebug/commands/source.rb +7 -7
  58. data/lib/byebug/commands/step.rb +8 -6
  59. data/lib/byebug/commands/thread/current.rb +6 -4
  60. data/lib/byebug/commands/thread/list.rb +7 -5
  61. data/lib/byebug/commands/thread/resume.rb +7 -7
  62. data/lib/byebug/commands/thread/stop.rb +6 -4
  63. data/lib/byebug/commands/thread/switch.rb +6 -4
  64. data/lib/byebug/commands/thread.rb +11 -9
  65. data/lib/byebug/commands/tracevar.rb +10 -11
  66. data/lib/byebug/commands/undisplay.rb +12 -11
  67. data/lib/byebug/commands/untracevar.rb +8 -6
  68. data/lib/byebug/commands/up.rb +10 -8
  69. data/lib/byebug/commands/var/all.rb +7 -5
  70. data/lib/byebug/commands/var/args.rb +6 -4
  71. data/lib/byebug/commands/var/const.rb +9 -9
  72. data/lib/byebug/commands/var/global.rb +5 -3
  73. data/lib/byebug/commands/var/instance.rb +6 -4
  74. data/lib/byebug/commands/var/local.rb +6 -4
  75. data/lib/byebug/commands/var.rb +12 -10
  76. data/lib/byebug/commands/where.rb +9 -7
  77. data/lib/byebug/commands.rb +40 -37
  78. data/lib/byebug/context.rb +7 -5
  79. data/lib/byebug/core.rb +26 -25
  80. data/lib/byebug/errors.rb +4 -2
  81. data/lib/byebug/frame.rb +19 -22
  82. data/lib/byebug/helpers/bin.rb +47 -0
  83. data/lib/byebug/helpers/eval.rb +15 -13
  84. data/lib/byebug/helpers/file.rb +6 -4
  85. data/lib/byebug/helpers/frame.rb +7 -5
  86. data/lib/byebug/helpers/parse.rb +5 -5
  87. data/lib/byebug/helpers/path.rb +9 -11
  88. data/lib/byebug/helpers/reflection.rb +2 -0
  89. data/lib/byebug/helpers/string.rb +11 -2
  90. data/lib/byebug/helpers/thread.rb +10 -8
  91. data/lib/byebug/helpers/toggle.rb +28 -27
  92. data/lib/byebug/helpers/var.rb +9 -7
  93. data/lib/byebug/history.rb +20 -11
  94. data/lib/byebug/interface.rb +13 -11
  95. data/lib/byebug/interfaces/local_interface.rb +25 -7
  96. data/lib/byebug/interfaces/remote_interface.rb +21 -9
  97. data/lib/byebug/interfaces/script_interface.rb +4 -1
  98. data/lib/byebug/interfaces/test_interface.rb +5 -3
  99. data/lib/byebug/option_setter.rb +14 -12
  100. data/lib/byebug/printers/base.rb +10 -10
  101. data/lib/byebug/printers/plain.rb +9 -8
  102. data/lib/byebug/printers/texts/base.yml +7 -3
  103. data/lib/byebug/printers/texts/plain.yml +1 -1
  104. data/lib/byebug/processors/command_processor.rb +11 -12
  105. data/lib/byebug/processors/control_processor.rb +4 -6
  106. data/lib/byebug/processors/post_mortem_processor.rb +4 -2
  107. data/lib/byebug/processors/script_processor.rb +7 -3
  108. data/lib/byebug/remote/client.rb +57 -0
  109. data/lib/byebug/remote/server.rb +47 -0
  110. data/lib/byebug/remote.rb +46 -66
  111. data/lib/byebug/runner.rb +43 -49
  112. data/lib/byebug/setting.rb +11 -5
  113. data/lib/byebug/settings/autoirb.rb +7 -5
  114. data/lib/byebug/settings/autolist.rb +7 -5
  115. data/lib/byebug/settings/autopry.rb +7 -5
  116. data/lib/byebug/settings/autosave.rb +4 -2
  117. data/lib/byebug/settings/basename.rb +4 -2
  118. data/lib/byebug/settings/callstyle.rb +4 -3
  119. data/lib/byebug/settings/fullpath.rb +4 -2
  120. data/lib/byebug/settings/histfile.rb +5 -3
  121. data/lib/byebug/settings/histsize.rb +4 -2
  122. data/lib/byebug/settings/linetrace.rb +6 -4
  123. data/lib/byebug/settings/listsize.rb +4 -2
  124. data/lib/byebug/settings/post_mortem.rb +6 -4
  125. data/lib/byebug/settings/savefile.rb +4 -2
  126. data/lib/byebug/settings/stack_on_error.rb +4 -2
  127. data/lib/byebug/settings/width.rb +3 -1
  128. data/lib/byebug/source_file_formatter.rb +71 -0
  129. data/lib/byebug/subcommands.rb +6 -4
  130. data/lib/byebug/version.rb +2 -1
  131. data/lib/byebug.rb +3 -1
  132. metadata +22 -20
  133. data/bin/byebug +0 -7
@@ -1,12 +1,18 @@
1
- require 'byebug/command'
2
- require 'byebug/helpers/path'
3
- require 'shellwords'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
4
+ require_relative "../helpers/bin"
5
+ require_relative "../helpers/path"
6
+ require "shellwords"
7
+ require "English"
8
+ require "rbconfig"
4
9
 
5
10
  module Byebug
6
11
  #
7
12
  # Restart debugged program from within byebug.
8
13
  #
9
14
  class RestartCommand < Command
15
+ include Helpers::BinHelper
10
16
  include Helpers::PathHelper
11
17
 
12
18
  self.allow_in_control = true
@@ -17,29 +23,42 @@ module Byebug
17
23
  end
18
24
 
19
25
  def self.description
20
- <<-EOD
26
+ <<-DESCRIPTION
21
27
  restart [args]
22
28
 
23
29
  #{short_description}
24
30
 
25
31
  This is a re-exec - all byebug state is lost. If command arguments are
26
32
  passed those are used.
27
- EOD
33
+ DESCRIPTION
28
34
  end
29
35
 
30
36
  def self.short_description
31
- 'Restarts the debugged program'
37
+ "Restarts the debugged program"
32
38
  end
33
39
 
34
40
  def execute
35
- argv = [$PROGRAM_NAME]
41
+ cmd = [$PROGRAM_NAME]
42
+
43
+ cmd = prepend_byebug_bin(cmd)
44
+ cmd = prepend_ruby_bin(cmd)
45
+
46
+ cmd += (@match[:args] ? @match[:args].shellsplit : $ARGV)
36
47
 
37
- argv.unshift(bin_file) if Byebug.mode == :standalone
48
+ puts pr("restart.success", cmd: cmd.shelljoin)
49
+ Kernel.exec(*cmd)
50
+ end
51
+
52
+ private
38
53
 
39
- argv += (@match[:args] ? @match[:args].shellsplit : $ARGV.compact)
54
+ def prepend_byebug_bin(cmd)
55
+ cmd.unshift(bin_file) if Byebug.mode == :standalone
56
+ cmd
57
+ end
40
58
 
41
- puts pr('restart.success', cmd: argv.shelljoin)
42
- Kernel.exec(*argv)
59
+ def prepend_ruby_bin(cmd)
60
+ cmd.unshift(RbConfig.ruby) if which("ruby") != which(cmd.first)
61
+ cmd
43
62
  end
44
63
  end
45
64
  end
@@ -1,4 +1,6 @@
1
- require 'byebug/command'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -13,7 +15,7 @@ module Byebug
13
15
  end
14
16
 
15
17
  def self.description
16
- <<-EOD
18
+ <<-DESCRIPTION
17
19
  save[ FILE]
18
20
 
19
21
  #{short_description}
@@ -24,22 +26,22 @@ module Byebug
24
26
 
25
27
  Use the "source" command in another debug session to restore the saved
26
28
  file.
27
- EOD
29
+ DESCRIPTION
28
30
  end
29
31
 
30
32
  def self.short_description
31
- 'Saves current byebug session to a file'
33
+ "Saves current byebug session to a file"
32
34
  end
33
35
 
34
36
  def execute
35
- file = File.open(@match[1] || Setting[:savefile], 'w')
37
+ file = File.open(@match[1] || Setting[:savefile], "w")
36
38
 
37
39
  save_breakpoints(file)
38
40
  save_catchpoints(file)
39
41
  save_displays(file)
40
42
  save_settings(file)
41
43
 
42
- print pr('save.messages.done', path: file.path)
44
+ print pr("save.messages.done", path: file.path)
43
45
  file.close
44
46
  end
45
47
 
@@ -52,7 +54,7 @@ module Byebug
52
54
  end
53
55
 
54
56
  def save_catchpoints(file)
55
- Byebug.catchpoints.keys.each do |c|
57
+ Byebug.catchpoints.each_key do |c|
56
58
  file.puts "catch #{c}"
57
59
  end
58
60
  end
@@ -62,7 +64,7 @@ module Byebug
62
64
  end
63
65
 
64
66
  def save_settings(file)
65
- %w(autoirb autolist basename).each do |setting|
67
+ %w[autoirb autolist basename].each do |setting|
66
68
  file.puts "set #{setting} #{Setting[setting.to_sym]}"
67
69
  end
68
70
  end
@@ -1,5 +1,7 @@
1
- require 'byebug/command'
2
- require 'byebug/helpers/parse'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
4
+ require_relative "../helpers/parse"
3
5
 
4
6
  module Byebug
5
7
  #
@@ -16,7 +18,7 @@ module Byebug
16
18
  end
17
19
 
18
20
  def self.description
19
- <<-EOD
21
+ <<-DESCRIPTION
20
22
  set <setting> <value>
21
23
 
22
24
  #{short_description}
@@ -26,11 +28,11 @@ module Byebug
26
28
  you can use "set no<setting>" to disable them.
27
29
 
28
30
  You can see these environment settings with the "show" command.
29
- EOD
31
+ DESCRIPTION
30
32
  end
31
33
 
32
34
  def self.short_description
33
- 'Modifies byebug settings'
35
+ "Modifies byebug settings"
34
36
  end
35
37
 
36
38
  def self.help
@@ -43,12 +45,12 @@ module Byebug
43
45
  return puts(help) if key.nil? && value.nil?
44
46
 
45
47
  setting = Setting.find(key)
46
- return errmsg(pr('set.errors.unknown_setting', key: key)) unless setting
48
+ return errmsg(pr("set.errors.unknown_setting", key: key)) unless setting
47
49
 
48
50
  if !setting.boolean? && value.nil?
49
- err = pr('set.errors.must_specify_value', key: key)
51
+ err = pr("set.errors.must_specify_value", key: key)
50
52
  elsif setting.boolean?
51
- value, err = get_onoff(value, key =~ /^no/ ? false : true)
53
+ value, err = get_onoff(value, /^no/.match?(key) ? false : true)
52
54
  elsif setting.integer?
53
55
  value, err = get_int(value, setting.to_sym, 1)
54
56
  end
@@ -65,12 +67,12 @@ module Byebug
65
67
  return default if arg.nil?
66
68
 
67
69
  case arg
68
- when '1', 'on', 'true'
70
+ when "1", "on", "true"
69
71
  true
70
- when '0', 'off', 'false'
72
+ when "0", "off", "false"
71
73
  false
72
74
  else
73
- [nil, pr('set.errors.on_off', arg: arg)]
75
+ [nil, pr("set.errors.on_off", arg: arg)]
74
76
  end
75
77
  end
76
78
  end
@@ -1,4 +1,6 @@
1
- require 'byebug/command'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -13,17 +15,17 @@ module Byebug
13
15
  end
14
16
 
15
17
  def self.description
16
- <<-EOD
18
+ <<-DESCRIPTION
17
19
  show <setting> <value>
18
20
 
19
21
  #{short_description}
20
22
 
21
23
  You can change them with the "set" command.
22
- EOD
24
+ DESCRIPTION
23
25
  end
24
26
 
25
27
  def self.short_description
26
- 'Shows byebug settings'
28
+ "Shows byebug settings"
27
29
  end
28
30
 
29
31
  def self.help
@@ -35,7 +37,7 @@ module Byebug
35
37
  return puts(help) unless key
36
38
 
37
39
  setting = Setting.find(key)
38
- return errmsg(pr('show.errors.unknown_setting', key: key)) unless setting
40
+ return errmsg(pr("show.errors.unknown_setting", key: key)) unless setting
39
41
 
40
42
  puts Setting.settings[setting.to_sym]
41
43
  end
@@ -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,4 +1,6 @@
1
- require 'byebug/command'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -15,24 +17,22 @@ module Byebug
15
17
  end
16
18
 
17
19
  def self.description
18
- <<-EOD
20
+ <<-DESCRIPTION
19
21
  source <file>
20
22
 
21
23
  #{short_description}
22
- EOD
24
+ DESCRIPTION
23
25
  end
24
26
 
25
27
  def self.short_description
26
- 'Restores a previously saved byebug session'
28
+ "Restores a previously saved byebug session"
27
29
  end
28
30
 
29
31
  def execute
30
32
  return puts(help) unless @match[1]
31
33
 
32
34
  file = File.expand_path(@match[1]).strip
33
- unless File.exist?(file)
34
- return errmsg(pr('source.errors.not_found', file: file))
35
- end
35
+ return errmsg(pr("source.errors.not_found", file: file)) unless File.exist?(file)
36
36
 
37
37
  processor.interface.read_file(file)
38
38
  end
@@ -1,5 +1,7 @@
1
- require 'byebug/command'
2
- require 'byebug/helpers/parse'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
4
+ require_relative "../helpers/parse"
3
5
 
4
6
  module Byebug
5
7
  #
@@ -16,19 +18,19 @@ module Byebug
16
18
  end
17
19
 
18
20
  def self.description
19
- <<-EOD
21
+ <<-DESCRIPTION
20
22
  s[tep][ times]
21
23
 
22
24
  #{short_description}
23
- EOD
25
+ DESCRIPTION
24
26
  end
25
27
 
26
28
  def self.short_description
27
- 'Steps into blocks or methods one or more times'
29
+ "Steps into blocks or methods one or more times"
28
30
  end
29
31
 
30
32
  def execute
31
- steps, err = parse_steps(@match[1], 'Steps')
33
+ steps, err = parse_steps(@match[1], "Steps")
32
34
  return errmsg(err) unless steps
33
35
 
34
36
  context.step_into(steps, context.frame.pos)
@@ -1,4 +1,6 @@
1
- require 'byebug/helpers/thread'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../helpers/thread"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -16,15 +18,15 @@ module Byebug
16
18
  end
17
19
 
18
20
  def self.description
19
- <<-EOD
21
+ <<-DESCRIPTION
20
22
  th[read] c[urrent]
21
23
 
22
24
  #{short_description}
23
- EOD
25
+ DESCRIPTION
24
26
  end
25
27
 
26
28
  def self.short_description
27
- 'Shows current thread information'
29
+ "Shows current thread information"
28
30
  end
29
31
 
30
32
  def execute
@@ -1,4 +1,6 @@
1
- require 'byebug/helpers/thread'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../helpers/thread"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -16,21 +18,21 @@ module Byebug
16
18
  end
17
19
 
18
20
  def self.description
19
- <<-EOD
21
+ <<-DESCRIPTION
20
22
  th[read] l[ist] <thnum>
21
23
 
22
24
  #{short_description}
23
- EOD
25
+ DESCRIPTION
24
26
  end
25
27
 
26
28
  def self.short_description
27
- 'Lists all threads'
29
+ "Lists all threads"
28
30
  end
29
31
 
30
32
  def execute
31
33
  contexts = Byebug.contexts.sort_by(&:thnum)
32
34
 
33
- thread_list = prc('thread.context', contexts) do |context, _|
35
+ thread_list = prc("thread.context", contexts) do |context, _|
34
36
  thread_arguments(context)
35
37
  end
36
38
 
@@ -1,4 +1,6 @@
1
- require 'byebug/helpers/thread'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../helpers/thread"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -16,15 +18,15 @@ module Byebug
16
18
  end
17
19
 
18
20
  def self.description
19
- <<-EOD
21
+ <<-DESCRIPTION
20
22
  th[read] r[esume] <thnum>
21
23
 
22
24
  #{short_description}
23
- EOD
25
+ DESCRIPTION
24
26
  end
25
27
 
26
28
  def self.short_description
27
- 'Resumes execution of the specified thread'
29
+ "Resumes execution of the specified thread"
28
30
  end
29
31
 
30
32
  def execute
@@ -33,9 +35,7 @@ module Byebug
33
35
  context, err = context_from_thread(@match[1])
34
36
  return errmsg(err) if err
35
37
 
36
- unless context.suspended?
37
- return errmsg(pr('thread.errors.already_running'))
38
- end
38
+ return errmsg(pr("thread.errors.already_running")) unless context.suspended?
39
39
 
40
40
  context.resume
41
41
  display_context(context)
@@ -1,4 +1,6 @@
1
- require 'byebug/helpers/thread'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../helpers/thread"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -16,15 +18,15 @@ module Byebug
16
18
  end
17
19
 
18
20
  def self.description
19
- <<-EOD
21
+ <<-DESCRIPTION
20
22
  th[read] st[op] <thnum>
21
23
 
22
24
  #{short_description}
23
- EOD
25
+ DESCRIPTION
24
26
  end
25
27
 
26
28
  def self.short_description
27
- 'Stops the execution of the specified thread'
29
+ "Stops the execution of the specified thread"
28
30
  end
29
31
 
30
32
  def execute
@@ -1,4 +1,6 @@
1
- require 'byebug/helpers/thread'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../helpers/thread"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -16,15 +18,15 @@ module Byebug
16
18
  end
17
19
 
18
20
  def self.description
19
- <<-EOD
21
+ <<-DESCRIPTION
20
22
  th[read] sw[itch] <thnum>
21
23
 
22
24
  #{short_description}
23
- EOD
25
+ DESCRIPTION
24
26
  end
25
27
 
26
28
  def self.short_description
27
- 'Switches execution to the specified thread'
29
+ "Switches execution to the specified thread"
28
30
  end
29
31
 
30
32
  def execute
@@ -1,10 +1,12 @@
1
- require 'byebug/subcommands'
1
+ # frozen_string_literal: true
2
2
 
3
- require 'byebug/commands/thread/current'
4
- require 'byebug/commands/thread/list'
5
- require 'byebug/commands/thread/resume'
6
- require 'byebug/commands/thread/stop'
7
- require 'byebug/commands/thread/switch'
3
+ require_relative "../subcommands"
4
+
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"
8
10
 
9
11
  module Byebug
10
12
  #
@@ -18,15 +20,15 @@ module Byebug
18
20
  end
19
21
 
20
22
  def self.description
21
- <<-EOD
23
+ <<-DESCRIPTION
22
24
  th[read] <subcommand>
23
25
 
24
26
  #{short_description}
25
- EOD
27
+ DESCRIPTION
26
28
  end
27
29
 
28
30
  def self.short_description
29
- 'Commands to manipulate threads'
31
+ "Commands to manipulate threads"
30
32
  end
31
33
  end
32
34
  end
@@ -1,4 +1,6 @@
1
- require 'byebug/command'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -12,7 +14,7 @@ module Byebug
12
14
  end
13
15
 
14
16
  def self.description
15
- <<-EOD
17
+ <<-DESCRIPTION
16
18
  tr[acevar] <variable> [[no]stop]
17
19
 
18
20
  #{short_description}
@@ -20,20 +22,17 @@ module Byebug
20
22
  If "stop" is specified, execution will stop every time the variable
21
23
  changes its value. If nothing or "nostop" is specified, execution won't
22
24
  stop, changes will just be logged in byebug's output.
23
- EOD
25
+ DESCRIPTION
24
26
  end
25
27
 
26
28
  def self.short_description
27
- 'Enables tracing of a global variable'
29
+ "Enables tracing of a global variable"
28
30
  end
29
31
 
30
32
  def execute
31
33
  var = @match[1]
32
- return errmsg(pr('trace.errors.needs_global_variable')) unless var
33
-
34
- unless global_variables.include?(:"#{var}")
35
- return errmsg(pr('trace.errors.var_is_not_global', name: var))
36
- end
34
+ return errmsg(pr("trace.errors.needs_global_variable")) unless var
35
+ return errmsg(pr("trace.errors.var_is_not_global", name: var)) unless global_variables.include?(:"#{var}")
37
36
 
38
37
  stop = @match[2] && @match[2] !~ /nostop/
39
38
 
@@ -41,13 +40,13 @@ module Byebug
41
40
  trace_var(:"#{var}") { |val| on_change(var, val, stop) }
42
41
  end
43
42
 
44
- puts pr('trace.messages.success', var: var)
43
+ puts pr("trace.messages.success", var: var)
45
44
  end
46
45
 
47
46
  private
48
47
 
49
48
  def on_change(name, value, stop)
50
- puts pr('trace.messages.on_change', name: name, value: value)
49
+ puts pr("trace.messages.on_change", name: name, value: value)
51
50
 
52
51
  context.step_out(1, false) if stop
53
52
  end