- Strace
strace is a debugging utility in
Linux to monitor thesystem call s used by a program and all the signals it receives, similar to "truss" utility in other Unix systems. This is made possible by aLinux kernel feature known as "ptrace ".A similar utility is provided by
Cygwin .Usage
The most common usage is to start a program using strace, which prints a list of system calls made by the program. This is useful if the program continually crashes, or does not behave as expected; for example using strace may reveal that the program is attempting to access a file which does not exist or cannot be read.
An alternative application is to use the -p flag to attach to a running process. This is useful if a process has stopped responding, and might reveal, for example, that the process is blocking whilst attempting to make a network connection.
As strace only details system calls it cannot be used to detect as many problems as a code debugger such as
Gdb . It is, however, easier to use than a code debugger, and is an extremely useful tool for system administrators.Other Tools
There are other similar, and sometimes more powerful, instrumentation tools on other platforms.
*Linux distributions after 2006 haveSystemTap
* Solaris has Truss andDTrace
*FreeBSD has the Truss command
*Mac OS X provides ktrace (10.4 and earlier) andDTrace (from Solaris) in 10.5 and later. [http://docs.info.apple.com/article.html?artnum=305893] .See also
*
ktrace
*ltrace
* lsof
*gdb
*List of Unix programs External links
* [http://www.linuxmanpages.com/man1/strace.1.php Man page]
* [http://www.osreviews.net/reviews/admin/strace OS Reviews article on strace]
* [http://sourceforge.net/projects/strace/ Project page]
Wikimedia Foundation. 2010.