How to track child process using strace?

后端 未结 4 1352
盖世英雄少女心
盖世英雄少女心 2020-12-12 17:57

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

4条回答
  •  盖世英雄少女心
    2020-12-12 18:30

    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.

    $ ./strace -f -q -s 100 -o app.trc -p 449
    $ tftp -pr app.trc 172.0.0.133
    

    X86_64 Linux box.

    $ ./strace-graph /srv/tftp/app.trc 
     (anon)
      +-- touch /tmp/ppp.sleep
      +-- killall -HUP pppd
      +-- amixer set Speaker 70%
      +-- amixer set Speaker 70%
      +-- amixer set Speaker 70%
      +-- amixer set Speaker 70%
      +-- amixer set Speaker 50%
      +-- amixer set Speaker 70%
      `-- amixer set Speaker 50%
    

    The output can be used to help navigate the main trace log.

提交回复
热议问题