# 手把手教你用Strace诊断问题

shell> strace -p <PID>


shell> strace -cp <PID>


shell> strace -T -e clone -p <PID>


clone() creates a new process, in a manner similar to fork(2). It is actually a library function     layered on top of the underlying clone() system call, hereinafter referred to as sys_clone. A description of sys_clone is given towards the end of this page.

Unlike fork(2), these calls allow the child process to share parts of its execution context with the calling process, such as the memory space, the table of file descriptors, and the table of signal handlers. (Note that on this manual page, “calling process” normally corresponds to “parent process”. But see the description of CLONE_PARENT below.)


shell> strace -eclone php -r 'exec("ls");'