eigenclass

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:

  1. put the breakpoint calls in the code you’re inspecting, as usual
  2. start the “breakpointer” as usual with script/breakpointer
  3. 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.


Use this form to create a new top-level comment; for direct replies to existing comments, use the text entries you’ll find below.

Name:
Subject:

TextFormattingRules
Preview:

Last modified:2006/09/07 05:58:52
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]
Referer | 28 | 12 | 12 | 11 | 10 | 7 | 7 | 6 | 6 | 6 | 5 | 5 | 4 | 4 | 3 | 3 | 3 | 3 | 3 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |