TRUSS(1) BSD General Commands Manual TRUSS(1)NAME
truss -- trace system calls
SYNOPSIS
truss [-facedDS] [-o file] [-s strsize] -p pid
truss [-facedDS] [-o file] [-s strsize] command [args]
DESCRIPTION
The truss utility traces the system calls called by the specified process or program. Output is to the specified output file, or standard
error by default. It does this by stopping and restarting the process being monitored via ptrace(2).
The options are as follows:
-f Trace descendants of the original traced process created by fork(2), vfork(2), etc.
-a Show the argument strings that are passed in each execve(2) system call.
-c Do not display individual system calls. Instead, before exiting, print a summary containing for each system call: the total system
time used, the number of times the call was invoked, and the number of times the call returned with an error.
-e Show the environment strings that are passed in each execve(2) system call.
-d Include timestamps in the output showing the time elapsed since the trace was started.
-D Include timestamps in the output showing the time elapsed since the last recorded event.
-S Do not display information about signals received by the process. (Normally, truss displays signal as well as system call events.)
-o file
Print the output to the specified file instead of standard error.
-s strsize
Display strings using at most strsize characters. If the buffer is larger, ``...'' will be displayed at the end of the string. The
default strsize is 32.
-p pid Follow the process specified by pid instead of a new command.
command [args]
Execute command and trace the system calls of it. (The -p and command options are mutually exclusive.)
EXAMPLES
# Follow the system calls used in echoing "hello"
$ truss /bin/echo hello
# Do the same, but put the output into a file
$ truss -o /tmp/truss.out /bin/echo hello
# Follow an already-running process
$ truss -p 34
SEE ALSO kdump(1), ktrace(1), ptrace(2)HISTORY
The truss command was written by Sean Eric Fagan for FreeBSD. It was modeled after similar commands available for System V Release 4 and
SunOS.
BSD May 12, 2009 BSD
Check Out this Related Man Page
sotruss(1) User Commands sotruss(1)NAME
sotruss - trace shared library procedure calls
SYNOPSIS
/usr/bin/sotruss [-f] [-F bindfromlist] [-T bindtolist]
[-o outputfile] executable [executable arguments...]
DESCRIPTION
sotruss executes the specified command and produces a trace of the library calls that it performs. Each line of the trace output reports
what bindings are occurring between dynamic objects as each procedure call is executed. sotruss traces all of the procedure calls that
occur between dynamic objects via the Procedure Linkage Table, so only those procedure calls which are bound via the Procedure Linkage Ta-
ble will be traced. See Linker and Libraries Guide
OPTIONS -F bindfromlist A colon-separated list of libraries that are to be traced. Only calls from these libraries will be traced. The default
is to trace calls from the main executable only.
-T bindtolist A colon-separated list of libraries that are to be traced. Only calls to these libraries will be traced. The default is
to trace all calls.
-o outputfile sotruss output will be directed to the outputfile. If this option is combined with the -f option then the pid of the
executing program will be placed at the end of the filename. By default sotruss output is placed on stderr.
-f Follow all children created by fork() and print truss output on each child process. This option will also cause a
pid to be output on each truss output line.
EXAMPLES
Example 1 An example of sotruss.
A simple example shows the tracing of a simple ls command:
% sotruss ls | more
ls -> libc.so.1:*atexit(0xef7d7d1c, 0x23c00, 0x0)
ls -> libc.so.1:*atexit(0x1392c, 0xef7d7d1c, 0xef621bb0)
ls -> libc.so.1:*setlocale(0x6, 0x1396c, 0xef621ba8)
ls -> libc.so.1:*textdomain(0x13970, 0x1396c, 0xef621ba8)
ls -> libc.so.1:*time(0x0, 0xef61f6fc, 0xef621ba8)
ls -> libc.so.1:*isatty(0x1, 0xef61f6fc, 0x0)
ls -> libc.so.1:*getopt(0x1, 0xeffff8fc, 0x13980)
ls -> libc.so.1:*malloc(0x100, 0x0, 0x0)
ls -> libc.so.1:*malloc(0x9000, 0x0, 0x0)
ls -> libc.so.1:*lstat64(0x23ee8, 0xeffff7a0, 0x0)
...
ls -> libc.so.1:*printf(0x13a64, 0x26208, 0x23ef0)
ls -> libc.so.1:*printf(0x13a64, 0x26448, 0x23ef0)
ls -> libc.so.1:*exit(0x0, 0x24220, 0x2421c)
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWtoo |
+-----------------------------+-----------------------------+
SEE ALSO ld.so.1(1), truss(1), whocalls(1), fork(2), attributes(5)
Linker and Libraries Guide
SunOS 5.11 12 May 1997 sotruss(1)