Wednesday, July 05, 2006

More Debugging Tools

Here are a couple of cool debugging tools that will help you accomplish more in less time:

strace
------

strace allows you to attach to a process and watch every system call that the process executes. It is very helpful for tracking down exactly what a program is doing without having to use gdb. It is run like this (use the -f option to strace forks):

strace -tt -o log.txt -p

For an example run this:

strace -tt "uptime"

lsof
---
Another cool command is the "lsof" command. It will give you a list of open files (including sockets) for a process.

lsof -p 3387