Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exit(2)

ptrace(2)

TRACE(1)  —  USER COMMANDS

NAME

trace − trace system calls and signals

SYNOPSIS

trace [ −ct ] [ −o filename ]  command

trace [ −ct ] [ −o filename ] −p pid

DESCRIPTION

trace intercepts the system calls and signals of a process.  The name of the system call, its arguments and result are listed on the standard output or on the file given as an argument to the −o option.  The −c option can be used to get a quick summary of system call and signal counts instead of having a full trace. 

Given a command it runs the command tracing all system calls until exit(2). 

Given a process ID using the −p option, it “attaches” itself to the process and begins tracing.  The trace may be terminated at any time by a keyboard interrupt signal ( CTRL-C).  trace will respond by detaching itself from the traced process leaving it to continue running. 

Each line in the trace contains the system call name, followed by its arguments in parentheses and its result.  Error returns (result = −1) have the error name and error message appended.  Signals are printed as a signal name followed by the signal number.  The −t option prefixes each line of the trace with the time of day.  Arguments are printed according to their type.  Structure pointers are always printed as hex addresses.  Character pointers are dereferenced and printed as a quoted string.  Non-printing characters in strings are represented by escape codes.  Only the first 32 bytes of strings are printed; longer strings have two dots appended following the closing quote. 

The quick brown fox jumps over t ..

Strings with more than 50% non-printing characters are assumed to contain binary data and are represented by a NULL string followed by two dots. 

.. 

EXAMPLE

example% trace date
gettimeofday (0x21474, 0x2147c) = 0
gettimeofday (0x21474, 0) = 0
gettimeofday (0xefffc78, 0x214ac) = 0
ioctl (1, 0x40067408, 0xefffa10) = -1 ENOTTY (Inappropriate ioctl for device)
fstat (1, 0xefffa30) = 0
getpagesize () = 8192
brk (0x27640) = 0
close (0) = 0
Thu Dec  4 14:16:36 PST 1986
write (1, "Thu Dec  4 14:16:36 PST 1986\n", 29) = 29
close (1) = 0
close (2) = 0
exit (0) = ?
example%

SEE ALSO

exit(2), ptrace(2)

BUGS

Programs that use the setuid bit do not have effective user ID privileges while being traced. 

Child processes of a traced process are not traced. 

A traced process ignores SIGSTOP. 

A traced process runs slowly. 

Sun Release 4.0  —  Last change: 9 September 1987

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026