mac下的strace命令

来源:互联网 发布:诺基亚n1淘宝闪退 编辑:程序博客网 时间:2024/06/04 00:34

bogon:xxx xxx$ dtruss

USAGE: dtruss [-acdefholLs] [-t syscall] { -p PID | -n name | command }


          -p PID          # examine this PID

          -n name         # examine this process name

          -t syscall      # examine this syscall only

          -a              # print all details

          -c              # print syscall counts

          -d              # print relative times (us)

          -e              # print elapsed times (us)

          -f              # follow children

          -l              # force printing pid/lwpid

          -o              # print on cpu times

          -s              # print stack backtraces

          -L              # don't print pid/lwpid

          -b bufsize      # dynamic variable buf size

   eg,

       dtruss df -h       # run and examine "df -h"

       dtruss -p 1871     # examine PID 1871

       dtruss -n tar      # examine all processes called "tar"

       dtruss -f test.sh  # run test.sh and follow children


strace在linux下用来跟踪某个进程的系统调用

在solaris下,对应的是dtrace

在mac下,对应的命令是:dtruss