PlayHardGoPro
PlayHardGoPro

Reputation: 2923

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 ID, the same ID that is shown in PS Linux command. If there isn't a way, how could I find which thread is stuck ??

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

Upvotes: 3

Views: 3637

Answers (1)

Anish Poduval
Anish Poduval

Reputation: 94

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

Upvotes: 5

Related Questions