How to trace a running process?

Using strace one can trace the system calls being executed by a running process. To stop the strace press control-C To display the system calls being executed $ strace -p <pid> or To display a summary of system calls being executed $ strace -cfo <logfile> -p <pid> Example: In this example smon process was being traced $ strace -p 1234 Process 1234 attached – interrupt … Continue reading How to trace a running process?

How to trace system calls?

Using strace (linux)/truss (AIX) one can trace the system calls as program executes. It can be useful in identifying where a program identify an issue depending on the situation. Example below shows output when strace is called for echo $ strace echo “Hello” execve(“/bin/echo”, [“echo”, “Hello”], [/* 42 vars */]) = 0 — shows process being executed uname({sys=”Linux”, node=”localhost.localdomain”, …}) = 0 brk(0) = 0x505000 … Continue reading How to trace system calls?