Forum: IronRuby Caller(0)[1] returns :0 if not debugging

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D4ced0fe3718f187173fc05dd7f33f57?d=identicon&s=25 Ben Hall (Guest)
on 2008-10-06 23:38
(Received via mailing list)
Attachment: expandpath.rb (109 Bytes)
Attachment: expandpath_call.rb (48 Bytes)
Hi,

As promised, I'm trying to track down and reproduce various bugs I have
hit.

The first one I have is that my code is calling caller(0)[1] which
expects the path to the calling method.  However, if i'm using running
the ir, then it can't find the file or the method name, and the line
number is 0 in the stack trace, as such the information being returned
is incorrect which is causing expand_path to blow up. Hope that makes
sense?


E:\IronRuby\r156\build\debug>ir expandpath_call.rb
:0

E:\IronRuby\r156\build\debug>ir -D expandpath_call.rb
expandpath_call.rb:4

E:\IronRuby\r156\build\debug>ruby expandpath_call.rb
expandpath_call.rb:4



File: expandpath_call.rb
require 'expandpath.rb'

$a = A.new
$a.method



File: expandpath.rb
class A
  def method
      puts caller(0)[1]
  end
end


In the actual code, the stack frame looks something like this:
{#top-level-method#$18##18 at offset 10911 in file:line:column
<filename unknown>:0:0}


Hope this helps

Cheers

Ben
This topic is locked and can not be replied to.