I'm trying to get the call stacks of Ruby interpreter when it gets executed. For example, I have some ruby code in foo.rb
and when I execute it with some options (if any to get the call stack) by $ruby foo.rb
, then I would like to get which functions of interpreter get executed.
I found this (https://programmer.help/blogs/ruby-2.x-source-code-learning-an-overview-of-interpreters.html) 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.
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".
I did look at the vm_opts.h, but it does not tell much.
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.
Thank you for all your help!