<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Segment7: Inliners are Hard to Debug</title>
    <link>http://blog.segment7.net/articles/2007/07/01/inliners-are-hard-to-debug</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>The Blog</description>
    <item>
      <title>Inliners are Hard to Debug</title>
      <description>&lt;p&gt;So I wrote SuperCaller&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;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 =&gt; e
  e.backtrace .each do |frame|
    puts frame
    puts frame.source || frame.sexp.inspect
    puts "---"
  end
end&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Gives:&lt;/p&gt;

&lt;pre&gt;&lt;samp&gt;/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]]
---
&lt;/samp&gt;&lt;/pre&gt;

&lt;p&gt;Coming Soon&lt;/p&gt;
</description>
      <pubDate>Sun, 01 Jul 2007 01:40:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:e830de31-b65a-4922-9540-d2349a292095</guid>
      <author>drbrain@segment7.net (Eric Hodel)</author>
      <link>http://blog.segment7.net/articles/2007/07/01/inliners-are-hard-to-debug</link>
      <category>Hacking</category>
      <category>Ruby</category>
    </item>
  </channel>
</rss>
