PlayHardGoPro PlayHardGoPro -5 years ago 209
Linux Question

How to find which thread is stuck

I'm working with threads and one (or more) of my thread(s) is/are stuck and never ends. The problem is that I can't find which one.

So I'd like to know if there is a way to find it's

, the same ID that is shown in
Linux command. If there isn't a way, how could I find which thread is stuck ??

Obs: Already checked the
and it's not what I'm looking for.

Answer Source

Using GDB debugger we can find out which thread is in blocking state.

  1. First try to compile your code with debug symbols.
  2. gdb your_file_executable
  3. put some break point ( you would be knowing where to place the bp exactly )
  4. info threads

" info threads " will give information about the threads which is spawned/running . w

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download