Is there a way to print the runtime process stack trace of a Ruby 1.9.x process? I know that for Ruby 1.8 there was a utility called pstack
, but the project seems to have been abandoned a couple of years ago: https://github.com/ice799/pstack . Does something like this exist for Ruby 1.9? Many thanks!
EDIT: I'm interested in using an external tool to create a stack trace (doesn't work in the same memory space as the Ruby process).
As @mosch noted, the Kernal#caller
method works as part of an ongoing Ruby process.
You can even create support for your Ruby code that processes process signals and prints a stack trace:
Signal.trap("SIGTERM") { p caller }
Link: http://www.ruby-doc.org/core-1.9.3/Signal.html
I could create this functionality in my code, but I would prefer to use a more generalized external solution. Thanks.
Will sulzer
source share