This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Debug threads
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