call_stack 0.1.0: making ruby-breakpoint/Rails’ breakpointer work with Ruby 1.8.5
Ruby 1.8.5 has been out for a couple weeks and broke Binding.of_caller and Rail’s breakpointer. I’d promised I’d provide a workaround, and I finally wrapped it up.
I’ve just released call_stack: backtrace data and 1.8.5-safe breakpoint/Binding.of_caller, which provides an alternative Binding.of_caller implementation and some additional functionality to obtain backtrace information (the “call stack”). You can override a pre-existent binding_of_caller.rb by loading breakpoint185.rb:
ruby -rbreakpoint185 myapp.rb
Here’s how you’d use it with Rails’ breakpointer:
- put the breakpoint calls in the code you’re inspecting, as usual
- start the “breakpointer” as usual with script/breakpointer
- run the application with ruby -rbreakpoint185 script/server
RubyGems caveats
If you’ve installed call_stack with RubyGems, -rbreakpoint185 will not work (RubyGems cannot handle -rlib options passed to ruby yet), and you’ll have to do something like:
ruby -e "require 'breakpoint185'; load 'script/server'"
(assuming you’ve set RUBYOPT=-rubygems, otherwise prepend it to the above line or add require ‘rubygems’)
Word of caution
Loading breakpoint185 will slow down your application a bit, since it uses a C event hook to record the binding and additional information on each method call, so it should only be used when debugging/inspecting some code.
call_stack was built with bits of code from an abandonned rcov: code coverage for Ruby branch, but in the future it might rely on Kent Sibilev’s ruby-debug for the low-level work.

Keyword(s):[blog] [ruby] [frontpage] [call_stack] [0.1.0] [release] [Binding] [of_caller] [1.8.5]
References:[call_stack: backtrace data and 1.8.5-safe breakpoint/Binding.of_caller]