ruby2: next command not stepping to next line
willbryant opened this issue · 5 comments
The "next" command used to reliably step over the calls in the current line, leaving you on the next line. Now debugger seems to step into some methods when you use it.
For example, here it's stepped inside the #exceptions method, which happens to be an ActiveRecord attribute method; it doesn't step inside #empty? though, so it sometimes works.
(I've removed some lines of our real code from this backtrace)
[1239, 1248] in /Users/will/powershop/powershop/app/models/billing.rb
1242 end
1243 debugger
=> 1244 if exceptions.empty?
1245 self.exceptions = nil
(rdb:1) exceptions
{}
(rdb:1) n
/Users/will/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/rails-7e46c20753a4/activerecord/lib/active_record/attribute_methods/read.rb:72
#{internal_attribute_access_code(attr_name, attribute_cast_code(attr_name))}
[67, 76] in /Users/will/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/rails-7e46c20753a4/activerecord/lib/active_record/attribute_methods/read.rb
67 # we first define with the __temp__ identifier, and then use alias method to
68 # rename it to what we want.
69 def define_method_attribute(attr_name)
70 generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1
71 def __temp__
=> 72 #{internal_attribute_access_code(attr_name, attribute_cast_code(attr_name))}
73 end
74 alias_method '#{attr_name}', :__temp__
75 undef_method :__temp__
76 STR
(rdb:1) n
/Users/will/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/rails-7e46c20753a4/activerecord/lib/active_record/attribute_methods/serialization.rb:15
state == :serialized ? unserialize : value
[10, 19] in /Users/will/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/rails-7e46c20753a4/activerecord/lib/active_record/attribute_methods/serialization.rb
10 self.serialized_attributes = {}
11 end
12
13 class Attribute < Struct.new(:coder, :value, :state)
14 def unserialized_value
=> 15 state == :serialized ? unserialize : value
16 end
17
18 def serialized_value
19 state == :unserialized ? serialize : value
(rdb:1) n
/Users/will/powershop/powershop/app/models/billing.rb:1245
self.exceptions = nil
[1240, 1249] in /Users/will/powershop/powershop/app/models/billing.rb
1242 end
1243 debugger
1244 if exceptions.empty?
=> 1245 self.exceptions = nil
1246 .. more code here ..
As stated in the readme , 2.0 isn't fully working. See #47 and #69 for context. More work needs to be done to port debugger to support 2.0.
I will leave this open for others who encounter this until 2.0 support comes. I encourage anyone to work on this and the prerequisite tickets as I don't have the bandwidth or the need.
As an alternative, I have been using the byebug debugger, which doesn't have this issue.
@cldwalker Any improvement on full ruby 2.0 support ? Especially for this next / step issue ?
I believe byebug will become the default debugger for many developers in the short term if the debugger gem does not fix this ...
@bartocc I rarely use ruby at work so this is prioritized accordingly. If you've read the above links to #47 and #69, then you're aware I've put a call out to the community. So far the community has responded with partial support and a pseudo-fork with byebug. If you're interested in this, please contribute or encourage others to do so.
Closing since I'm scoping debugger to just 1.9.2 and 1.9.3. For more see #125 (comment)