简体   繁体   中英

gdb - multiple threads and shared libs

I have a program which create many threads. I can check it using following command: ps -L pid . I also know that a process loads some shared libs. I wonder if is possible to check which threads belong to a selected shared lib. That process contains debug symbols and I can attach to them using follwoing command: sudo gdb -p pid What's next ?

Let we already attached to a process.

(gdb) info threads

Will display currently known threads. The last column in the output shows function and library for the last stack frame for each thread.

If you want to see threads start routines and the libraries they belong to, you may use:

(gdb) thread apply all bt -3

This command will show you 3 stack frames (from bottom) for each thread. If you are using pthread library then function that goes right after start_thread() is your start routine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM