Strace can be used as a debugging tool, or as a primitive profiler. As a debugger, you can see how given system calls were called, executed and what they return. Mar 31, 2011as matthew said, strace uses the ptrace (2) system call to work its magic.
I used strace to attach to a process briefly. Feb 4, 201346 if i want to strace a multi-threaded process (of all of its threads), how should i do it? I know that one can do strace -f to follow forked process?
Sep 22, 2019strace is a utility which allows you to trace the system calls that an application makes. Sep 20, 201177 i know that strace uses ptrace to do the job, but it needs to run the target process with trace_me on, which doesn't apply in the case of an already running process. Sep 14, 2022self contained reproducible example i need to strace the output of any command through python.
Dec 22, 2015when i run strace -f strace /bin/ls to know how strace work it failed with ptrace (ptrace_traceme, 0, 0, 0) = -1 eperm (operation not permitted) even with root account. Mar 25, 2011if your strace doesn't respond to ctrl + c, than as mentioned, use ctrl + z and bg to push it to the background then attach to the running strace process with another strace. Nov 10, 2014it looks like running strace (or any other tool that uses the ptrace system call) can causing in "hung" system calls to return (with an exit code of eintr).