Any tool for examine ruby's thread?

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?

2009/8/5 femto Zheng [email protected]:

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

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

On Thu, Aug 6, 2009 at 4:17 PM, Robert
Klemme[email protected] wrote:

Please do not top post.

2009/8/5 femto Zheng [email protected]:

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

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,
:slight_smile:

2009/8/6 femto Zheng [email protected]:

by the way, reply at the top is very easy because I’m using gmail,
so I can collapse other’s reply very easily,
:slight_smile:

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

Please do not top post.

2009/8/5 femto Zheng [email protected]:

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

Did you look at the documentation?

http://www.ruby-doc.org/core-1.9/classes/Thread.html
http://www.ruby-doc.org/core-1.9/classes/ThreadGroup.html

Kind regards

robert

On 8/6/09, femto Zheng [email protected] wrote:

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,
:slight_smile:

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.

2009/8/6 Caleb C. [email protected]:

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

Caleb C. wrote:

On 8/6/09, femto Zheng [email protected] wrote:

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.

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs