[MacRuby-devel] Kernel#caller doesn't show directories
Laurent Sansonetti
lsansonetti at apple.com
Mon May 3 14:46:02 PDT 2010
Hi Brian,
This looks like a bug. I don't know why it's fixed in 0.7 for you, because we haven't changed a lot of things there.
In any case, a trac ticket might be a good idea if you still reproduce the problem. Note that backtraces in MacRuby are generated by walking through the stack and sometimes some entries are missing. File/line numbering is retrieved from DWARF metadata but sometimes it's incorrectly compiled. So, bug reports are welcome :-)
Laurent
On May 3, 2010, at 1:12 PM, Brian Marick wrote:
> I see that this works in 0.7. Sorry for the waste of bandwidth.
>
> On May 3, 2010, at 11:27 AM, Brian Marick wrote:
>
>> Suppose you have foo.rb:
>>
>> def __DIR__
>> caller[0]
>> raise 'death'
>> end
>>
>> puts __DIR__
>>
>>
>> If you call that from, say, a directory two levels below it, you get this:
>>
>> 818 $ macruby ../../foo.rb
>> foo.rb:2:in `__DIR__': death (RuntimeError)
>> from foo.rb:6:in `<main>'
>>
>> In 1.8.6 (and I sure hope in stock 1.9), you get filenames with the relative directory:
>>
>> 819 $ ruby ../../foo.rb
>> ../../foo.rb:3:in `__DIR__': death (RuntimeError)
>> from ../../foo.rb:6
>>
>> I think that's important because there are tools (IDEs, my emacs hacks) that use the backtrace from a test to jump to the failing code. You can't do that unless you have the full pathname.
>>
>> I will file a ticket if this is a real bug.
>>
>>
>> -----
>> Brian Marick, independent consultant
>> Mostly on agile methods with a testing slant
>> Author of /Programming Cocoa with Ruby/
>> www.exampler.com, www.exampler.com/blog, www.twitter.com/marick
>>
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
>
> -----
> Brian Marick, independent consultant
> Mostly on agile methods with a testing slant
> Author of /Programming Cocoa with Ruby/
> www.exampler.com, www.exampler.com/blog, www.twitter.com/marick
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
More information about the MacRuby-devel
mailing list