trace(1) — Series 300/400 Only
NAME
trace − show which system calls a process is making
SYNOPSIS
trace [-cftT] [-o outputfile] [-p PID][command...]
DESCRIPTION
This program shows the system calls that a process is making.
OPTIONS
-c Print counts of system calls made rather than printing each one.
-f Follow forks/vforks (include child processes).
-o outputfile
Send output to <outputfile> rather than stderr.
-p PID Start tracing process PID; required if no command specified.
-t Print time just before each system call.
WARNINGS
/dev/trace must exist and be readable. The program also accesses /dev/kmem, so it needs to be setgid-sys. The strace driver must be in the kernel.
EXAMPLES
A simple example of trace(1) and its output:
$ trace ls 9.0trace.shar
531 execve("/bin/ls", "ls", "9.0trace.shar") ==> 0 == 0x0
^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ ^^^
PID syscall parameters return value
A fancier example:
$ trace -t -f -o junk ksh
This would trace ksh(1) and its descendants, printing something similar
to the output above, but with two changes: 1) the trace(1) output would
go to a file called "junk" (makes it easier to trace interactive programs
since trace(1) isn’t mixing its output with that of the application);
2) each line would be time-stamped. The PID is printed when the "-f" option
is specified.
Hewlett-Packard Company — HP-UX Release 9.10: April 1995