Any tool for examine ruby's thread?

F

femto Zheng

Hello all,I'm doing a multithreaded ruby application,
I want to examine the thread because the application's logic is quite complex,
so it helps if I can see each thread clearly,
but the problem is, if I use IDE with ruby-debug-ide, when pause at breakpoint,
it always seems to just have two threads(there's not a thread view?),
not like previously when I develop java application, when you pause,
you can see there's how many threads very easily.
Is there anytool for examining ruby's thread?
 
R

Robert Klemme

2009/8/5 femto Zheng said:
Hello all,I'm doing a multithreaded ruby application,
I want to examine the thread because the application's logic is quite complex,
so it helps if I can see each thread clearly,
but the problem is, if I use IDE with ruby-debug-ide, when pause at breakpoint,
it always seems to just have two threads(there's not a thread view?),
not like previously when I develop java application, when you pause,
you can see there's how many threads very easily.
Is there anytool for examining ruby's thread?

What kind of examination do you want to do? Do you want to see how
many threads there are? Do you want to know what each thread does
(e.g. current stack trace)?

Cheers

robert
 
F

femto Zheng

Yes, at least I need how many threads there are,
and if stacktrace of each thread would be better.
 
F

femto Zheng

Please do not top post.



Did you look at the documentation?
Yes,I've found the Thread.list fulfills my needs,Thanks.
do you have any means for examning every thread's stacktrace?
by the way, reply at the top is very easy because I'm using gmail,
so I can collapse other's reply very easily,
:)
 
R

Robert Klemme

2009/8/6 femto Zheng said:
by the way, reply at the top is very easy because I'm using gmail,
so I can collapse other's reply very easily,
:)

You can do so as well when not top posting. Please also consider that
others may be reading the same content via different media / tools
which might not provide this capability.

Cheers

robert
 
C

Caleb Clausen

Yes,I've found the Thread.list fulfills my needs,Thanks.
do you have any means for examning every thread's stacktrace?

There does not seem to be a way to get the backtrace of another thread
-- even from within the debugger. This is a shame, because as you say
it's useful for debugging. There ought to be a Thread#caller or
Thread#backtrace method, which works like #caller but on another
thread.

I would have thought that you'd at least be able to use the 'thread
switch' command in the debugger, and then 'where' once you're in that
thread to see its backtrace, but that doesn't seem to work either.
by the way, reply at the top is very easy because I'm using gmail,
so I can collapse other's reply very easily,
:)

Don't let me get started on the evils of bottom-quoting. Just let me
note that it's not the approved style on this list.
 
R

Robert Klemme

2009/8/6 Caleb Clausen said:
There does not seem to be a way to get the backtrace of another thread
-- even from within the debugger. This is a shame, because as you say
it's useful for debugging. There ought to be a Thread#caller or
Thread#backtrace method, which works like #caller but on another
thread.

I would have thought that you'd at least be able to use the 'thread
switch' command in the debugger, and then 'where' once you're in that
thread to see its backtrace, but that doesn't seem to work either.

You can certainly cook up something with set_trace_func. This is
however a bit slow.

Cheers

robert
 
J

Joel VanderWerf

Caleb said:
There does not seem to be a way to get the backtrace of another thread
-- even from within the debugger. This is a shame, because as you say
it's useful for debugging. There ought to be a Thread#caller or
Thread#backtrace method, which works like #caller but on another
thread.

IIRC this has been requested and discussed a few times, and it might be
available in development versions of 1.9.2[1], but not 1.8.x, AFAIK.

[1] http://redmine.ruby-lang.org/issues/show/977

[2] google "ruby Thread#backtrace" for more discussion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top