public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Debug threads
@ 2010-08-13 23:44 hce
  2010-08-14  0:01 ` Michael Snyder
  0 siblings, 1 reply; 3+ messages in thread
From: hce @ 2010-08-13 23:44 UTC (permalink / raw)
  To: gdb

Hi,

I am debug a problem on CentOS 5, the problem used %100 CPU and there
are 9 threads running. Which gdb command can I find out which thread
is current running and  hooked %100 CPU?

Thank you.

Kind regards.

hce

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Debug threads
  2010-08-13 23:44 Debug threads hce
@ 2010-08-14  0:01 ` Michael Snyder
  2010-08-14  0:54   ` Paul Koning
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2010-08-14  0:01 UTC (permalink / raw)
  To: hce; +Cc: gdb

hce wrote:
> Hi,
> 
> I am debug a problem on CentOS 5, the problem used %100 CPU and there
> are 9 threads running. Which gdb command can I find out which thread
> is current running and  hooked %100 CPU?

If you can attach with gdb, then there is a high probability that
the "current" thread is the one that is eating up all the CPU.

Do "info threads", and look for the thread that has an asterisk
("*") in the left hand column.

If you do "continue" and then control-c and repeat the info threads
command, it is likely that the busy thread will remain as the
"current" thread each time (or the majority of times).

Otherwise, gdb does not have a formal way of showing you which
thread is the most busy.

Michael

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Debug threads
  2010-08-14  0:01 ` Michael Snyder
@ 2010-08-14  0:54   ` Paul Koning
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Koning @ 2010-08-14  0:54 UTC (permalink / raw)
  To: Michael Snyder; +Cc: hce, gdb

Another option (not using gdb) is ps -L, which lists threads.

	paul

On Aug 13, 2010, at 8:01 PM, Michael Snyder wrote:

> hce wrote:
>> Hi,
>> I am debug a problem on CentOS 5, the problem used %100 CPU and there
>> are 9 threads running. Which gdb command can I find out which thread
>> is current running and  hooked %100 CPU?
> 
> If you can attach with gdb, then there is a high probability that
> the "current" thread is the one that is eating up all the CPU.
> 
> Do "info threads", and look for the thread that has an asterisk
> ("*") in the left hand column.
> 
> If you do "continue" and then control-c and repeat the info threads
> command, it is likely that the busy thread will remain as the
> "current" thread each time (or the majority of times).
> 
> Otherwise, gdb does not have a formal way of showing you which
> thread is the most busy.
> 
> Michael

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-14  0:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-13 23:44 Debug threads hce
2010-08-14  0:01 ` Michael Snyder
2010-08-14  0:54   ` Paul Koning

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).