blob: d35a74e8a0576043fce2ae411f24eeee6248816a [file] [log] [blame]
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001.\" Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
2.\" Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
3.\" Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\" notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\" notice, this list of conditions and the following disclaimer in the
13.\" documentation and/or other materials provided with the distribution.
14.\" 3. The name of the author may not be used to endorse or promote products
15.\" derived from this software without specific prior written permission.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27.\"
28.\" $Id$
29.\"
30.de CW
31.sp
32.nf
33.ft CW
34..
35.de CE
Wichert Akkerman8829a551999-06-11 13:18:40 +000036.ft R
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000037.fi
38.sp
39..
Roland McGrath4417fda2003-01-24 04:31:20 +000040.TH STRACE 1 "2003-01-21"
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000041.SH NAME
42strace \- trace system calls and signals
43.SH SYNOPSIS
44.B strace
45[
46.B \-dffhiqrtttTvxx
47]
48[
49.BI \-a column
50]
51[
52.BI \-e expr
53]
54\&...
55[
56.BI \-o file
57]
58[
59.BI \-p pid
60]
61\&...
62[
63.BI \-s strsize
64]
65[
66.BI \-u username
67]
68[
Roland McGrath4417fda2003-01-24 04:31:20 +000069.BI \-E var=val
70]
71\&...
72[
73.BI \-E var
74]
75\&...
76[
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000077.I command
78[
79.I arg
80\&...
81]
82]
83.sp
84.B strace
85.B \-c
86[
87.BI \-e expr
88]
89\&...
90[
91.BI \-O overhead
92]
93[
94.BI \-S sortby
95]
96[
97.I command
98[
99.I arg
100\&...
101]
102]
103.SH DESCRIPTION
104.IX "strace command" "" "\fLstrace\fR command"
105.LP
106In the simplest case
107.B strace
108runs the specified
109.I command
110until it exits.
111It intercepts and records the system calls which are called
112by a process and the signals which are received by a process.
113The name of each system call, its arguments and its return value
114are printed on standard error or to the file specified with the
115.B \-o
Roland McGratha09353a2008-12-10 06:09:29 +0000116option.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000117.LP
118.B strace
Nate Sammonsb4aa1131999-03-31 05:59:04 +0000119is a useful diagnostic, instructional, and debugging tool.
Roland McGrath0411b402003-10-22 06:16:32 +0000120System administrators, diagnosticians and trouble-shooters will find
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000121it invaluable for solving problems with
122programs for which the source is not readily available since
123they do not need to be recompiled in order to trace them.
124Students, hackers and the overly-curious will find that
125a great deal can be learned about a system and its system calls by
126tracing even ordinary programs. And programmers will find that
127since system calls and signals are events that happen at the user/kernel
128interface, a close examination of this boundary is very
129useful for bug isolation, sanity checking and
130attempting to capture race conditions.
131.LP
132Each line in the trace contains the system call name, followed
133by its arguments in parentheses and its return value.
134An example from stracing the command ``cat /dev/null'' is:
135.CW
136open("/dev/null", O_RDONLY) = 3
137.CE
138Errors (typically a return value of \-1) have the errno symbol
139and error string appended.
140.CW
141open("/foo/bar", O_RDONLY) = -1 ENOENT (No such file or directory)
142.CE
143Signals are printed as a signal symbol and a signal string.
144An excerpt from stracing and interrupting the command ``sleep 666'' is:
145.CW
146sigsuspend([] <unfinished ...>
147--- SIGINT (Interrupt) ---
148+++ killed by SIGINT +++
149.CE
Jan Kratochvil14256a72008-09-12 08:44:30 +0000150If a system call is being executed and meanwhile another one is being called
151from a different thread/process then
152.B strace
153will try to preserve the order of those events and mark the ongoing call as
154being \fIunfinished\fP. When the call returns it will be marked as
155\fIresumed\fP.
156.CW
157[pid 28772] select(4, [3], NULL, NULL, NULL <unfinished ...>
158[pid 28779] clock_gettime(CLOCK_REALTIME, {1130322148, 939977000}) = 0
159[pid 28772] <... select resumed> ) = 1 (in [3])
160.CE
161Interruption of a (restartable) system call by a signal delivery is processed
162differently as kernel terminates the system call and also arranges its
163immediate reexecution after the signal handler completes.
164.CW
165read(0, 0x7ffff72cf5cf, 1) = ? ERESTARTSYS (To be restarted)
166--- SIGALRM (Alarm clock) @ 0 (0) ---
167rt_sigreturn(0xe) = 0
168read(0, ""..., 1) = 0
169.CE
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000170Arguments are printed in symbolic form with a passion.
Roland McGrath0411b402003-10-22 06:16:32 +0000171This example shows the shell performing ``>>xyzzy'' output redirection:
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000172.CW
173open("xyzzy", O_WRONLY|O_APPEND|O_CREAT, 0666) = 3
174.CE
175Here the three argument form of open is decoded by breaking down the
176flag argument into its three bitwise-OR constituents and printing the
177mode value in octal by tradition. Where traditional or native
178usage differs from ANSI or POSIX, the latter forms are preferred.
Wichert Akkerman8829a551999-06-11 13:18:40 +0000179In some cases,
180.B strace
181output has proven to be more readable than the source.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000182.LP
183Structure pointers are dereferenced and the members are displayed
184as appropriate. In all cases arguments are formatted in the most C-like
185fashion possible.
186For example, the essence of the command ``ls \-l /dev/null'' is captured as:
187.CW
188lstat("/dev/null", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0
189.CE
190Notice how the `struct stat' argument is dereferenced and how each member is
191displayed symbolically. In particular, observe how the st_mode member
192is carefully decoded into a bitwise-OR of symbolic and numeric values.
193Also notice in this example that the first argument to lstat is an input
194to the system call and the second argument is an output. Since output
Wichert Akkerman8829a551999-06-11 13:18:40 +0000195arguments are not modified if the system call fails, arguments may not
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000196always be dereferenced. For example, retrying the ``ls \-l'' example
197with a non-existent file produces the following line:
198.CW
199lstat("/foo/bar", 0xb004) = -1 ENOENT (No such file or directory)
200.CE
201In this case the porch light is on but nobody is home.
202.LP
203Character pointers are dereferenced and printed as C strings.
204Non-printing characters in strings are normally represented by
205ordinary C escape codes.
206Only the first
207.I strsize
208(32 by default) bytes of strings are printed;
209longer strings have an ellipsis appended following the closing quote.
Wichert Akkerman8829a551999-06-11 13:18:40 +0000210Here is a line from ``ls \-l'' where the
211.B getpwuid
212library routine is reading the password file:
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000213.CW
214read(3, "root::0:0:System Administrator:/"..., 1024) = 422
215.CE
216While structures are annotated using curly braces, simple pointers
217and arrays are printed using square brackets with commas separating
218elements. Here is an example from the command ``id'' on a system with
219supplementary group ids:
220.CW
221getgroups(32, [100, 0]) = 2
222.CE
223On the other hand, bit-sets are also shown using square brackets
224but set elements are separated only by a space. Here is the shell
225preparing to execute an external command:
226.CW
227sigprocmask(SIG_BLOCK, [CHLD TTOU], []) = 0
228.CE
229Here the second argument is a bit-set of two signals, SIGCHLD and SIGTTOU.
230In some cases the bit-set is so full that printing out the unset
231elements is more valuable. In that case, the bit-set is prefixed by
232a tilde like this:
233.CW
234sigprocmask(SIG_UNBLOCK, ~[], NULL) = 0
235.CE
236Here the second argument represents the full set of all signals.
237.SH OPTIONS
238.TP 12
239.TP
240.B \-c
Roland McGrath4de04aa2004-08-31 07:47:47 +0000241Count time, calls, and errors for each system call and report a summary on
242program exit. On Linux, this attempts to show system time (CPU time spent
Roland McGrathcb9def62006-04-25 07:48:03 +0000243running in the kernel) independent of wall clock time. If -c is used with
244-f or -F (below), only aggregate totals for all traced processes are kept.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000245.TP
246.B \-d
Wichert Akkerman8829a551999-06-11 13:18:40 +0000247Show some debugging output of
248.B strace
249itself on the standard error.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000250.TP
251.B \-f
252Trace child processes as they are created by currently traced
Wichert Akkerman8829a551999-06-11 13:18:40 +0000253processes as a result of the
254.BR fork (2)
Roland McGrath41c48222008-07-18 00:25:10 +0000255system call.
256.IP
257On non-Linux platforms the new process is
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000258attached to as soon as its pid is known (through the return value of
Wichert Akkerman8829a551999-06-11 13:18:40 +0000259.BR fork (2)
260in the parent process). This means that such children may run
261uncontrolled for a while (especially in the case of a
262.BR vfork (2)),
263until the parent is scheduled again to complete its
264.RB ( v ) fork (2)
Roland McGrath41c48222008-07-18 00:25:10 +0000265call. On Linux the child is traced from its first instruction with no delay.
Wichert Akkerman8829a551999-06-11 13:18:40 +0000266If the parent process decides to
267.BR wait (2)
268for a child that is currently
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000269being traced, it is suspended until an appropriate child process either
270terminates or incurs a signal that would cause it to terminate (as
271determined from the child's current signal disposition).
Roland McGrath41c48222008-07-18 00:25:10 +0000272.IP
273On SunOS 4.x the tracing of
274.BR vfork s
275is accomplished with some dynamic linking trickery.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000276.TP
277.B \-ff
278If the
279.B \-o
280.I filename
281option is in effect, each processes trace is written to
282.I filename.pid
283where pid is the numeric process id of each process.
Roland McGrathcb9def62006-04-25 07:48:03 +0000284This is incompatible with -c, since no per-process counts are kept.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000285.TP
286.B \-F
Roland McGrath41c48222008-07-18 00:25:10 +0000287This option is now obsolete and it has the same functionality as
288.BR -f .
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000289.TP
290.B \-h
291Print the help summary.
292.TP
293.B \-i
294Print the instruction pointer at the time of the system call.
295.TP
296.B \-q
297Suppress messages about attaching, detaching etc. This happens
298automatically when output is redirected to a file and the command
299is run directly instead of attaching.
300.TP
301.B \-r
302Print a relative timestamp upon entry to each system call. This
303records the time difference between the beginning of successive
304system calls.
305.TP
306.B \-t
307Prefix each line of the trace with the time of day.
308.TP
309.B \-tt
310If given twice, the time printed will include the microseconds.
311.TP
312.B \-ttt
313If given thrice, the time printed will include the microseconds
314and the leading portion will be printed as the number
315of seconds since the epoch.
316.TP
317.B \-T
318Show the time spent in system calls. This records the time
319difference between the beginning and the end of each system call.
320.TP
321.B \-v
322Print unabbreviated versions of environment, stat, termios, etc.
323calls. These structures are very common in calls and so the default
324behavior displays a reasonable subset of structure members. Use
325this option to get all of the gory details.
326.TP
327.B \-V
Wichert Akkerman8829a551999-06-11 13:18:40 +0000328Print the version number of
329.BR strace .
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000330.TP
331.B \-x
Wichert Akkerman8829a551999-06-11 13:18:40 +0000332Print all non-ASCII strings in hexadecimal string format.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000333.TP
334.B \-xx
335Print all strings in hexadecimal string format.
336.TP
337.BI "\-a " column
Wichert Akkerman4dc8a2a1999-12-23 14:20:14 +0000338Align return values in a specific column (default column 40).
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000339.TP
340.BI "\-e " expr
341A qualifying expression which modifies which events to trace
342or how to trace them. The format of the expression is:
Wichert Akkerman8829a551999-06-11 13:18:40 +0000343.RS 15
344.IP
345[\fIqualifier\fB=\fR][\fB!\fR]\fIvalue1\fR[\fB,\fIvalue2\fR]...
346.RE
347.IP
348where
349.I qualifier
350is one of
351.BR trace ,
352.BR abbrev ,
353.BR verbose ,
354.BR raw ,
355.BR signal ,
356.BR read ,
357or
358.B write
359and
360.I value
361is a qualifier-dependent symbol or number. The default
362qualifier is
363.BR trace .
364Using an exclamation mark negates the set of values. For example,
365.B \-eopen
366means literally
367.B "\-e trace=open"
368which in turn means trace only the
369.B open
370system call. By contrast,
371.B "\-etrace=!open"
372means to trace every system call except
373.BR open .
374In addition, the special values
375.B all
376and
377.B none
378have the obvious meanings.
379.IP
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000380Note that some shells use the exclamation point for history
Wichert Akkerman8829a551999-06-11 13:18:40 +0000381expansion even inside quoted arguments. If so, you must escape
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000382the exclamation point with a backslash.
383.TP
384.BI "\-e trace=" set
385Trace only the specified set of system calls. The
386.B \-c
387option is useful for determining which system calls might be useful
Wichert Akkerman8829a551999-06-11 13:18:40 +0000388to trace. For example,
389.B trace=open,close,read,write
390means to only
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000391trace those four system calls. Be careful when making inferences
392about the user/kernel boundary if only a subset of system calls
Wichert Akkerman8829a551999-06-11 13:18:40 +0000393are being monitored. The default is
394.BR trace=all .
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000395.TP
396.B "\-e trace=file"
397Trace all system calls which take a file name as an argument. You
398can think of this as an abbreviation for
Wichert Akkerman8829a551999-06-11 13:18:40 +0000399.BR "\-e\ trace=open,stat,chmod,unlink," ...
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000400which is useful to seeing what files the process is referencing.
401Furthermore, using the abbreviation will ensure that you don't
402accidentally forget to include a call like
403.B lstat
404in the list. Betchya woulda forgot that one.
405.TP
406.B "\-e trace=process"
407Trace all system calls which involve process management. This
408is useful for watching the fork, wait, and exec steps of a process.
409.TP
410.B "\-e trace=network"
411Trace all the network related system calls.
412.TP
413.B "\-e trace=signal"
414Trace all signal related system calls.
415.TP
416.B "\-e trace=ipc"
417Trace all IPC related system calls.
418.TP
Roland McGrath2fe7b132005-07-05 03:25:35 +0000419.B "\-e trace=desc"
420Trace all file descriptor related system calls.
421.TP
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000422.BI "\-e abbrev=" set
423Abbreviate the output from printing each member of large structures.
Wichert Akkerman8829a551999-06-11 13:18:40 +0000424The default is
425.BR abbrev=all .
426The
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000427.B \-v
Wichert Akkerman8829a551999-06-11 13:18:40 +0000428option has the effect of
429.BR abbrev=none .
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000430.TP
431.BI "\-e verbose=" set
432Dereference structures for the specified set of system calls. The
Wichert Akkerman8829a551999-06-11 13:18:40 +0000433default is
434.BR verbose=all .
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000435.TP
436.BI "\-e raw=" set
Roland McGrath0411b402003-10-22 06:16:32 +0000437Print raw, undecoded arguments for the specified set of system calls.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000438This option has the effect of causing all arguments to be printed
439in hexadecimal. This is mostly useful if you don't trust the
440decoding or you need to know the actual numeric value of an
441argument.
442.TP
443.BI "\-e signal=" set
Wichert Akkerman8829a551999-06-11 13:18:40 +0000444Trace only the specified subset of signals. The default is
445.BR signal=all .
446For example,
447.B signal=!SIGIO
448(or
449.BR signal=!io )
450causes SIGIO signals not to be traced.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000451.TP
452.BI "\-e read=" set
Wichert Akkerman8829a551999-06-11 13:18:40 +0000453Perform a full hexadecimal and ASCII dump of all the data read from
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000454file descriptors listed in the specified set. For example, to see
455all input activity on file descriptors 3 and 5 use
456.BR "\-e read=3,5" .
Wichert Akkerman8829a551999-06-11 13:18:40 +0000457Note that this is independent from the normal tracing of the
458.BR read (2)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000459system call which is controlled by the option
460.BR "\-e trace=read" .
461.TP
462.BI "\-e write=" set
Wichert Akkerman8829a551999-06-11 13:18:40 +0000463Perform a full hexadecimal and ASCII dump of all the data written to
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000464file descriptors listed in the specified set. For example, to see
465all output activity on file descriptors 3 and 5 use
466.BR "\-e write=3,5" .
Wichert Akkerman8829a551999-06-11 13:18:40 +0000467Note that this is independent from the normal tracing of the
468.BR write (2)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000469system call which is controlled by the option
470.BR "\-e trace=write" .
471.TP
472.BI "\-o " filename
473Write the trace output to the file
474.I filename
475rather than to stderr.
476Use
477.I filename.pid
478if
479.B \-ff
480is used.
481If the argument begins with `|' or with `!' then the rest of the
482argument is treated as a command and all output is piped to it.
483This is convenient for piping the debugging output to a program
484without affecting the redirections of executed programs.
485.TP
486.BI "\-O " overhead
Wichert Akkerman8829a551999-06-11 13:18:40 +0000487Set the overhead for tracing system calls to
488.I overhead
489microseconds.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000490This is useful for overriding the default heuristic for guessing
491how much time is spent in mere measuring when timing system calls using
492the
493.B \-c
Roland McGrath0411b402003-10-22 06:16:32 +0000494option. The accuracy of the heuristic can be gauged by timing a given
Wichert Akkerman8829a551999-06-11 13:18:40 +0000495program run without tracing (using
496.BR time (1))
497and comparing the accumulated
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000498system call time to the total produced using
Wichert Akkerman8829a551999-06-11 13:18:40 +0000499.BR \-c .
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000500.TP
501.BI "\-p " pid
502Attach to the process with the process
503.SM ID
504.I pid
505and begin tracing.
506The trace may be terminated
507at any time by a keyboard interrupt signal (\c
508.SM CTRL\s0-C).
509.B strace
510will respond by detaching itself from the traced process(es)
511leaving it (them) to continue running.
512Multiple
513.B \-p
514options can be used to attach to up to 32 processes in addition to
515.I command
516(which is optional if at least one
517.B \-p
518option is given).
519.TP
520.BI "\-s " strsize
521Specify the maximum string size to print (the default is 32). Note
522that filenames are not considered strings and are always printed in
523full.
524.TP
525.BI "\-S " sortby
526Sort the output of the histogram printed by the
527.B \-c
Roland McGrath0411b402003-10-22 06:16:32 +0000528option by the specified criterion. Legal values are
Wichert Akkerman8829a551999-06-11 13:18:40 +0000529.BR time ,
530.BR calls ,
531.BR name ,
532and
533.B nothing
534(default
535.BR time ).
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000536.TP
537.BI "\-u " username
Wichert Akkerman8829a551999-06-11 13:18:40 +0000538Run command with the user \s-1ID\s0, group \s-2ID\s0, and
539supplementary groups of
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000540.IR username .
541This option is only useful when running as root and enables the
542correct execution of setuid and/or setgid binaries.
543Unless this option is used setuid and setgid programs are executed
544without effective privileges.
Roland McGrath4417fda2003-01-24 04:31:20 +0000545.TP
546.BI "\-E " var=val
547Run command with
548.IR var=val
549in its list of environment variables.
550.TP
551.BI "\-E " var
552Remove
553.IR var
554from the inherited list of environment variables before passing it on to
555the command.
Roland McGratha09353a2008-12-10 06:09:29 +0000556.SH DIAGNOSTICS
557When
558.I command
559exits,
560.B strace
561exits with the same exit status.
562If
563.I command
564is terminated by a signal,
565.B strace
566terminates itself with the same signal, so that
567.B strace
568can be used as a wrapper process transparent to the invoking parent process.
569.LP
570When using
571.BR -p ,
572the exit status of
573.B strace
574is zero unless there was an unexpected error in doing the tracing.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000575.SH "SETUID INSTALLATION"
576If
577.B strace
578is installed setuid to root then the invoking user will be able to
579attach to and trace processes owned by any user.
580In addition setuid and setgid programs will be executed and traced
581with the correct effective privileges.
582Since only users trusted with full root privileges should be allowed
583to do these things,
584it only makes sense to install
585.B strace
586as setuid to root when the users who can execute it are restricted
587to those users who have this trust.
588For example, it makes sense to install a special version of
Wichert Akkerman8829a551999-06-11 13:18:40 +0000589.B strace
590with mode `rwsr-xr--', user
591.B root
592and group
593.BR trace ,
594where members of the
595.B trace
596group are trusted users.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000597If you do use this feature, please remember to install
Wichert Akkerman8829a551999-06-11 13:18:40 +0000598a non-setuid version of
599.B strace
600for ordinary lusers to use.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000601.SH "SEE ALSO"
Roland McGrath7f7f4362005-12-02 03:59:35 +0000602.BR ltrace (1),
Wichert Akkerman8829a551999-06-11 13:18:40 +0000603.BR time (1),
Roland McGrath7f7f4362005-12-02 03:59:35 +0000604.BR ptrace (2),
605.BR proc (5)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000606.SH NOTES
607It is a pity that so much tracing clutter is produced by systems
608employing shared libraries.
609.LP
610It is instructive to think about system call inputs and outputs
611as data-flow across the user/kernel boundary. Because user-space
612and kernel-space are separate and address-protected, it is
613sometimes possible to make deductive inferences about process
614behavior using inputs and outputs as propositions.
615.LP
616In some cases, a system call will differ from the documented behavior
Wichert Akkerman8829a551999-06-11 13:18:40 +0000617or have a different name. For example, on System V-derived systems
618the true
619.BR time (2)
620system call does not take an argument and the
621.B stat
622function is called
623.B xstat
624and takes an extra leading argument. These
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000625discrepancies are normal but idiosyncratic characteristics of the
626system call interface and are accounted for by C library wrapper
627functions.
628.LP
629On some platforms a process that has a system call trace applied
630to it with the
631.B \-p
632option will receive a
633.BR \s-1SIGSTOP\s0 .
634This signal may interrupt a system call that is not restartable.
635This may have an unpredictable effect on the process
636if the process takes no action to restart the system call.
637.SH BUGS
638Programs that use the
639.I setuid
640bit do not have
641effective user
642.SM ID
643privileges while being traced.
644.LP
645A traced process ignores
646.SM SIGSTOP
Nate Sammonsb4aa1131999-03-31 05:59:04 +0000647except on SVR4 platforms.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000648.LP
649A traced process which tries to block SIGTRAP will be sent a SIGSTOP
650in an attempt to force continuation of tracing.
651.LP
652A traced process runs slowly.
653.LP
654Traced processes which are descended from
655.I command
656may be left running after an interrupt signal (\c
657.SM CTRL\s0-C).
658.LP
659On Linux, exciting as it would be, tracing the init process is forbidden.
660.LP
661The
662.B \-i
663option is weakly supported.
664.SH HISTORY
665.B strace
Wichert Akkerman8829a551999-06-11 13:18:40 +0000666The original
667.B strace
668was written by Paul Kranenburg
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000669for SunOS and was inspired by its trace utility.
Wichert Akkerman8829a551999-06-11 13:18:40 +0000670The SunOS version of
671.B strace
672was ported to Linux and enhanced
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000673by Branko Lankester, who also wrote the Linux kernel support.
Wichert Akkerman8829a551999-06-11 13:18:40 +0000674Even though Paul released
675.B strace
6762.5 in 1992,
677Branko's work was based on Paul's
678.B strace
6791.5 release from 1991.
680In 1993, Rick Sladkey merged
681.B strace
6822.5 for SunOS and the second release of
683.B strace
684for Linux, added many of the features of
685.BR truss (1)
686from SVR4, and produced an
687.B strace
688that worked on both platforms. In 1994 Rick ported
689.B strace
690to SVR4 and Solaris and wrote the
691automatic configuration support. In 1995 he ported
692.B strace
693to Irix
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000694and tired of writing about himself in the third person.
Roland McGrath98a3ecf2008-08-28 23:41:57 +0000695.SH BUGS
696The SIGTRAP signal is used internally by the kernel implementation of
697system call tracing. When a traced process receives a SIGTRAP signal not
698associated with tracing, strace will not report that signal correctly.
699This signal is not normally used by programs, but could be via a hard-coded
700break instruction or via kill(2).
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000701.SH PROBLEMS
702Problems with
703.B strace
Roland McGrath4a9b49a2003-01-14 23:40:55 +0000704should be reported via the Debian Bug Tracking System,
705or to the
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000706.B strace
Roland McGrath4a9b49a2003-01-14 23:40:55 +0000707mailing list at <strace-devel@lists.sourceforge.net>.