https://stackoverflow.com/questions/7698209/tracing-pthreads-in-linux
strace works for threads as well. Use strace -f to strace all threads.
To strace only a particular thread, you first have to find its tid (thread id). Threads have thread id's that's really a pid (process id)
Once you know the pid of the thread, use strace -p the_pid to strace that thread.
用strace也是可以跟踪线程的,先找到线程id。
1 ls proc/进程id/task/
然后就可以用
1 strace -p 线程id