I used strace
to attach to a process briefly. The process created 90 threads. When I found the offending thread, I had to tediously search for the parent thread, then the grandparent thread, and so on all the way to the root process.
Is there a trick or tool to quickly figure out which thread created another? Or better yet, print the tree of thread creations like pstree
?
I can't see an easy way:
You could use the
-ff
option with-o filename
to produce multiple files (one per pid).eg:
that would help you see which parent created what. Maybe that would help you - at least then you could search backwards.
There is a perl script called
strace-graph
. Here is a version from github. It is packaged with crosstool-ng versions of compilers. It works for me even used cross platform.ARM Linux box.
X86_64 Linux box.
The output can be used to help navigate the main trace log.
strace -f
to trace child process that'sfork()
ed.