System Call Trace, strace on Linux, often just trace on other Unixes. I have used this tool many times to track down baffling application problems. For example, I recently had a client transfer Cobol programs from an old SCO system to Linux. With a Linux runtime in place, the programs worked, but failed mysteriously at certain points. By using strace, I produced a file that showed "open" calls failing due to improper directory permissions.
You don't need to understand much to benefit. You'll see lines like:
open("/etc/mtab", O_RDONLY) = 3
That's a succesful open. A failure looks like this:
open("/tmp/thingy", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
Pretty obvious, even if you didn't realize that the "-1" meant a problem.
Of course, the more you understand about system calls and programming, the more you can glean from strace output.
Got something to add? Send me email.
More Articles by Tony Lawrence © 2011-07-07 Tony Lawrence