byebug 5.0.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -1
  3. data/CONTRIBUTING.md +35 -13
  4. data/GUIDE.md +256 -198
  5. data/README.md +5 -11
  6. data/ext/byebug/byebug.c +5 -43
  7. data/ext/byebug/byebug.h +6 -1
  8. data/ext/byebug/context.c +4 -5
  9. data/lib/byebug/command.rb +64 -64
  10. data/lib/byebug/command_list.rb +32 -0
  11. data/lib/byebug/commands.rb +37 -0
  12. data/lib/byebug/commands/break.rb +45 -37
  13. data/lib/byebug/commands/catch.rb +52 -28
  14. data/lib/byebug/commands/condition.rb +19 -13
  15. data/lib/byebug/commands/continue.rb +15 -11
  16. data/lib/byebug/commands/delete.rb +18 -12
  17. data/lib/byebug/commands/disable.rb +9 -10
  18. data/lib/byebug/commands/disable/breakpoints.rb +13 -11
  19. data/lib/byebug/commands/disable/display.rb +13 -11
  20. data/lib/byebug/commands/display.rb +32 -24
  21. data/lib/byebug/commands/down.rb +18 -14
  22. data/lib/byebug/commands/edit.rb +42 -26
  23. data/lib/byebug/commands/enable.rb +9 -3
  24. data/lib/byebug/commands/enable/breakpoints.rb +13 -11
  25. data/lib/byebug/commands/enable/display.rb +13 -11
  26. data/lib/byebug/commands/finish.rb +23 -14
  27. data/lib/byebug/commands/frame.rb +21 -18
  28. data/lib/byebug/commands/help.rb +39 -16
  29. data/lib/byebug/commands/history.rb +16 -10
  30. data/lib/byebug/commands/info.rb +8 -5
  31. data/lib/byebug/commands/info/breakpoints.rb +16 -14
  32. data/lib/byebug/commands/info/display.rb +18 -18
  33. data/lib/byebug/commands/info/file.rb +22 -22
  34. data/lib/byebug/commands/info/line.rb +13 -11
  35. data/lib/byebug/commands/info/program.rb +13 -17
  36. data/lib/byebug/commands/interrupt.rb +13 -11
  37. data/lib/byebug/commands/irb.rb +16 -10
  38. data/lib/byebug/commands/kill.rb +19 -13
  39. data/lib/byebug/commands/list.rb +35 -24
  40. data/lib/byebug/commands/method.rb +25 -15
  41. data/lib/byebug/commands/next.rb +15 -13
  42. data/lib/byebug/commands/pry.rb +18 -11
  43. data/lib/byebug/commands/ps.rb +21 -23
  44. data/lib/byebug/commands/quit.rb +17 -11
  45. data/lib/byebug/commands/restart.rb +28 -24
  46. data/lib/byebug/commands/save.rb +23 -15
  47. data/lib/byebug/commands/set.rb +26 -19
  48. data/lib/byebug/commands/show.rb +20 -14
  49. data/lib/byebug/commands/source.rb +15 -14
  50. data/lib/byebug/commands/step.rb +15 -13
  51. data/lib/byebug/commands/thread.rb +8 -4
  52. data/lib/byebug/commands/thread/current.rb +11 -11
  53. data/lib/byebug/commands/thread/list.rb +14 -14
  54. data/lib/byebug/commands/thread/resume.rb +14 -14
  55. data/lib/byebug/commands/thread/stop.rb +14 -14
  56. data/lib/byebug/commands/thread/switch.rb +15 -14
  57. data/lib/byebug/commands/tracevar.rb +20 -16
  58. data/lib/byebug/commands/undisplay.rb +22 -18
  59. data/lib/byebug/commands/untracevar.rb +13 -11
  60. data/lib/byebug/commands/up.rb +18 -14
  61. data/lib/byebug/commands/var.rb +10 -3
  62. data/lib/byebug/commands/var/all.rb +15 -13
  63. data/lib/byebug/commands/var/args.rb +37 -0
  64. data/lib/byebug/commands/var/const.rb +25 -14
  65. data/lib/byebug/commands/var/global.rb +13 -11
  66. data/lib/byebug/commands/var/instance.rb +13 -11
  67. data/lib/byebug/commands/var/local.rb +13 -11
  68. data/lib/byebug/commands/where.rb +15 -11
  69. data/lib/byebug/context.rb +71 -73
  70. data/lib/byebug/core.rb +45 -26
  71. data/lib/byebug/errors.rb +27 -0
  72. data/lib/byebug/frame.rb +181 -0
  73. data/lib/byebug/helpers/eval.rb +67 -26
  74. data/lib/byebug/helpers/file.rb +18 -3
  75. data/lib/byebug/helpers/frame.rb +36 -39
  76. data/lib/byebug/helpers/parse.rb +15 -13
  77. data/lib/byebug/helpers/path.rb +21 -0
  78. data/lib/byebug/helpers/reflection.rb +17 -0
  79. data/lib/byebug/helpers/thread.rb +20 -14
  80. data/lib/byebug/helpers/toggle.rb +10 -5
  81. data/lib/byebug/helpers/var.rb +36 -15
  82. data/lib/byebug/interface.rb +27 -9
  83. data/lib/byebug/option_setter.rb +93 -0
  84. data/lib/byebug/printers/base.rb +3 -0
  85. data/lib/byebug/printers/plain.rb +4 -14
  86. data/lib/byebug/printers/texts/base.yml +2 -7
  87. data/lib/byebug/processors/command_processor.rb +101 -102
  88. data/lib/byebug/processors/control_processor.rb +20 -0
  89. data/lib/byebug/processors/post_mortem_processor.rb +16 -0
  90. data/lib/byebug/processors/script_processor.rb +49 -0
  91. data/lib/byebug/remote.rb +13 -7
  92. data/lib/byebug/runner.rb +39 -65
  93. data/lib/byebug/setting.rb +4 -1
  94. data/lib/byebug/settings/post_mortem.rb +0 -16
  95. data/lib/byebug/settings/savefile.rb +1 -4
  96. data/lib/byebug/subcommands.rb +27 -29
  97. data/lib/byebug/version.rb +4 -1
  98. metadata +14 -29
  99. data/lib/byebug/commands/eval.rb +0 -43
  100. data/lib/byebug/commands/info/args.rb +0 -39
  101. data/lib/byebug/commands/info/catch.rb +0 -39
  102. data/lib/byebug/commands/pp.rb +0 -41
  103. data/lib/byebug/commands/putl.rb +0 -43
  104. data/lib/byebug/processor.rb +0 -43
  105. data/lib/byebug/processors/control_command_processor.rb +0 -48
  106. data/lib/byebug/settings/verbose.rb +0 -20
  107. data/lib/byebug/state.rb +0 -12
  108. data/lib/byebug/states/control_state.rb +0 -26
  109. data/lib/byebug/states/regular_state.rb +0 -187
  110. data/lib/byebug/subcommand_list.rb +0 -33
@@ -1,3 +1,6 @@
1
+ #
2
+ # Reopen main module to define the library version
3
+ #
1
4
  module Byebug
2
- VERSION = '5.0.0'
5
+ VERSION = '6.0.0'
3
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: byebug
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rodriguez
@@ -10,22 +10,8 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-05-18 00:00:00.000000000 Z
13
+ date: 2015-08-17 00:00:00.000000000 Z
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: columnize
17
- requirement: !ruby/object:Gem::Requirement
18
- requirements:
19
- - - '='
20
- - !ruby/object:Gem::Version
21
- version: 0.9.0
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- requirements:
26
- - - '='
27
- - !ruby/object:Gem::Version
28
- version: 0.9.0
29
15
  - !ruby/object:Gem::Dependency
30
16
  name: bundler
31
17
  requirement: !ruby/object:Gem::Requirement
@@ -75,6 +61,8 @@ files:
75
61
  - lib/byebug/attacher.rb
76
62
  - lib/byebug/breakpoint.rb
77
63
  - lib/byebug/command.rb
64
+ - lib/byebug/command_list.rb
65
+ - lib/byebug/commands.rb
78
66
  - lib/byebug/commands/break.rb
79
67
  - lib/byebug/commands/catch.rb
80
68
  - lib/byebug/commands/condition.rb
@@ -89,15 +77,12 @@ files:
89
77
  - lib/byebug/commands/enable.rb
90
78
  - lib/byebug/commands/enable/breakpoints.rb
91
79
  - lib/byebug/commands/enable/display.rb
92
- - lib/byebug/commands/eval.rb
93
80
  - lib/byebug/commands/finish.rb
94
81
  - lib/byebug/commands/frame.rb
95
82
  - lib/byebug/commands/help.rb
96
83
  - lib/byebug/commands/history.rb
97
84
  - lib/byebug/commands/info.rb
98
- - lib/byebug/commands/info/args.rb
99
85
  - lib/byebug/commands/info/breakpoints.rb
100
- - lib/byebug/commands/info/catch.rb
101
86
  - lib/byebug/commands/info/display.rb
102
87
  - lib/byebug/commands/info/file.rb
103
88
  - lib/byebug/commands/info/line.rb
@@ -108,10 +93,8 @@ files:
108
93
  - lib/byebug/commands/list.rb
109
94
  - lib/byebug/commands/method.rb
110
95
  - lib/byebug/commands/next.rb
111
- - lib/byebug/commands/pp.rb
112
96
  - lib/byebug/commands/pry.rb
113
97
  - lib/byebug/commands/ps.rb
114
- - lib/byebug/commands/putl.rb
115
98
  - lib/byebug/commands/quit.rb
116
99
  - lib/byebug/commands/restart.rb
117
100
  - lib/byebug/commands/save.rb
@@ -131,6 +114,7 @@ files:
131
114
  - lib/byebug/commands/up.rb
132
115
  - lib/byebug/commands/var.rb
133
116
  - lib/byebug/commands/var/all.rb
117
+ - lib/byebug/commands/var/args.rb
134
118
  - lib/byebug/commands/var/const.rb
135
119
  - lib/byebug/commands/var/global.rb
136
120
  - lib/byebug/commands/var/instance.rb
@@ -138,10 +122,14 @@ files:
138
122
  - lib/byebug/commands/where.rb
139
123
  - lib/byebug/context.rb
140
124
  - lib/byebug/core.rb
125
+ - lib/byebug/errors.rb
126
+ - lib/byebug/frame.rb
141
127
  - lib/byebug/helpers/eval.rb
142
128
  - lib/byebug/helpers/file.rb
143
129
  - lib/byebug/helpers/frame.rb
144
130
  - lib/byebug/helpers/parse.rb
131
+ - lib/byebug/helpers/path.rb
132
+ - lib/byebug/helpers/reflection.rb
145
133
  - lib/byebug/helpers/string.rb
146
134
  - lib/byebug/helpers/thread.rb
147
135
  - lib/byebug/helpers/toggle.rb
@@ -152,13 +140,15 @@ files:
152
140
  - lib/byebug/interfaces/remote_interface.rb
153
141
  - lib/byebug/interfaces/script_interface.rb
154
142
  - lib/byebug/interfaces/test_interface.rb
143
+ - lib/byebug/option_setter.rb
155
144
  - lib/byebug/printers/base.rb
156
145
  - lib/byebug/printers/plain.rb
157
146
  - lib/byebug/printers/texts/base.yml
158
147
  - lib/byebug/printers/texts/plain.yml
159
- - lib/byebug/processor.rb
160
148
  - lib/byebug/processors/command_processor.rb
161
- - lib/byebug/processors/control_command_processor.rb
149
+ - lib/byebug/processors/control_processor.rb
150
+ - lib/byebug/processors/post_mortem_processor.rb
151
+ - lib/byebug/processors/script_processor.rb
162
152
  - lib/byebug/remote.rb
163
153
  - lib/byebug/runner.rb
164
154
  - lib/byebug/setting.rb
@@ -176,12 +166,7 @@ files:
176
166
  - lib/byebug/settings/post_mortem.rb
177
167
  - lib/byebug/settings/savefile.rb
178
168
  - lib/byebug/settings/stack_on_error.rb
179
- - lib/byebug/settings/verbose.rb
180
169
  - lib/byebug/settings/width.rb
181
- - lib/byebug/state.rb
182
- - lib/byebug/states/control_state.rb
183
- - lib/byebug/states/regular_state.rb
184
- - lib/byebug/subcommand_list.rb
185
170
  - lib/byebug/subcommands.rb
186
171
  - lib/byebug/version.rb
187
172
  homepage: http://github.com/deivid-rodriguez/byebug
@@ -204,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
189
  version: '0'
205
190
  requirements: []
206
191
  rubyforge_project:
207
- rubygems_version: 2.4.7
192
+ rubygems_version: 2.4.5
208
193
  signing_key:
209
194
  specification_version: 4
210
195
  summary: Ruby 2.0 fast debugger - base + CLI
@@ -1,43 +0,0 @@
1
- require 'English'
2
- require 'byebug/command'
3
- require 'byebug/helpers/eval'
4
-
5
- module Byebug
6
- #
7
- # Evaluation of expressions from byebug's prompt.
8
- #
9
- class EvalCommand < Command
10
- include Helpers::EvalHelper
11
-
12
- def match(input)
13
- @input = input
14
- super
15
- end
16
-
17
- def regexp
18
- /^\s* e(?:val)? \s+/x
19
- end
20
-
21
- def execute
22
- expr = @match ? @match.post_match : @input
23
- run_with_binding do |b|
24
- res = eval_with_setting(b, expr, Setting[:stack_on_error])
25
-
26
- print pr('eval.result', expr: expr, result: res.inspect)
27
- end
28
- rescue
29
- puts "#{$ERROR_INFO.class} Exception: #{$ERROR_INFO.message}"
30
- end
31
-
32
- def description
33
- <<-EOD
34
- e[val] <expression>
35
-
36
- Evaluates <expression> and prints its value.
37
-
38
- * NOTE - unknown input is automatically evaluated, to turn this off use
39
- 'set noautoeval'.
40
- EOD
41
- end
42
- end
43
- end
@@ -1,39 +0,0 @@
1
- module Byebug
2
- #
3
- # Reopens the +info+ command to define the +args+ subcommand
4
- #
5
- class InfoCommand < Command
6
- #
7
- # Information about arguments of the current method/block
8
- #
9
- class ArgsSubcommand < Command
10
- def regexp
11
- /^\s* a(?:rgs)? \s*$/x
12
- end
13
-
14
- def execute
15
- locals = @state.context.frame_locals
16
- args = @state.context.frame_args
17
- return if args == [[:rest]]
18
-
19
- args.map do |_, name|
20
- s = "#{name} = #{locals[name].inspect}"
21
- s[Setting[:width] - 3..-1] = '...' if s.size > Setting[:width]
22
- puts s
23
- end
24
- end
25
-
26
- def short_description
27
- 'Information about arguments of the current method/block'
28
- end
29
-
30
- def description
31
- <<-EOD
32
- inf[o] a[args]
33
-
34
- #{short_description}
35
- EOD
36
- end
37
- end
38
- end
39
- end
@@ -1,39 +0,0 @@
1
- module Byebug
2
- #
3
- # Reopens the +info+ command to define the +catch+ subcommand
4
- #
5
- class InfoCommand < Command
6
- #
7
- # Information on exceptions that can be caught by the debugger
8
- #
9
- class CatchSubcommand < Command
10
- def regexp
11
- /^\s* c(?:atch)? (?:\s+ (.+))? \s*$/x
12
- end
13
-
14
- def execute
15
- return puts('No frame selected.') unless @state.context
16
-
17
- if Byebug.catchpoints && !Byebug.catchpoints.empty?
18
- Byebug.catchpoints.each do |exception, _hits|
19
- puts("#{exception}: #{exception.is_a?(Class)}")
20
- end
21
- else
22
- puts 'No exceptions set to be caught.'
23
- end
24
- end
25
-
26
- def short_description
27
- 'Exceptions that can be caught in the current stack frame'
28
- end
29
-
30
- def description
31
- <<-EOD
32
- inf[o] c[atch]
33
-
34
- #{short_description}
35
- EOD
36
- end
37
- end
38
- end
39
- end
@@ -1,41 +0,0 @@
1
- require 'English'
2
- require 'pp'
3
- require 'byebug/command'
4
- require 'byebug/helpers/eval'
5
-
6
- module Byebug
7
- #
8
- # Evaluation and pretty printing from byebug's prompt.
9
- #
10
- class PpCommand < Command
11
- include Helpers::EvalHelper
12
-
13
- self.allow_in_control = true
14
-
15
- def regexp
16
- /^\s* pp \s+/x
17
- end
18
-
19
- def execute
20
- out = StringIO.new
21
- run_with_binding do |b|
22
- if Setting[:stack_on_error]
23
- PP.pp(bb_eval(@match.post_match, b), out)
24
- else
25
- PP.pp(bb_warning_eval(@match.post_match, b), out)
26
- end
27
- end
28
- puts out.string
29
- rescue
30
- out.puts $ERROR_INFO.message
31
- end
32
-
33
- def description
34
- <<-EOD
35
- pp <expression>
36
-
37
- Evaluates <expression> and pretty-prints its value.
38
- EOD
39
- end
40
- end
41
- end
@@ -1,43 +0,0 @@
1
- require 'pp'
2
- require 'byebug/command'
3
- require 'byebug/helpers/eval'
4
-
5
- module Byebug
6
- #
7
- # Evaluation, pretty printing and columnizing from byebug's prompt.
8
- #
9
- class PutlCommand < Command
10
- include Helpers::EvalHelper
11
- include Columnize
12
-
13
- self.allow_in_control = true
14
-
15
- def regexp
16
- /^\s* putl (?:\s+ (.+))? \s*$/x
17
- end
18
-
19
- def execute
20
- out = StringIO.new
21
- run_with_binding do |b|
22
- res = eval_with_setting(b, @match[1], Setting[:stack_on_error])
23
-
24
- if res.is_a?(Array)
25
- puts "#{columnize(res.map(&:to_s), Setting[:width])}"
26
- else
27
- PP.pp(res, out)
28
- puts out.string
29
- end
30
- end
31
- rescue
32
- out.puts $ERROR_INFO.message
33
- end
34
-
35
- def description
36
- <<-EOD
37
- putl <expression>
38
-
39
- Evaluates <expression>, an array, and columnize its value.
40
- EOD
41
- end
42
- end
43
- end
@@ -1,43 +0,0 @@
1
- require 'forwardable'
2
-
3
- module Byebug
4
- class Processor
5
- attr_accessor :interface
6
-
7
- extend Forwardable
8
- def_delegators :@interface, :errmsg, :puts
9
-
10
- def initialize(interface)
11
- @interface = interface
12
- end
13
-
14
- def without_exceptions
15
- yield
16
- rescue
17
- nil
18
- end
19
-
20
- def self.load_commands
21
- Dir.glob(File.expand_path('../commands/*.rb', __FILE__)).each do |file|
22
- require file
23
- end
24
- end
25
-
26
- def self.load_settings
27
- Dir.glob(File.expand_path('../settings/*.rb', __FILE__)).each do |file|
28
- require file
29
- end
30
-
31
- Byebug.constants.grep(/[a-z]Setting/).map do |name|
32
- setting = Byebug.const_get(name).new
33
- Byebug::Setting.settings[setting.to_sym] = setting
34
- end
35
- end
36
- end
37
-
38
- Processor.load_commands
39
- Processor.load_settings
40
- end
41
-
42
- require 'byebug/processors/command_processor'
43
- require 'byebug/processors/control_command_processor'
@@ -1,48 +0,0 @@
1
- require 'byebug/states/control_state'
2
-
3
- module Byebug
4
- #
5
- # Processes commands in 'control' mode, when there's no program running
6
- #
7
- class ControlCommandProcessor < Processor
8
- attr_reader :state
9
-
10
- def initialize(interface = LocalInterface.new)
11
- super(interface)
12
- end
13
-
14
- def commands
15
- Byebug.commands.select(&:allow_in_control).map { |cmd| cmd.new(state) }
16
- end
17
-
18
- def process_commands
19
- @state = ControlState.new(interface)
20
-
21
- while (input = @interface.read_command(prompt(nil)))
22
- cmd = commands.find { |c| c.match(input) }
23
- unless cmd
24
- errmsg('Unknown command')
25
- next
26
- end
27
-
28
- cmd.execute
29
- end
30
-
31
- @interface.close
32
- rescue IOError, SystemCallError
33
- @interface.close
34
- rescue
35
- without_exceptions do
36
- puts "INTERNAL ERROR!!! #{$ERROR_INFO}"
37
- puts $ERROR_INFO.backtrace.map { |l| "\t#{l}" }.join("\n")
38
- end
39
- end
40
-
41
- #
42
- # Prompt shown before reading a command.
43
- #
44
- def prompt(_context)
45
- '(byebug:ctrl) '
46
- end
47
- end
48
- end
@@ -1,20 +0,0 @@
1
- require 'byebug/setting'
2
-
3
- module Byebug
4
- #
5
- # Setting to show verbose output about TracePoint API events.
6
- #
7
- class VerboseSetting < Setting
8
- def banner
9
- 'Enable verbose output of TracePoint API events'
10
- end
11
-
12
- def value=(v)
13
- Byebug.verbose = v
14
- end
15
-
16
- def value
17
- Byebug.verbose?
18
- end
19
- end
20
- end