Inliners are Hard to Debug
Eric Hodel | Sun, 01 Jul 2007 08:40:00 GMT
So I wrote SuperCaller
require 'rubygems'
require 'super_caller'
require 'super_caller/exception'
class X
def y; z; end
def z; raise; end
end
begin
X.new.y
rescue => e
e.backtrace .each do |frame|
puts frame
puts frame.source || frame.sexp.inspect
puts "---"
end
end
Gives:
/usr/local/lib/ruby/gems/1.8/gems/SuperCaller-1.0.0/lib/super_caller/exception.rb:12:in `initialize' def initialize(message) old_initialize(message) @backtrace = super_caller end --- test.rb:7:in `new' [[:vcall, :raise]] --- test.rb:7:in `z' [[:vcall, :raise]] --- test.rb:6:in `y' def y z end --- test.rb:11 [[:call, [:call, [:const, :X], :new], :y]] ---
Coming Soon
no commentsComments are disabled


Articles