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.
"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.
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.
You can do this with Arachno Ruby.
Use the "Stop all threads" command from the debug menu and then use the debugger
state window to view all stack frames.
···
--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ruby-ide.com
CTO Scriptolutions Ruby, PHP, Python IDE 's