byebug 3.5.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -1
  3. data/.rubocop.yml +18 -1
  4. data/.travis.yml +21 -1
  5. data/CHANGELOG.md +356 -308
  6. data/CONTRIBUTING.md +31 -15
  7. data/GUIDE.md +859 -475
  8. data/Gemfile +8 -10
  9. data/LICENSE +1 -1
  10. data/README.md +41 -45
  11. data/Rakefile +30 -28
  12. data/byebug.gemspec +18 -18
  13. data/ext/byebug/breakpoint.c +88 -75
  14. data/ext/byebug/byebug.c +253 -252
  15. data/ext/byebug/byebug.h +53 -53
  16. data/ext/byebug/context.c +188 -159
  17. data/ext/byebug/extconf.rb +9 -6
  18. data/ext/byebug/locker.c +53 -11
  19. data/ext/byebug/threads.c +137 -39
  20. data/lib/byebug/attacher.rb +7 -2
  21. data/lib/byebug/breakpoint.rb +30 -0
  22. data/lib/byebug/command.rb +36 -32
  23. data/lib/byebug/commands/break.rb +49 -48
  24. data/lib/byebug/commands/catch.rb +64 -0
  25. data/lib/byebug/commands/condition.rb +13 -9
  26. data/lib/byebug/commands/continue.rb +8 -4
  27. data/lib/byebug/commands/delete.rb +10 -4
  28. data/lib/byebug/commands/display.rb +33 -25
  29. data/lib/byebug/commands/edit.rb +18 -13
  30. data/lib/byebug/commands/enable_disable.rb +26 -24
  31. data/lib/byebug/commands/eval.rb +77 -35
  32. data/lib/byebug/commands/finish.rb +9 -5
  33. data/lib/byebug/commands/frame.rb +66 -125
  34. data/lib/byebug/commands/help.rb +14 -21
  35. data/lib/byebug/commands/history.rb +5 -1
  36. data/lib/byebug/commands/info.rb +41 -106
  37. data/lib/byebug/commands/interrupt.rb +6 -2
  38. data/lib/byebug/commands/irb.rb +5 -2
  39. data/lib/byebug/commands/kill.rb +6 -2
  40. data/lib/byebug/commands/list.rb +21 -14
  41. data/lib/byebug/commands/method.rb +17 -9
  42. data/lib/byebug/commands/pry.rb +13 -3
  43. data/lib/byebug/commands/quit.rb +10 -5
  44. data/lib/byebug/commands/restart.rb +12 -19
  45. data/lib/byebug/commands/save.rb +10 -6
  46. data/lib/byebug/commands/set.rb +15 -14
  47. data/lib/byebug/commands/show.rb +8 -8
  48. data/lib/byebug/commands/source.rb +14 -8
  49. data/lib/byebug/commands/stepping.rb +15 -29
  50. data/lib/byebug/commands/threads.rb +73 -49
  51. data/lib/byebug/commands/tracevar.rb +56 -0
  52. data/lib/byebug/commands/undisplay.rb +8 -4
  53. data/lib/byebug/commands/untracevar.rb +38 -0
  54. data/lib/byebug/commands/var.rb +107 -0
  55. data/lib/byebug/context.rb +78 -42
  56. data/lib/byebug/core.rb +78 -40
  57. data/lib/byebug/helper.rb +58 -42
  58. data/lib/byebug/history.rb +12 -1
  59. data/lib/byebug/interface.rb +91 -11
  60. data/lib/byebug/interfaces/local_interface.rb +12 -19
  61. data/lib/byebug/interfaces/remote_interface.rb +12 -15
  62. data/lib/byebug/interfaces/script_interface.rb +14 -18
  63. data/lib/byebug/interfaces/test_interface.rb +54 -0
  64. data/lib/byebug/printers/base.rb +64 -0
  65. data/lib/byebug/printers/plain.rb +53 -0
  66. data/lib/byebug/processor.rb +20 -1
  67. data/lib/byebug/processors/command_processor.rb +57 -172
  68. data/lib/byebug/processors/control_command_processor.rb +16 -43
  69. data/lib/byebug/remote.rb +13 -7
  70. data/lib/byebug/runner.rb +102 -54
  71. data/lib/byebug/setting.rb +45 -68
  72. data/lib/byebug/settings/autoeval.rb +2 -0
  73. data/lib/byebug/settings/autoirb.rb +3 -0
  74. data/lib/byebug/settings/autolist.rb +3 -0
  75. data/lib/byebug/settings/autosave.rb +2 -0
  76. data/lib/byebug/settings/basename.rb +2 -0
  77. data/lib/byebug/settings/callstyle.rb +2 -0
  78. data/lib/byebug/settings/fullpath.rb +2 -0
  79. data/lib/byebug/settings/histfile.rb +2 -0
  80. data/lib/byebug/settings/histsize.rb +2 -0
  81. data/lib/byebug/settings/linetrace.rb +2 -0
  82. data/lib/byebug/settings/listsize.rb +2 -0
  83. data/lib/byebug/settings/post_mortem.rb +7 -2
  84. data/lib/byebug/settings/stack_on_error.rb +2 -0
  85. data/lib/byebug/settings/verbose.rb +2 -0
  86. data/lib/byebug/settings/width.rb +2 -0
  87. data/lib/byebug/state.rb +12 -0
  88. data/lib/byebug/states/control_state.rb +26 -0
  89. data/lib/byebug/states/regular_state.rb +178 -0
  90. data/lib/byebug/version.rb +1 -1
  91. metadata +24 -109
  92. data/lib/byebug/commands/catchpoint.rb +0 -53
  93. data/lib/byebug/commands/reload.rb +0 -29
  94. data/lib/byebug/commands/trace.rb +0 -50
  95. data/lib/byebug/commands/variables.rb +0 -206
  96. data/lib/byebug/options.rb +0 -46
  97. data/lib/byebug/settings/autoreload.rb +0 -12
  98. data/lib/byebug/settings/forcestep.rb +0 -14
  99. data/lib/byebug/settings/testing.rb +0 -12
  100. data/lib/byebug/settings/tracing_plus.rb +0 -11
  101. data/test/commands/break_test.rb +0 -364
  102. data/test/commands/condition_test.rb +0 -85
  103. data/test/commands/continue_test.rb +0 -47
  104. data/test/commands/delete_test.rb +0 -26
  105. data/test/commands/display_test.rb +0 -37
  106. data/test/commands/edit_test.rb +0 -52
  107. data/test/commands/eval_test.rb +0 -89
  108. data/test/commands/finish_test.rb +0 -74
  109. data/test/commands/frame_test.rb +0 -223
  110. data/test/commands/help_test.rb +0 -66
  111. data/test/commands/history_test.rb +0 -61
  112. data/test/commands/info_test.rb +0 -238
  113. data/test/commands/interrupt_test.rb +0 -45
  114. data/test/commands/irb_test.rb +0 -28
  115. data/test/commands/kill_test.rb +0 -50
  116. data/test/commands/list_test.rb +0 -174
  117. data/test/commands/method_test.rb +0 -52
  118. data/test/commands/post_mortem_test.rb +0 -71
  119. data/test/commands/pry_test.rb +0 -26
  120. data/test/commands/quit_test.rb +0 -53
  121. data/test/commands/reload_test.rb +0 -39
  122. data/test/commands/restart_test.rb +0 -46
  123. data/test/commands/save_test.rb +0 -67
  124. data/test/commands/set_test.rb +0 -140
  125. data/test/commands/show_test.rb +0 -76
  126. data/test/commands/source_test.rb +0 -46
  127. data/test/commands/stepping_test.rb +0 -192
  128. data/test/commands/thread_test.rb +0 -164
  129. data/test/commands/trace_test.rb +0 -71
  130. data/test/commands/undisplay_test.rb +0 -75
  131. data/test/commands/variables_test.rb +0 -105
  132. data/test/debugger_alias_test.rb +0 -7
  133. data/test/runner_test.rb +0 -150
  134. data/test/support/matchers.rb +0 -65
  135. data/test/support/test_interface.rb +0 -59
  136. data/test/support/utils.rb +0 -122
  137. data/test/test_helper.rb +0 -58
@@ -1,3 +1,5 @@
1
+ require 'byebug/setting'
2
+
1
3
  module Byebug
2
4
  #
3
5
  # Setting to customize the maximum width of byebug's output.
@@ -0,0 +1,12 @@
1
+ module Byebug
2
+ #
3
+ # Common parent class for all of Byebug's states
4
+ #
5
+ class State
6
+ attr_reader :interface
7
+
8
+ def initialize(interface)
9
+ @interface = interface
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,26 @@
1
+ require 'byebug/state'
2
+
3
+ module Byebug
4
+ #
5
+ # Controls state of Byebug's REPL when in control mode
6
+ #
7
+ class ControlState < State
8
+ def proceed
9
+ end
10
+
11
+ extend Forwardable
12
+ def_delegators :@interface, :errmsg, :puts
13
+
14
+ def confirm(*_args)
15
+ 'y'
16
+ end
17
+
18
+ def context
19
+ nil
20
+ end
21
+
22
+ def file
23
+ errmsg 'No filename given.'
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,178 @@
1
+ require 'byebug/state'
2
+
3
+ module Byebug
4
+ #
5
+ # Controls state of Byebug's REPL when in normal mode
6
+ #
7
+ class RegularState < State
8
+ attr_accessor :context, :frame, :display, :file, :line, :prev_line
9
+ attr_writer :interface
10
+
11
+ def initialize(context, display, file, interface, line)
12
+ super(interface)
13
+ @context = context
14
+ @display = display
15
+ @file = file
16
+ @frame = 0
17
+ @line = line
18
+ @prev_line = nil
19
+ @proceed = false
20
+ end
21
+
22
+ extend Forwardable
23
+ def_delegators :@interface, :errmsg, :puts, :print, :confirm
24
+
25
+ #
26
+ # Checks whether that execution can proceed
27
+ #
28
+ def proceed?
29
+ @proceed
30
+ end
31
+
32
+ #
33
+ # Signals the REPL that the execution can proceed
34
+ #
35
+ def proceed
36
+ @proceed = true
37
+ end
38
+
39
+ include FileFunctions
40
+ #
41
+ # Current (formatted) location
42
+ #
43
+ def location
44
+ l = "#{normalize(file)} @ #{line}\n"
45
+ l += "#{get_line(file, line)}\n" unless %w((irb) -e').include?(file)
46
+ l
47
+ end
48
+
49
+ #
50
+ # Builds a string containing the class associated to frame number +pos+
51
+ # or an empty string if the current +callstyle+ setting is 'short'
52
+ #
53
+ # @param pos [Integer] Frame position.
54
+ #
55
+ def frame_class(pos)
56
+ return '' if Setting[:callstyle] == 'short'
57
+
58
+ klass = context.frame_class(pos)
59
+ return '' if klass.to_s.empty?
60
+
61
+ "#{klass}."
62
+ end
63
+
64
+ #
65
+ # Builds a formatted string containing information about block and method
66
+ # of the frame in position +pos+
67
+ #
68
+ # @param pos [Integer] Frame position.
69
+ #
70
+ def frame_block_and_method(pos)
71
+ deco_regexp = /((?:block(?: \(\d+ levels\))?|rescue) in )?(.+)/
72
+ deco_method = "#{context.frame_method(pos)}"
73
+ block_and_method = deco_regexp.match(deco_method)[1..2]
74
+ block_and_method.map { |x| x.nil? ? '' : x }
75
+ end
76
+
77
+ #
78
+ # Builds a string containing all available args in frame number +pos+, in a
79
+ # verbose or non verbose way according to the value of the +callstyle+
80
+ # setting
81
+ #
82
+ # @param pos [Integer] Frame position.
83
+ #
84
+ def frame_args(pos)
85
+ args = context.frame_args(pos)
86
+ return '' if args.empty?
87
+
88
+ locals = context.frame_locals(pos) unless Setting[:callstyle] == 'short'
89
+ my_args = args.map do |arg|
90
+ case arg[0]
91
+ when :block then prefix, default = '&', 'block'
92
+ when :rest then prefix, default = '*', 'args'
93
+ else prefix, default = '', nil
94
+ end
95
+
96
+ kls = if Setting[:callstyle] == 'short' || arg[1].nil? || locals.empty?
97
+ ''
98
+ else
99
+ "##{locals[arg[1]].class}"
100
+ end
101
+
102
+ "#{prefix}#{arg[1] || default}#{kls}"
103
+ end
104
+
105
+ "(#{my_args.join(', ')})"
106
+ end
107
+
108
+ #
109
+ # Builds a formatted string containing information about current method
110
+ # call in frame number +pos+.
111
+ #
112
+ # @param pos [Integer] Frame position.
113
+ #
114
+ def frame_call(pos)
115
+ block, method = frame_block_and_method(pos)
116
+
117
+ block + frame_class(pos) + method + frame_args(pos)
118
+ end
119
+
120
+ #
121
+ # Formatted filename in frame number +pos+
122
+ #
123
+ # @param pos [Integer] Frame position.
124
+ #
125
+ def frame_file(pos)
126
+ fullpath = context.frame_file(pos)
127
+ Setting[:fullpath] ? fullpath : shortpath(fullpath)
128
+ end
129
+
130
+ #
131
+ # Line number in frame number +pos+
132
+ #
133
+ # @param pos [Integer] Frame position.
134
+ #
135
+ def frame_line(pos)
136
+ context.frame_line(pos)
137
+ end
138
+
139
+ #
140
+ # Properly formatted frame number of frame in position +pos+
141
+ #
142
+ # @param pos [Integer] Frame position.
143
+ #
144
+ def frame_pos(pos)
145
+ format('%-2d', pos)
146
+ end
147
+
148
+ #
149
+ # Formatted mark for number of frame in position +pos+. The mark can
150
+ # contain the current frame symbo (-->), the c_frame symbol (ͱ--) or both
151
+ #
152
+ # @param pos [Integer] Frame position.
153
+ #
154
+ def frame_mark(pos)
155
+ mark = frame == pos ? '-->' : ' '
156
+
157
+ c_frame?(pos) ? mark + ' ͱ--' : mark
158
+ end
159
+
160
+ #
161
+ # Checks whether the frame in position +pos+ is a c-frame or not
162
+ #
163
+ # @param pos [Integer] Frame position.
164
+ #
165
+ def c_frame?(pos)
166
+ context.frame_binding(pos).nil?
167
+ end
168
+
169
+ private
170
+
171
+ def shortpath(fullpath)
172
+ components = Pathname(fullpath).each_filename.to_a
173
+ return fullpath if components.size <= 2
174
+
175
+ File.join('...', components[-3..-1])
176
+ end
177
+ end
178
+ end
@@ -1,3 +1,3 @@
1
1
  module Byebug
2
- VERSION = '3.5.1'
2
+ VERSION = '4.0.0'
3
3
  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: 3.5.1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rodriguez
@@ -10,50 +10,36 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-09-29 00:00:00.000000000 Z
13
+ date: 2015-03-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: columnize
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - "~>"
20
- - !ruby/object:Gem::Version
21
- version: '0.8'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- requirements:
26
- - - "~>"
27
- - !ruby/object:Gem::Version
28
- version: '0.8'
29
- - !ruby/object:Gem::Dependency
30
- name: slop
31
- requirement: !ruby/object:Gem::Requirement
32
- requirements:
33
- - - "~>"
19
+ - - '='
34
20
  - !ruby/object:Gem::Version
35
- version: '3.6'
21
+ version: 0.9.0
36
22
  type: :runtime
37
23
  prerelease: false
38
24
  version_requirements: !ruby/object:Gem::Requirement
39
25
  requirements:
40
- - - "~>"
26
+ - - '='
41
27
  - !ruby/object:Gem::Version
42
- version: '3.6'
28
+ version: 0.9.0
43
29
  - !ruby/object:Gem::Dependency
44
- name: debugger-linecache
30
+ name: bundler
45
31
  requirement: !ruby/object:Gem::Requirement
46
32
  requirements:
47
33
  - - "~>"
48
34
  - !ruby/object:Gem::Version
49
- version: '1.2'
50
- type: :runtime
35
+ version: '1.7'
36
+ type: :development
51
37
  prerelease: false
52
38
  version_requirements: !ruby/object:Gem::Requirement
53
39
  requirements:
54
40
  - - "~>"
55
41
  - !ruby/object:Gem::Version
56
- version: '1.2'
42
+ version: '1.7'
57
43
  description: |-
58
44
  Byebug is a Ruby 2 debugger. It's implemented using the
59
45
  Ruby 2 TracePoint C API for execution control and the Debug Inspector C API
@@ -67,6 +53,8 @@ executables:
67
53
  extensions:
68
54
  - ext/byebug/extconf.rb
69
55
  extra_rdoc_files:
56
+ - CHANGELOG.md
57
+ - CONTRIBUTING.md
70
58
  - README.md
71
59
  - GUIDE.md
72
60
  files:
@@ -94,7 +82,7 @@ files:
94
82
  - lib/byebug/breakpoint.rb
95
83
  - lib/byebug/command.rb
96
84
  - lib/byebug/commands/break.rb
97
- - lib/byebug/commands/catchpoint.rb
85
+ - lib/byebug/commands/catch.rb
98
86
  - lib/byebug/commands/condition.rb
99
87
  - lib/byebug/commands/continue.rb
100
88
  - lib/byebug/commands/delete.rb
@@ -114,7 +102,6 @@ files:
114
102
  - lib/byebug/commands/method.rb
115
103
  - lib/byebug/commands/pry.rb
116
104
  - lib/byebug/commands/quit.rb
117
- - lib/byebug/commands/reload.rb
118
105
  - lib/byebug/commands/restart.rb
119
106
  - lib/byebug/commands/save.rb
120
107
  - lib/byebug/commands/set.rb
@@ -122,9 +109,10 @@ files:
122
109
  - lib/byebug/commands/source.rb
123
110
  - lib/byebug/commands/stepping.rb
124
111
  - lib/byebug/commands/threads.rb
125
- - lib/byebug/commands/trace.rb
112
+ - lib/byebug/commands/tracevar.rb
126
113
  - lib/byebug/commands/undisplay.rb
127
- - lib/byebug/commands/variables.rb
114
+ - lib/byebug/commands/untracevar.rb
115
+ - lib/byebug/commands/var.rb
128
116
  - lib/byebug/context.rb
129
117
  - lib/byebug/core.rb
130
118
  - lib/byebug/helper.rb
@@ -133,7 +121,9 @@ files:
133
121
  - lib/byebug/interfaces/local_interface.rb
134
122
  - lib/byebug/interfaces/remote_interface.rb
135
123
  - lib/byebug/interfaces/script_interface.rb
136
- - lib/byebug/options.rb
124
+ - lib/byebug/interfaces/test_interface.rb
125
+ - lib/byebug/printers/base.rb
126
+ - lib/byebug/printers/plain.rb
137
127
  - lib/byebug/processor.rb
138
128
  - lib/byebug/processors/command_processor.rb
139
129
  - lib/byebug/processors/control_command_processor.rb
@@ -143,11 +133,9 @@ files:
143
133
  - lib/byebug/settings/autoeval.rb
144
134
  - lib/byebug/settings/autoirb.rb
145
135
  - lib/byebug/settings/autolist.rb
146
- - lib/byebug/settings/autoreload.rb
147
136
  - lib/byebug/settings/autosave.rb
148
137
  - lib/byebug/settings/basename.rb
149
138
  - lib/byebug/settings/callstyle.rb
150
- - lib/byebug/settings/forcestep.rb
151
139
  - lib/byebug/settings/fullpath.rb
152
140
  - lib/byebug/settings/histfile.rb
153
141
  - lib/byebug/settings/histsize.rb
@@ -155,48 +143,12 @@ files:
155
143
  - lib/byebug/settings/listsize.rb
156
144
  - lib/byebug/settings/post_mortem.rb
157
145
  - lib/byebug/settings/stack_on_error.rb
158
- - lib/byebug/settings/testing.rb
159
- - lib/byebug/settings/tracing_plus.rb
160
146
  - lib/byebug/settings/verbose.rb
161
147
  - lib/byebug/settings/width.rb
148
+ - lib/byebug/state.rb
149
+ - lib/byebug/states/control_state.rb
150
+ - lib/byebug/states/regular_state.rb
162
151
  - lib/byebug/version.rb
163
- - test/commands/break_test.rb
164
- - test/commands/condition_test.rb
165
- - test/commands/continue_test.rb
166
- - test/commands/delete_test.rb
167
- - test/commands/display_test.rb
168
- - test/commands/edit_test.rb
169
- - test/commands/eval_test.rb
170
- - test/commands/finish_test.rb
171
- - test/commands/frame_test.rb
172
- - test/commands/help_test.rb
173
- - test/commands/history_test.rb
174
- - test/commands/info_test.rb
175
- - test/commands/interrupt_test.rb
176
- - test/commands/irb_test.rb
177
- - test/commands/kill_test.rb
178
- - test/commands/list_test.rb
179
- - test/commands/method_test.rb
180
- - test/commands/post_mortem_test.rb
181
- - test/commands/pry_test.rb
182
- - test/commands/quit_test.rb
183
- - test/commands/reload_test.rb
184
- - test/commands/restart_test.rb
185
- - test/commands/save_test.rb
186
- - test/commands/set_test.rb
187
- - test/commands/show_test.rb
188
- - test/commands/source_test.rb
189
- - test/commands/stepping_test.rb
190
- - test/commands/thread_test.rb
191
- - test/commands/trace_test.rb
192
- - test/commands/undisplay_test.rb
193
- - test/commands/variables_test.rb
194
- - test/debugger_alias_test.rb
195
- - test/runner_test.rb
196
- - test/support/matchers.rb
197
- - test/support/test_interface.rb
198
- - test/support/utils.rb
199
- - test/test_helper.rb
200
152
  homepage: http://github.com/deivid-rodriguez/byebug
201
153
  licenses:
202
154
  - BSD
@@ -217,45 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
169
  version: '0'
218
170
  requirements: []
219
171
  rubyforge_project:
220
- rubygems_version: 2.2.2
172
+ rubygems_version: 2.4.6
221
173
  signing_key:
222
174
  specification_version: 4
223
175
  summary: Ruby 2.0 fast debugger - base + CLI
224
- test_files:
225
- - test/commands/break_test.rb
226
- - test/commands/condition_test.rb
227
- - test/commands/continue_test.rb
228
- - test/commands/delete_test.rb
229
- - test/commands/display_test.rb
230
- - test/commands/edit_test.rb
231
- - test/commands/eval_test.rb
232
- - test/commands/finish_test.rb
233
- - test/commands/frame_test.rb
234
- - test/commands/help_test.rb
235
- - test/commands/history_test.rb
236
- - test/commands/info_test.rb
237
- - test/commands/interrupt_test.rb
238
- - test/commands/irb_test.rb
239
- - test/commands/kill_test.rb
240
- - test/commands/list_test.rb
241
- - test/commands/method_test.rb
242
- - test/commands/post_mortem_test.rb
243
- - test/commands/pry_test.rb
244
- - test/commands/quit_test.rb
245
- - test/commands/reload_test.rb
246
- - test/commands/restart_test.rb
247
- - test/commands/save_test.rb
248
- - test/commands/set_test.rb
249
- - test/commands/show_test.rb
250
- - test/commands/source_test.rb
251
- - test/commands/stepping_test.rb
252
- - test/commands/thread_test.rb
253
- - test/commands/trace_test.rb
254
- - test/commands/undisplay_test.rb
255
- - test/commands/variables_test.rb
256
- - test/debugger_alias_test.rb
257
- - test/runner_test.rb
258
- - test/support/matchers.rb
259
- - test/support/test_interface.rb
260
- - test/support/utils.rb
261
- - test/test_helper.rb
176
+ test_files: []