# Caller(0)\[1\] returns :0 if not debugging

**URL:** <https://www.ruby-forum.com/t/caller-0-1-returns-0-if-not-debugging/150289>\
**Category:** IronRuby\
**Created:** [October 6, 2008, 11:38pm UTC](https://www.ruby-forum.com/t/caller-0-1-returns-0-if-not-debugging/150289 "2008-10-06T23:38:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![benhiller](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8e7dd6/32.png) [@benhiller](https://www.ruby-forum.com/u/benhiller)\
**Post date:** [October 6, 2008, 11:38pm UTC](https://www.ruby-forum.com/t/caller-0-1-returns-0-if-not-debugging/150289/1 "2008-10-06T23:38:27Z")

</div>

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  
:0:0}

Hope this helps

Cheers

Ben
