# How to track down a function

**URL:** <https://www.ruby-forum.com/t/how-to-track-down-a-function/127329>\
**Category:** Ruby\
**Created:** [January 28, 2008, 11:18am UTC](https://www.ruby-forum.com/t/how-to-track-down-a-function/127329 "2008-01-28T11:18:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [January 28, 2008, 11:18am UTC](https://www.ruby-forum.com/t/how-to-track-down-a-function/127329/1 "2008-01-28T11:18:38Z")

</div>

I have a very large program with a lot of dependencies (objects,  
functions that are linked togheter) and there is one particular function  
that I want to strace troughout the program. (i.e find out every call it  
makes(including its dependencies)), anyone have a good tips here?

It’s too large to track by eye unfortunately

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [January 28, 2008, 1:14pm UTC](https://www.ruby-forum.com/t/how-to-track-down-a-function/127329/2 "2008-01-28T13:14:41Z")

</div>

2008/1/28, Andreas S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I have a very large program with a lot of dependencies (objects,  
> functions that are linked togheter) and there is one particular function  
> that I want to strace troughout the program. (i.e find out every call it  
> makes(including its dependencies)), anyone have a good tips here?

You can use set\_trace\_func to trace execution and build up a data  
structure that reflects the call graph. However, you need to be aware  
that this will only yield actual method calls and not provide  
information about all places where this method can be invoked. This  
is next to impossible in a dynamic language like Ruby.

Kind regards

robert
