byebug 9.1.0 → 10.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +24 -3
  3. data/CONTRIBUTING.md +39 -18
  4. data/GUIDE.md +16 -17
  5. data/README.md +64 -52
  6. data/exe/byebug +6 -0
  7. data/ext/byebug/breakpoint.c +1 -1
  8. data/ext/byebug/byebug.c +16 -16
  9. data/ext/byebug/byebug.h +40 -26
  10. data/ext/byebug/context.c +26 -26
  11. data/ext/byebug/extconf.rb +7 -5
  12. data/ext/byebug/threads.c +8 -8
  13. data/lib/byebug.rb +3 -1
  14. data/lib/byebug/attacher.rb +17 -3
  15. data/lib/byebug/breakpoint.rb +25 -3
  16. data/lib/byebug/command.rb +20 -14
  17. data/lib/byebug/command_list.rb +3 -1
  18. data/lib/byebug/commands.rb +39 -37
  19. data/lib/byebug/commands/break.rb +33 -15
  20. data/lib/byebug/commands/catch.rb +16 -14
  21. data/lib/byebug/commands/condition.rb +11 -9
  22. data/lib/byebug/commands/continue.rb +9 -7
  23. data/lib/byebug/commands/debug.rb +7 -5
  24. data/lib/byebug/commands/delete.rb +11 -9
  25. data/lib/byebug/commands/disable.rb +8 -6
  26. data/lib/byebug/commands/disable/breakpoints.rb +7 -5
  27. data/lib/byebug/commands/disable/display.rb +7 -5
  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 +10 -8
  31. data/lib/byebug/commands/enable.rb +8 -6
  32. data/lib/byebug/commands/enable/breakpoints.rb +7 -5
  33. data/lib/byebug/commands/enable/display.rb +7 -5
  34. data/lib/byebug/commands/finish.rb +8 -6
  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.rb +11 -9
  39. data/lib/byebug/commands/info/breakpoints.rb +17 -11
  40. data/lib/byebug/commands/info/display.rb +16 -7
  41. data/lib/byebug/commands/info/file.rb +12 -10
  42. data/lib/byebug/commands/info/line.rb +5 -3
  43. data/lib/byebug/commands/info/program.rb +8 -6
  44. data/lib/byebug/commands/interrupt.rb +8 -4
  45. data/lib/byebug/commands/irb.rb +9 -7
  46. data/lib/byebug/commands/kill.rb +9 -7
  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 -8
  51. data/lib/byebug/commands/quit.rb +7 -5
  52. data/lib/byebug/commands/restart.rb +13 -11
  53. data/lib/byebug/commands/save.rb +9 -7
  54. data/lib/byebug/commands/set.rb +12 -10
  55. data/lib/byebug/commands/show.rb +7 -5
  56. data/lib/byebug/commands/source.rb +7 -5
  57. data/lib/byebug/commands/step.rb +8 -6
  58. data/lib/byebug/commands/thread.rb +11 -9
  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 -5
  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/tracevar.rb +10 -8
  65. data/lib/byebug/commands/undisplay.rb +10 -8
  66. data/lib/byebug/commands/untracevar.rb +8 -6
  67. data/lib/byebug/commands/up.rb +10 -8
  68. data/lib/byebug/commands/var.rb +12 -10
  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 -7
  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/where.rb +9 -7
  76. data/lib/byebug/context.rb +7 -5
  77. data/lib/byebug/core.rb +25 -25
  78. data/lib/byebug/errors.rb +4 -2
  79. data/lib/byebug/frame.rb +16 -16
  80. data/lib/byebug/helpers/bin.rb +28 -7
  81. data/lib/byebug/helpers/eval.rb +8 -6
  82. data/lib/byebug/helpers/file.rb +4 -2
  83. data/lib/byebug/helpers/frame.rb +5 -3
  84. data/lib/byebug/helpers/parse.rb +5 -3
  85. data/lib/byebug/helpers/path.rb +7 -5
  86. data/lib/byebug/helpers/reflection.rb +2 -0
  87. data/lib/byebug/helpers/string.rb +4 -2
  88. data/lib/byebug/helpers/thread.rb +10 -8
  89. data/lib/byebug/helpers/toggle.rb +10 -8
  90. data/lib/byebug/helpers/var.rb +8 -6
  91. data/lib/byebug/history.rb +7 -5
  92. data/lib/byebug/interface.rb +13 -11
  93. data/lib/byebug/interfaces/local_interface.rb +4 -4
  94. data/lib/byebug/interfaces/remote_interface.rb +21 -9
  95. data/lib/byebug/interfaces/script_interface.rb +2 -0
  96. data/lib/byebug/interfaces/test_interface.rb +5 -3
  97. data/lib/byebug/option_setter.rb +14 -12
  98. data/lib/byebug/printers/base.rb +6 -6
  99. data/lib/byebug/printers/plain.rb +8 -6
  100. data/lib/byebug/printers/texts/base.yml +3 -3
  101. data/lib/byebug/processors/command_processor.rb +11 -12
  102. data/lib/byebug/processors/control_processor.rb +4 -6
  103. data/lib/byebug/processors/post_mortem_processor.rb +4 -2
  104. data/lib/byebug/processors/script_processor.rb +7 -3
  105. data/lib/byebug/remote.rb +45 -65
  106. data/lib/byebug/remote/client.rb +55 -0
  107. data/lib/byebug/remote/server.rb +47 -0
  108. data/lib/byebug/runner.rb +26 -19
  109. data/lib/byebug/setting.rb +10 -4
  110. data/lib/byebug/settings/autoirb.rb +5 -3
  111. data/lib/byebug/settings/autolist.rb +5 -3
  112. data/lib/byebug/settings/autopry.rb +5 -3
  113. data/lib/byebug/settings/autosave.rb +4 -2
  114. data/lib/byebug/settings/basename.rb +4 -2
  115. data/lib/byebug/settings/callstyle.rb +3 -3
  116. data/lib/byebug/settings/fullpath.rb +4 -2
  117. data/lib/byebug/settings/histfile.rb +5 -3
  118. data/lib/byebug/settings/histsize.rb +4 -2
  119. data/lib/byebug/settings/linetrace.rb +4 -2
  120. data/lib/byebug/settings/listsize.rb +4 -2
  121. data/lib/byebug/settings/post_mortem.rb +4 -2
  122. data/lib/byebug/settings/savefile.rb +4 -2
  123. data/lib/byebug/settings/stack_on_error.rb +4 -2
  124. data/lib/byebug/settings/width.rb +3 -1
  125. data/lib/byebug/source_file_formatter.rb +71 -0
  126. data/lib/byebug/subcommands.rb +6 -4
  127. data/lib/byebug/version.rb +1 -1
  128. metadata +8 -5
  129. data/bin/byebug +0 -9
@@ -1,4 +1,6 @@
1
- require 'byebug/command'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/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
@@ -1,5 +1,7 @@
1
- require 'byebug/command'
2
- require 'byebug/helpers/parse'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/command"
4
+ require "byebug/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,10 +45,10 @@ 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
53
  value, err = get_onoff(value, key =~ /^no/ ? false : true)
52
54
  elsif setting.integer?
@@ -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 "byebug/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
@@ -1,4 +1,6 @@
1
- require 'byebug/command'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/command"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -15,15 +17,15 @@ 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
@@ -31,7 +33,7 @@ module Byebug
31
33
 
32
34
  file = File.expand_path(@match[1]).strip
33
35
  unless File.exist?(file)
34
- return errmsg(pr('source.errors.not_found', file: file))
36
+ return errmsg(pr("source.errors.not_found", file: file))
35
37
  end
36
38
 
37
39
  processor.interface.read_file(file)
@@ -1,5 +1,7 @@
1
- require 'byebug/command'
2
- require 'byebug/helpers/parse'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/command"
4
+ require "byebug/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,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 "byebug/subcommands"
4
+
5
+ require "byebug/commands/thread/current"
6
+ require "byebug/commands/thread/list"
7
+ require "byebug/commands/thread/resume"
8
+ require "byebug/commands/thread/stop"
9
+ require "byebug/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/helpers/thread'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/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 "byebug/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 "byebug/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
@@ -34,7 +36,7 @@ module Byebug
34
36
  return errmsg(err) if err
35
37
 
36
38
  unless context.suspended?
37
- return errmsg(pr('thread.errors.already_running'))
39
+ return errmsg(pr("thread.errors.already_running"))
38
40
  end
39
41
 
40
42
  context.resume
@@ -1,4 +1,6 @@
1
- require 'byebug/helpers/thread'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/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 "byebug/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,4 +1,6 @@
1
- require 'byebug/command'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/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,19 +22,19 @@ 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
34
+ return errmsg(pr("trace.errors.needs_global_variable")) unless var
33
35
 
34
36
  unless global_variables.include?(:"#{var}")
35
- return errmsg(pr('trace.errors.var_is_not_global', name: var))
37
+ return errmsg(pr("trace.errors.var_is_not_global", name: var))
36
38
  end
37
39
 
38
40
  stop = @match[2] && @match[2] !~ /nostop/
@@ -41,13 +43,13 @@ module Byebug
41
43
  trace_var(:"#{var}") { |val| on_change(var, val, stop) }
42
44
  end
43
45
 
44
- puts pr('trace.messages.success', var: var)
46
+ puts pr("trace.messages.success", var: var)
45
47
  end
46
48
 
47
49
  private
48
50
 
49
51
  def on_change(name, value, stop)
50
- puts pr('trace.messages.on_change', name: name, value: value)
52
+ puts pr("trace.messages.on_change", name: name, value: value)
51
53
 
52
54
  context.step_out(1, false) if stop
53
55
  end