title: How to get Ruby interpreter callstack?
body: <p>I'm trying to get the call stacks of Ruby interpreter when it gets executed. For example, I have some ruby code in <code>foo.rb</code> and when I execute it with some options (if any to get the call stack) by <code>$ruby foo.rb</code>, then I would like to get which functions of interpreter get executed.</p>
  
  <p>I found this (<a href="https://programmer.help/blogs/ruby-2.x-source-code-learning-an-overview-of-interpreters.html" rel="nofollow noreferrer">https://programmer.help/blogs/ruby-2.x-source-code-learning-an-overview-of-interpreters.html</a>) nice article related to my questions and provides some idea of how I should approach, but I'm not quite sure how I should do it.</p>
  
  <p>Basically, the article is saying that "Open OPT_CALL_THREADED_CODE switch in vm_opts.h header file when compiling Ruby
  ruby_run_node call stack" to get the call stack, but I don't really get what does it mean by "Open OPT_CALL_THREADED_CODE".</p>
  
  <p>I did look at the vm_opts.h, but it does not tell much.</p>
  
  <p>This issue is a very specific topic, but if anyone has any idea how I can get the call stack in anyways or with the method the article is suggesting, please please help me out here.</p>
  
  <p>Thank you for all your help!</p>