Robert Klemme
1/1/2005 11:23:00 AM
"Matt Mower" <matt.mower@gmail.com> schrieb im Newsbeitrag
news:d56373190501010242a927b6b@mail.gmail.com...
> Hi folks,
>
> Is there a way I can get the Ruby interpreter to dump a stack trace
> for all running threads? I have some code hang during I/O and I want
> to see the callstack when it does.
>
> On Windows the Java interpreter will do something like this when you
> hit ctrl+break. I'm using the 1.8.2-final one-click installer on
> Windows XP.
I don't know such a thing (you're probably thinking of JVM's Ctrl-C).
However, there are some options: One thing you could do is set
Thread.abort_on_exception = true - maybe your thread dies silently from an
uncaught exception. Or you wrap all threads in "begin ... rescue Exception
=> e; puts e.backtrace end" if you have access to the code.
Third option would be to trace execution via set_trace_func and record calls
and returns in a file (or to console if that doesn't clutter too much). But
this is likely to be slow unless you can narrow it down to a certain class
or instance.
Kind regards
robert