August 25, 2009

trace inter-process communication

"strace" and "lsof" are two very powerful tools to debug running processes in a Linux system.

Use "lsof -p PID" to find out the socket/fifos a process is using
Use "lsof -p PID -Pn" to have lsof show ip and port number instead of names

Use [ strace -p 24846 -ewrite,read -s 1024 -xx 2>&1 | grep -E "^write\(7|^read\(6" ] to trace the real-time read/write of the process

No comments:

Post a Comment