Ravichandran
Ravichandran

Reputation: 55

How to list the threads along with it's appropriate function in GDB.?

With the help of "info thread" command I can able to know the thread id and currently executing thread.When I have one or two threads can able to remind the function of each thread.Based on that I can able to execute the thread which I want.But when I'm working with multiple threads and I want to execute one particular function for that I need to remember all the function so that I can give the appropriate thread id to execute.It is impossible to remind all the threads along with it's function name.So,Is there any way to list the threads along with it's function name in GDB.?.

Thank You..!!.

Upvotes: 2

Views: 3619

Answers (3)

Muzaffer Ozakca
Muzaffer Ozakca

Reputation: 21

I press Ctrl+L to clear the screen buffer

set height 0
thread apply all bt

This will dump backtrace for all the threads but won't pause (because we set the window height to 0) if the list is long. I then copy/paste the output to a text editor for examination.

Upvotes: 2

ks1322
ks1322

Reputation: 35716

You can use thread apply all bt command. It will print backtraces of all your threads. You will find thread function name inside each of these backtrace near the end and before clone system call.

Upvotes: 1

Related Questions