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,5 +1,7 @@
1
- require 'byebug/setting'
2
- require 'byebug/commands/irb'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/setting"
4
+ require "byebug/commands/irb"
3
5
 
4
6
  module Byebug
5
7
  #
@@ -13,7 +15,7 @@ module Byebug
13
15
  end
14
16
 
15
17
  def banner
16
- 'Invoke IRB on every stop'
18
+ "Invoke IRB on every stop"
17
19
  end
18
20
 
19
21
  def value=(v)
@@ -1,5 +1,7 @@
1
- require 'byebug/setting'
2
- require 'byebug/commands/list'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/setting"
4
+ require "byebug/commands/list"
3
5
 
4
6
  module Byebug
5
7
  #
@@ -13,7 +15,7 @@ module Byebug
13
15
  end
14
16
 
15
17
  def banner
16
- 'Invoke list command on every stop'
18
+ "Invoke list command on every stop"
17
19
  end
18
20
 
19
21
  def value=(v)
@@ -1,5 +1,7 @@
1
- require 'byebug/setting'
2
- require 'byebug/commands/pry'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/setting"
4
+ require "byebug/commands/pry"
3
5
 
4
6
  module Byebug
5
7
  #
@@ -13,7 +15,7 @@ module Byebug
13
15
  end
14
16
 
15
17
  def banner
16
- 'Invoke Pry on every stop'
18
+ "Invoke Pry on every stop"
17
19
  end
18
20
 
19
21
  def value=(v)
@@ -1,4 +1,6 @@
1
- require 'byebug/setting'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/setting"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -9,7 +11,7 @@ module Byebug
9
11
  DEFAULT = true
10
12
 
11
13
  def banner
12
- 'Automatically save command history record on exit'
14
+ "Automatically save command history record on exit"
13
15
  end
14
16
  end
15
17
  end
@@ -1,4 +1,6 @@
1
- require 'byebug/setting'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/setting"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -8,7 +10,7 @@ module Byebug
8
10
  #
9
11
  class BasenameSetting < Setting
10
12
  def banner
11
- '<file>:<line> information after every stop uses short paths'
13
+ "<file>:<line> information after every stop uses short paths"
12
14
  end
13
15
  end
14
16
  end
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'byebug/setting'
3
+ require "byebug/setting"
4
4
 
5
5
  module Byebug
6
6
  #
7
7
  # Setting to customize the verbosity level for stack frames.
8
8
  #
9
9
  class CallstyleSetting < Setting
10
- DEFAULT = 'long'.freeze
10
+ DEFAULT = "long".freeze
11
11
 
12
12
  def banner
13
- 'Set how you want method call parameters to be displayed'
13
+ "Set how you want method call parameters to be displayed"
14
14
  end
15
15
 
16
16
  def to_s
@@ -1,4 +1,6 @@
1
- require 'byebug/setting'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/setting"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -8,7 +10,7 @@ module Byebug
8
10
  DEFAULT = true
9
11
 
10
12
  def banner
11
- 'Display full file names in backtraces'
13
+ "Display full file names in backtraces"
12
14
  end
13
15
  end
14
16
  end
@@ -1,14 +1,16 @@
1
- require 'byebug/setting'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/setting"
2
4
 
3
5
  module Byebug
4
6
  #
5
7
  # Setting to customize the file where byebug's history is saved.
6
8
  #
7
9
  class HistfileSetting < Setting
8
- DEFAULT = File.expand_path('.byebug_history')
10
+ DEFAULT = File.expand_path(".byebug_history")
9
11
 
10
12
  def banner
11
- 'File where cmd history is saved to. Default: ./.byebug_history'
13
+ "File where cmd history is saved to. Default: ./.byebug_history"
12
14
  end
13
15
 
14
16
  def to_s
@@ -1,4 +1,6 @@
1
- require 'byebug/setting'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/setting"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -8,7 +10,7 @@ module Byebug
8
10
  DEFAULT = 256
9
11
 
10
12
  def banner
11
- 'Maximum number of commands that can be stored in byebug history'
13
+ "Maximum number of commands that can be stored in byebug history"
12
14
  end
13
15
 
14
16
  def to_s
@@ -1,4 +1,6 @@
1
- require 'byebug/setting'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/setting"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -6,7 +8,7 @@ module Byebug
6
8
  #
7
9
  class LinetraceSetting < Setting
8
10
  def banner
9
- 'Enable line execution tracing'
11
+ "Enable line execution tracing"
10
12
  end
11
13
 
12
14
  def value=(v)
@@ -1,4 +1,6 @@
1
- require 'byebug/setting'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/setting"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -9,7 +11,7 @@ module Byebug
9
11
  DEFAULT = 10
10
12
 
11
13
  def banner
12
- 'Set number of source lines to list by default'
14
+ "Set number of source lines to list by default"
13
15
  end
14
16
 
15
17
  def to_s
@@ -1,4 +1,6 @@
1
- require 'byebug/setting'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/setting"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -11,7 +13,7 @@ module Byebug
11
13
  end
12
14
 
13
15
  def banner
14
- 'Enable/disable post-mortem mode'
16
+ "Enable/disable post-mortem mode"
15
17
  end
16
18
 
17
19
  def value=(v)
@@ -1,4 +1,6 @@
1
- require 'byebug/setting'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/setting"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -8,7 +10,7 @@ module Byebug
8
10
  DEFAULT = File.expand_path("#{ENV['HOME'] || '.'}/.byebug_save")
9
11
 
10
12
  def banner
11
- 'File where settings are saved to. Default: ~/.byebug_save'
13
+ "File where settings are saved to. Default: ~/.byebug_save"
12
14
  end
13
15
 
14
16
  def to_s
@@ -1,4 +1,6 @@
1
- require 'byebug/setting'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/setting"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -7,7 +9,7 @@ module Byebug
7
9
  #
8
10
  class StackOnErrorSetting < Setting
9
11
  def banner
10
- 'Display stack trace when `eval` raises an exception'
12
+ "Display stack trace when `eval` raises an exception"
11
13
  end
12
14
  end
13
15
  end
@@ -1,4 +1,6 @@
1
- require 'byebug/setting'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/setting"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/helpers/file"
4
+ require "byebug/setting"
5
+
6
+ module Byebug
7
+ #
8
+ # Formats specific line ranges in a source file
9
+ #
10
+ class SourceFileFormatter
11
+ include Helpers::FileHelper
12
+
13
+ attr_reader :file, :annotator
14
+
15
+ def initialize(file, annotator)
16
+ @file = file
17
+ @annotator = annotator
18
+ end
19
+
20
+ def lines(min, max)
21
+ File.foreach(file).with_index.map do |line, lineno|
22
+ next unless (min..max).cover?(lineno + 1)
23
+
24
+ format(
25
+ "%<annotation>s %<lineno>#{max.to_s.size}d: %<source>s",
26
+ annotation: annotator.call(lineno + 1),
27
+ lineno: lineno + 1,
28
+ source: line
29
+ )
30
+ end
31
+ end
32
+
33
+ def lines_around(center)
34
+ lines(*range_around(center))
35
+ end
36
+
37
+ def range_around(center)
38
+ range_from(center - size / 2)
39
+ end
40
+
41
+ def range_from(min)
42
+ first = amend_initial(min)
43
+
44
+ [first, first + size - 1]
45
+ end
46
+
47
+ def amend_initial(line)
48
+ amend(line, max_initial_line)
49
+ end
50
+
51
+ def amend_final(line)
52
+ amend(line, max_line)
53
+ end
54
+
55
+ def max_initial_line
56
+ max_line - size + 1
57
+ end
58
+
59
+ def max_line
60
+ @max_line ||= n_lines(file)
61
+ end
62
+
63
+ def size
64
+ [Setting[:listsize], max_line].min
65
+ end
66
+
67
+ def amend(line, ceiling)
68
+ [ceiling, [1, line].max].min
69
+ end
70
+ end
71
+ end
@@ -1,7 +1,9 @@
1
- require 'forwardable'
1
+ # frozen_string_literal: true
2
2
 
3
- require 'byebug/helpers/reflection'
4
- require 'byebug/command_list'
3
+ require "forwardable"
4
+
5
+ require "byebug/helpers/reflection"
6
+ require "byebug/command_list"
5
7
 
6
8
  module Byebug
7
9
  #
@@ -13,7 +15,7 @@ module Byebug
13
15
  end
14
16
 
15
17
  extend Forwardable
16
- def_delegators :'self.class', :subcommand_list
18
+ def_delegators "self.class", :subcommand_list
17
19
 
18
20
  #
19
21
  # Delegates to subcommands or prints help if no subcommand specified.
@@ -4,5 +4,5 @@
4
4
  # Reopen main module to define the library version
5
5
  #
6
6
  module Byebug
7
- VERSION = '9.1.0'.freeze
7
+ VERSION = "10.0.0".freeze
8
8
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: byebug
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.1.0
4
+ version: 10.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rodriguez
8
8
  - Kent Sibilev
9
9
  - Mark Moseley
10
10
  autorequire:
11
- bindir: bin
11
+ bindir: exe
12
12
  cert_chain: []
13
- date: 2017-08-22 00:00:00.000000000 Z
13
+ date: 2018-01-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -48,7 +48,7 @@ files:
48
48
  - GUIDE.md
49
49
  - LICENSE
50
50
  - README.md
51
- - bin/byebug
51
+ - exe/byebug
52
52
  - ext/byebug/breakpoint.c
53
53
  - ext/byebug/byebug.c
54
54
  - ext/byebug/byebug.h
@@ -150,6 +150,8 @@ files:
150
150
  - lib/byebug/processors/post_mortem_processor.rb
151
151
  - lib/byebug/processors/script_processor.rb
152
152
  - lib/byebug/remote.rb
153
+ - lib/byebug/remote/client.rb
154
+ - lib/byebug/remote/server.rb
153
155
  - lib/byebug/runner.rb
154
156
  - lib/byebug/setting.rb
155
157
  - lib/byebug/settings/autoirb.rb
@@ -167,6 +169,7 @@ files:
167
169
  - lib/byebug/settings/savefile.rb
168
170
  - lib/byebug/settings/stack_on_error.rb
169
171
  - lib/byebug/settings/width.rb
172
+ - lib/byebug/source_file_formatter.rb
170
173
  - lib/byebug/subcommands.rb
171
174
  - lib/byebug/version.rb
172
175
  homepage: http://github.com/deivid-rodriguez/byebug
@@ -189,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
192
  version: '0'
190
193
  requirements: []
191
194
  rubyforge_project:
192
- rubygems_version: 2.6.12
195
+ rubygems_version: 2.7.4
193
196
  signing_key:
194
197
  specification_version: 4
195
198
  summary: Ruby fast debugger - base + CLI
data/bin/byebug DELETED
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- bin_dir = File.dirname(File.realpath(__FILE__))
4
-
5
- $LOAD_PATH.unshift(File.expand_path(File.join('..', 'lib'), bin_dir))
6
-
7
- require 'byebug/runner'
8
-
9
- Byebug::Runner.new.run