APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

2004/10/29 strace, trace

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.

Increase ad revenue 50-250% with Ezoic

More Articles by

Find me on Google+

© Tony Lawrence

Kerio Samepage

Have you tried Searching this site?

Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Anyone who slaps a 'this page is best viewed with Browser X' label on a Web page appears to be yearning for the bad old days, before the Web, when you had very little chance of reading a document written on another computer, another word processor, or another network. (Tim Berners-Lee)

This post tagged: