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

2004/10/29 strace, trace


Some material is very old and may be incorrect today

© October 2004 Tony Lawrence

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.


If you found something useful today, please consider a small donation.



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> strace, trace


Inexpensive and informative Apple related e-books:

Photos: A Take Control Crash Course

Take Control of Pages

Take Control of Automating Your Mac

Photos for Mac: A Take Control Crash Course

Take Control of OS X Server





More Articles by © Tony Lawrence





Printer Friendly Version

Have you tried Searching this site?

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


Printer Friendly Version





I think it’s a new feature. Don’t tell anyone it was an accident. (Larry Wall)




Linux posts

Troubleshooting posts


This post tagged:

Programming

Troubleshooting

UnixWords



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode