Retrieve callstack from a Thread

M

Morten Simonsen

Hi

I want to retrieve the callstack from a Thread which is running, but for
some reason has gone
into "hang-mode" (usually waiting for some I/O). The reason for this is that
I have to
terminate this Thread, but I would like to know in which method the Thread
got stuck, so
that I can check this "problem area".

So far I have only managed to produce a callstack if I throw an exception
and manipulate
Throwable's printStackTrace()-method. This cannot be done if the Thread is
stuck and it
will not do to use this method for every step in the Thread and preserve the
results because
of its enormous performance impact.

So is there any other way? Or is this kind of information hidden away?

Morten Simonsen
 
R

Robert Olofsson

Morten Simonsen ([email protected]) wrote:
: I want to retrieve the callstack from a Thread which is running, but for
: some reason has gone
: ....
: So is there any other way? Or is this kind of information hidden away?

Well any good debugger should be able to do it. Some profilers may be
able to do it, I know that my profiler, jmp(1), can show all threads
and the current stack for each thread, including the object they are
waiting on (if any).

jmp can be found at:
http://www.khelekore.org/jmp/

/robo
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top