[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Getting a thread-dump

Matt Mower

1/1/2005 10:42:00 AM

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.

Thanks,

Matt

--
Matt Mower :: http://matt...


2 Answers

Robert Klemme

1/1/2005 11:23:00 AM

0


"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

Lothar Scholz

1/1/2005 12:59:00 PM

0

Hello Matt,

MM> Hi folks,

MM> Is there a way I can get the Ruby interpreter to dump a stack trace
MM> for all running threads? I have some code hang during I/O and I want
MM> 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.ru...
CTO Scriptolutions Ruby, PHP, Python IDE 's