Debugging breaks on Rails's "break" in ActiveSupport::Callbacks.run
Ruby-debug is getting hung up by breaking on the "break" ruby reserved word on line 94 activesupport-2.3.5/lib/active_support/callbacks.rb.
def run(object, options = {}, &terminator)
enumerator = options[:enumerator] || :each
unless block_given?
send(enumerator) { |callback| callback.call(object) }
else
send(enumerator) do |callback|
result = callback.call(object)
break result if terminator.call(result, object) # This line is the culprit
end
end
end
I know break is a reserved word in Ruby and I'm surpirsed that the ruby-debug is breaking on the word "break" for each ActiveSupport callback. This has rendered almost all of my debugging useless as the callback is triggered very frequently. I am no longer able to run any of my rspec tests as the callback breakpoint is triggered many times for each spec.
Here is a list of all of my currently installed gems: http://pastie.org/854538
Update: I tried removing ruby-debug and ruby-debug-base and now I get the following message when ever I run my specs. I am reinstalling these gems as I need them.
debugger statement ignored, use -u or --debugger 开发者_开发问答option on rspec to enable debugging
I do not know how to get around this. Any ideas?
I found out why this is happening. I looked at what method was responsible for triggering the callback and I realized it was one of my own with a "debugger" break point in it. I was just confusing to see the debugger break in ActiveSupport::Callbacks. My debugger break point was at the last line of the method so the debugger naturally went to the next executable line which was in ActiveSupport::Callbacks.run. Thanks Igal for the help with this.
精彩评论