]> granicus.if.org Git - strace/blob - strace.1
tests: remove redundant SAMPLE_SIZE definitions
[strace] / strace.1
1 .\" 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 .de CW
28 .sp
29 .nf
30 .ft CW
31 ..
32 .de CE
33 .ft R
34 .fi
35 .sp
36 ..
37 .\" Macro IX is not defined in the groff macros
38 .if \n(.g \{\
39 .  de IX
40 ..
41 .\}
42 .TH STRACE 1 "2010-03-30"
43 .SH NAME
44 strace \- trace system calls and signals
45 .SH SYNOPSIS
46 .B strace
47 [\fB-CdffhikqrtttTvVxxy\fR]
48 [\fB-I\fIn\fR]
49 [\fB-b\fIexecve\fR]
50 [\fB-e\fIexpr\fR]...
51 [\fB-a\fIcolumn\fR]
52 [\fB-o\fIfile\fR]
53 [\fB-s\fIstrsize\fR]
54 [\fB-P\fIpath\fR]... \fB-p\fIpid\fR... /
55 [\fB-D\fR]
56 [\fB-E\fIvar\fR[=\fIval\fR]]... [\fB-u\fIusername\fR]
57 \fIcommand\fR [\fIargs\fR]
58 .sp
59 .B strace
60 \fB-c\fR[\fBdf\fR]
61 [\fB-I\fIn\fR]
62 [\fB-b\fIexecve\fR]
63 [\fB-e\fIexpr\fR]...
64 [\fB-O\fIoverhead\fR]
65 [\fB-S\fIsortby\fR] \fB-p\fIpid\fR... /
66 [\fB-D\fR]
67 [\fB-E\fIvar\fR[=\fIval\fR]]... [\fB-u\fIusername\fR]
68 \fIcommand\fR [\fIargs\fR]
69 .SH DESCRIPTION
70 .IX "strace command" "" "\fLstrace\fR command"
71 .LP
72 In the simplest case
73 .B strace
74 runs the specified
75 .I command
76 until it exits.
77 It intercepts and records the system calls which are called
78 by a process and the signals which are received by a process.
79 The name of each system call, its arguments and its return value
80 are printed on standard error or to the file specified with the
81 .B \-o
82 option.
83 .LP
84 .B strace
85 is a useful diagnostic, instructional, and debugging tool.
86 System administrators, diagnosticians and trouble-shooters will find
87 it invaluable for solving problems with
88 programs for which the source is not readily available since
89 they do not need to be recompiled in order to trace them.
90 Students, hackers and the overly-curious will find that
91 a great deal can be learned about a system and its system calls by
92 tracing even ordinary programs.  And programmers will find that
93 since system calls and signals are events that happen at the user/kernel
94 interface, a close examination of this boundary is very
95 useful for bug isolation, sanity checking and
96 attempting to capture race conditions.
97 .LP
98 Each line in the trace contains the system call name, followed
99 by its arguments in parentheses and its return value.
100 An example from stracing the command "cat /dev/null" is:
101 .CW
102 open("/dev/null", O_RDONLY) = 3
103 .CE
104 Errors (typically a return value of \-1) have the errno symbol
105 and error string appended.
106 .CW
107 open("/foo/bar", O_RDONLY) = \-1 ENOENT (No such file or directory)
108 .CE
109 Signals are printed as signal symbol and decoded siginfo structure.
110 An excerpt from stracing and interrupting the command "sleep 666" is:
111 .CW
112 sigsuspend([] <unfinished ...>
113 --- SIGINT {si_signo=SIGINT, si_code=SI_USER, si_pid=...} ---
114 +++ killed by SIGINT +++
115 .CE
116 If a system call is being executed and meanwhile another one is being called
117 from a different thread/process then
118 .B strace
119 will try to preserve the order of those events and mark the ongoing call as
120 being
121 .IR unfinished .
122 When the call returns it will be marked as
123 .IR resumed .
124 .CW
125 [pid 28772] select(4, [3], NULL, NULL, NULL <unfinished ...>
126 [pid 28779] clock_gettime(CLOCK_REALTIME, {1130322148, 939977000}) = 0
127 [pid 28772] <... select resumed> )      = 1 (in [3])
128 .CE
129 Interruption of a (restartable) system call by a signal delivery is processed
130 differently as kernel terminates the system call and also arranges its
131 immediate reexecution after the signal handler completes.
132 .CW
133 read(0, 0x7ffff72cf5cf, 1)              = ? ERESTARTSYS (To be restarted)
134 --- SIGALRM ... ---
135 rt_sigreturn(0xe)                       = 0
136 read(0, "", 1)                          = 0
137 .CE
138 Arguments are printed in symbolic form with a passion.
139 This example shows the shell performing ">>xyzzy" output redirection:
140 .CW
141 open("xyzzy", O_WRONLY|O_APPEND|O_CREAT, 0666) = 3
142 .CE
143 Here the third argument of open is decoded by breaking down the
144 flag argument into its three bitwise-OR constituents and printing the
145 mode value in octal by tradition.  Where traditional or native
146 usage differs from ANSI or POSIX, the latter forms are preferred.
147 In some cases,
148 .B strace
149 output has proven to be more readable than the source.
150 .LP
151 Structure pointers are dereferenced and the members are displayed
152 as appropriate.  In all cases arguments are formatted in the most C-like
153 fashion possible.
154 For example, the essence of the command "ls \-l /dev/null" is captured as:
155 .CW
156 lstat("/dev/null", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0
157 .CE
158 Notice how the 'struct stat' argument is dereferenced and how each member is
159 displayed symbolically.  In particular, observe how the st_mode member
160 is carefully decoded into a bitwise-OR of symbolic and numeric values.
161 Also notice in this example that the first argument to lstat is an input
162 to the system call and the second argument is an output.  Since output
163 arguments are not modified if the system call fails, arguments may not
164 always be dereferenced.  For example, retrying the "ls \-l" example
165 with a non-existent file produces the following line:
166 .CW
167 lstat("/foo/bar", 0xb004) = \-1 ENOENT (No such file or directory)
168 .CE
169 In this case the porch light is on but nobody is home.
170 .LP
171 Character pointers are dereferenced and printed as C strings.
172 Non-printing characters in strings are normally represented by
173 ordinary C escape codes.
174 Only the first
175 .I strsize
176 (32 by default) bytes of strings are printed;
177 longer strings have an ellipsis appended following the closing quote.
178 Here is a line from "ls \-l" where the
179 .B getpwuid
180 library routine is reading the password file:
181 .CW
182 read(3, "root::0:0:System Administrator:/"..., 1024) = 422
183 .CE
184 While structures are annotated using curly braces, simple pointers
185 and arrays are printed using square brackets with commas separating
186 elements.  Here is an example from the command "id" on a system with
187 supplementary group ids:
188 .CW
189 getgroups(32, [100, 0]) = 2
190 .CE
191 On the other hand, bit-sets are also shown using square brackets
192 but set elements are separated only by a space.  Here is the shell
193 preparing to execute an external command:
194 .CW
195 sigprocmask(SIG_BLOCK, [CHLD TTOU], []) = 0
196 .CE
197 Here the second argument is a bit-set of two signals, SIGCHLD and SIGTTOU.
198 In some cases the bit-set is so full that printing out the unset
199 elements is more valuable.  In that case, the bit-set is prefixed by
200 a tilde like this:
201 .CW
202 sigprocmask(SIG_UNBLOCK, ~[], NULL) = 0
203 .CE
204 Here the second argument represents the full set of all signals.
205 .SH OPTIONS
206 .SS Output format
207 .TP 12
208 .TP
209 .BI "\-a " column
210 Align return values in a specific column (default column 40).
211 .TP
212 .B \-i
213 Print the instruction pointer at the time of the system call.
214 .TP
215 .B \-k
216 Print the execution stack trace of the traced processes after each system call (experimental).
217 This option is available only if
218 .B strace
219 is built with libunwind.
220 .TP
221 .BI "\-o " filename
222 Write the trace output to the file
223 .I filename
224 rather than to stderr.
225 Use
226 .I filename.pid
227 if
228 .B \-ff
229 is used.
230 If the argument begins with '|' or with '!' then the rest of the
231 argument is treated as a command and all output is piped to it.
232 This is convenient for piping the debugging output to a program
233 without affecting the redirections of executed programs.
234 .TP
235 .B \-q
236 Suppress messages about attaching, detaching etc.  This happens
237 automatically when output is redirected to a file and the command
238 is run directly instead of attaching.
239 .TP
240 .B \-qq
241 If given twice, suppress messages about process exit status.
242 .TP
243 .B \-r
244 Print a relative timestamp upon entry to each system call.  This
245 records the time difference between the beginning of successive
246 system calls.
247 .TP
248 .BI "\-s " strsize
249 Specify the maximum string size to print (the default is 32).  Note
250 that filenames are not considered strings and are always printed in
251 full.
252 .TP
253 .B \-t
254 Prefix each line of the trace with the time of day.
255 .TP
256 .B \-tt
257 If given twice, the time printed will include the microseconds.
258 .TP
259 .B \-ttt
260 If given thrice, the time printed will include the microseconds
261 and the leading portion will be printed as the number
262 of seconds since the epoch.
263 .TP
264 .B \-T
265 Show the time spent in system calls.  This records the time
266 difference between the beginning and the end of each system call.
267 .TP
268 .B \-x
269 Print all non-ASCII strings in hexadecimal string format.
270 .TP
271 .B \-xx
272 Print all strings in hexadecimal string format.
273 .TP
274 .B \-y
275 Print paths associated with file descriptor arguments.
276 .TP
277 .B \-yy
278 Print protocol specific information associated with socket file descriptors.
279 .SS Statistics
280 .TP 12
281 .TP
282 .B \-c
283 Count time, calls, and errors for each system call and report a summary on
284 program exit.  On Linux, this attempts to show system time (CPU time spent
285 running in the kernel) independent of wall clock time.  If
286 .B \-c
287 is used with
288 .B \-f
289 or
290 .B \-F
291 , only aggregate totals for all traced processes are kept.
292 .TP
293 .B \-C
294 Like
295 .B \-c
296 but also print regular output while processes are running.
297 .TP
298 .BI "\-O " overhead
299 Set the overhead for tracing system calls to
300 .I overhead
301 microseconds.
302 This is useful for overriding the default heuristic for guessing
303 how much time is spent in mere measuring when timing system calls using
304 the
305 .B \-c
306 option.  The accuracy of the heuristic can be gauged by timing a given
307 program run without tracing (using
308 .BR time (1))
309 and comparing the accumulated
310 system call time to the total produced using
311 .BR \-c .
312 .TP
313 .BI "\-S " sortby
314 Sort the output of the histogram printed by the
315 .B \-c
316 option by the specified criterion.  Legal values are
317 .BR time ,
318 .BR calls ,
319 .BR name ,
320 and
321 .B nothing
322 (default is
323 .BR time ).
324 .TP
325 .B \-w
326 Summarise the time difference between the beginning and end of
327 each system call.  The default is to summarise the system time.
328 .SS Filtering
329 .TP 12
330 .TP
331 .BI "\-e " expr
332 A qualifying expression which modifies which events to trace
333 or how to trace them.  The format of the expression is:
334 .RS 15
335 .IP
336 [\,\fIqualifier\/\fB=\fR][\fB!\fR]\,\fIvalue1\/\fR[\fB,\,\fIvalue2\/\fR]...
337 .RE
338 .IP
339 where
340 .I qualifier
341 is one of
342 .BR trace ,
343 .BR abbrev ,
344 .BR verbose ,
345 .BR raw ,
346 .BR signal ,
347 .BR read ,
348 .BR write ,
349 or
350 .B fault
351 and
352 .I value
353 is a qualifier-dependent symbol or number.  The default
354 qualifier is
355 .BR trace .
356 Using an exclamation mark negates the set of values.  For example,
357 .BR \-e "\ " open
358 means literally
359 .BR \-e "\ " trace = open
360 which in turn means trace only the
361 .B open
362 system call.  By contrast,
363 .BR \-e "\ " trace "=!" open
364 means to trace every system call except
365 .BR open .
366 In addition, the special values
367 .B all
368 and
369 .B none
370 have the obvious meanings.
371 .IP
372 Note that some shells use the exclamation point for history
373 expansion even inside quoted arguments.  If so, you must escape
374 the exclamation point with a backslash.
375 .TP
376 \fB\-e\ trace\fR=\,\fIset\fR
377 Trace only the specified set of system calls.  The
378 .B \-c
379 option is useful for determining which system calls might be useful
380 to trace.  For example,
381 .BR trace = open,close,read,write
382 means to only
383 trace those four system calls.  Be careful when making inferences
384 about the user/kernel boundary if only a subset of system calls
385 are being monitored.  The default is
386 .BR trace = all .
387 .TP
388 .BR "\-e\ trace" = file
389 Trace all system calls which take a file name as an argument.  You
390 can think of this as an abbreviation for
391 .BR "\-e\ trace" = open , stat , chmod , unlink ,...
392 which is useful to seeing what files the process is referencing.
393 Furthermore, using the abbreviation will ensure that you don't
394 accidentally forget to include a call like
395 .B lstat
396 in the list.  Betchya woulda forgot that one.
397 .TP
398 .BR "\-e\ trace" = process
399 Trace all system calls which involve process management.  This
400 is useful for watching the fork, wait, and exec steps of a process.
401 .TP
402 .BR "\-e\ trace" = network
403 Trace all the network related system calls.
404 .TP
405 .BR "\-e\ trace" = signal
406 Trace all signal related system calls.
407 .TP
408 .BR "\-e\ trace" = ipc
409 Trace all IPC related system calls.
410 .TP
411 .BR "\-e\ trace" = desc
412 Trace all file descriptor related system calls.
413 .TP
414 .BR "\-e\ trace" = memory
415 Trace all memory mapping related system calls.
416 .TP
417 \fB\-e\ abbrev\fR=\,\fIset\fR
418 Abbreviate the output from printing each member of large structures.
419 The default is
420 .BR abbrev = all .
421 The
422 .B \-v
423 option has the effect of
424 .BR abbrev = none .
425 .TP
426 \fB\-e\ verbose\fR=\,\fIset\fR
427 Dereference structures for the specified set of system calls.  The
428 default is
429 .BR verbose = all .
430 .TP
431 \fB\-e\ raw\fR=\,\fIset\fR
432 Print raw, undecoded arguments for the specified set of system calls.
433 This option has the effect of causing all arguments to be printed
434 in hexadecimal.  This is mostly useful if you don't trust the
435 decoding or you need to know the actual numeric value of an
436 argument.
437 .TP
438 \fB\-e\ signal\fR=\,\fIset\fR
439 Trace only the specified subset of signals.  The default is
440 .BR signal = all .
441 For example,
442 .B signal "=!" SIGIO
443 (or
444 .BR signal "=!" io )
445 causes SIGIO signals not to be traced.
446 .TP
447 \fB\-e\ read\fR=\,\fIset\fR
448 Perform a full hexadecimal and ASCII dump of all the data read from
449 file descriptors listed in the specified set.  For example, to see
450 all input activity on file descriptors
451 .I 3
452 and
453 .I 5
454 use
455 \fB\-e\ read\fR=\,\fI3\fR,\fI5\fR.
456 Note that this is independent from the normal tracing of the
457 .BR read (2)
458 system call which is controlled by the option
459 .BR -e "\ " trace = read .
460 .TP
461 \fB\-e\ write\fR=\,\fIset\fR
462 Perform a full hexadecimal and ASCII dump of all the data written to
463 file descriptors listed in the specified set.  For example, to see
464 all output activity on file descriptors
465 .I 3
466 and
467 .I 5
468 use
469 \fB\-e\ write\fR=\,\fI3\fR,\,\fI5\fR.
470 Note that this is independent from the normal tracing of the
471 .BR write (2)
472 system call which is controlled by the option
473 .BR -e "\ " trace = write .
474 .TP
475 \fB\-e\ fault\fR=\,\fIset\/\fR[:\fBerror\fR=\,\fIerrno\/\fR][:\fBsignal\fR=\,\fIsig\/\fR][:\fBwhen\fR=\,\fIexpr\/\fR]
476 Perform a syscall fault injection for the specified set of syscalls.
477 When a fault is injected into a syscall invocation, the syscall number
478 is replaced by -1 which corresponds to an invalid syscall.
479
480 If an error code is specified using a symbolic
481 .I errno
482 value like
483 .B ENOSYS
484 or a numeric value within 1..4095 range, this error code overrides
485 the default error code returned by the kernel, which is traditionally
486 .B ENOSYS
487 for invalid syscall numbers on most architectures.
488
489 If a signal is specified using either a symbolic value like
490 .B SIGSEGV
491 or a numeric value within 1..\fBSIGRTMAX\fR range,
492 that signal is delivered on entering every syscall specified by the
493 .IR set .
494
495 If :\fBsignal\fR=\,\fIsig\/\fR option is specified without
496 :\fBerror\fR=\,\fIerrno\/\fR option, then only a signal
497 .I sig
498 is delivered without a syscall fault injection.
499 Conversely, :\fBerror\fR=\,\fIerrno\/\fR option without
500 :\fBsignal\fR=\,\fIsig\/\fR option injects a fault without delivering a signal.
501
502 If both :\fBerror\fR=\,\fIerrno\/\fR and :\fBsignal\fR=\,\fIsig\/\fR
503 options are specified, then both a fault is injected with the specified
504 error code
505 .I errno
506 and a signal
507 .I sig
508 is delivered.
509
510 Unless a :\fBwhen\fR=\,\fIexpr\fR subexpression is specified,
511 an injection is being made into every invocation of each syscall from the
512 .IR set .
513
514 The format of the subexpression is one of the following:
515 .RS
516 .IP "" 2
517 .I first
518 .RS 4
519 For every syscall from the
520 .IR set ,
521 perform a syscall fault injection for the syscall invocation number
522 .I first
523 only.
524 .RE
525 .IP "" 2
526 \fIfirst\/\fB+\fR
527 .RS 4
528 For every syscall from the
529 .IR set ,
530 perform syscall fault injections for the syscall invocation number
531 .I first
532 and all subsequent invocations.
533 .RE
534 .IP "" 2
535 \fIfirst\/\fB+\fIstep\fR
536 .RS 4
537 For every syscall from the
538 .IR set ,
539 perform syscall fault injections for syscall invocations number
540 .IR first ,
541 .IR first + step ,
542 .IR first + step + step ,
543 and so on.
544 .RE
545 .RE
546 .IP
547 For example, to fail each third and subsequent chdir syscalls with
548 .BR ENOENT ,
549 use
550 \fB\-e\ fault\fR=\,\fIchdir\/\fR:\fBerror\fR=\,\fIENOENT\/\fR:\fBwhen\fR=\,\fI3\/\fB+\fR.
551
552 The valid range for numbers
553 .I first
554 and
555 .I step
556 is 1..65535.
557
558 If a fault expression contains multiple
559 .BR error =
560 specifications, the last one takes precedence.
561 Likewise, if a fault expression contains multiple
562 .BR when =
563 specifications, the last one takes precedence.
564
565 Accounting of syscalls that are subject to fault injection
566 is done per syscall and per tracee.
567
568 Specification of syscall fault injection can be combined
569 with other syscall filtering options, for example,
570 \fB\-P \fI/dev/urandom \fB\-e fault\fR=\,\fIall\/\fR:\fBerror\fR=\,\fIENOENT\fR.
571 .TP
572 .BI "\-P " path
573 Trace only system calls accessing
574 .IR path .
575 Multiple
576 .B \-P
577 options can be used to specify several paths.
578 .TP
579 .B \-v
580 Print unabbreviated versions of environment, stat, termios, etc.
581 calls.  These structures are very common in calls and so the default
582 behavior displays a reasonable subset of structure members.  Use
583 this option to get all of the gory details.
584 .SS Tracing
585 .TP 12
586 .TP
587 .BI "\-b " syscall
588 If specified syscall is reached, detach from traced process.
589 Currently, only
590 .I execve
591 syscall is supported.  This option is useful if you want to trace
592 multi-threaded process and therefore require -f, but don't want
593 to trace its (potentially very complex) children.
594 .TP
595 .B \-D
596 Run tracer process as a detached grandchild, not as parent of the
597 tracee.  This reduces the visible effect of
598 .B strace
599 by keeping the tracee a direct child of the calling process.
600 .TP
601 .B \-f
602 Trace child processes as they are created by currently traced
603 processes as a result of the
604 .BR fork (2),
605 .BR vfork (2)
606 and
607 .BR clone (2)
608 system calls.  Note that
609 .B \-p
610 .I PID
611 .B \-f
612 will attach all threads of process PID if it is multi-threaded,
613 not only thread with thread_id = PID.
614 .TP
615 .B \-ff
616 If the
617 .B \-o
618 .I filename
619 option is in effect, each processes trace is written to
620 .I filename.pid
621 where pid is the numeric process id of each process.
622 This is incompatible with
623 .BR \-c ,
624 since no per-process counts are kept.
625 .TP
626 .BI "\-I " interruptible
627 When strace can be interrupted by signals (such as pressing ^C).
628 1: no signals are blocked; 2: fatal signals are blocked while decoding syscall
629 (default); 3: fatal signals are always blocked (default if '-o FILE PROG');
630 4: fatal signals and SIGTSTP (^Z) are always blocked (useful to make
631 strace -o FILE PROG not stop on ^Z).
632 .SS Startup
633 .TP 12
634 .TP
635 \fB\-E\ \fIvar\fR=\,\fIval\fR
636 Run command with
637 .IR var = val
638 in its list of environment variables.
639 .TP
640 .BI "\-E " var
641 Remove
642 .IR var
643 from the inherited list of environment variables before passing it on to
644 the command.
645 .TP
646 .BI "\-p " pid
647 Attach to the process with the process
648 .SM ID
649 .I pid
650 and begin tracing.
651 The trace may be terminated
652 at any time by a keyboard interrupt signal (\c
653 .SM CTRL\s0-C).
654 .B strace
655 will respond by detaching itself from the traced process(es)
656 leaving it (them) to continue running.
657 Multiple
658 .B \-p
659 options can be used to attach to many processes in addition to
660 .I command
661 (which is optional if at least one
662 .B \-p
663 option is given).
664 .B \-p
665 "`pidof PROG`" syntax is supported.
666 .TP
667 .BI "\-u " username
668 Run command with the user \s-1ID\s0, group \s-2ID\s0, and
669 supplementary groups of
670 .IR username .
671 This option is only useful when running as root and enables the
672 correct execution of setuid and/or setgid binaries.
673 Unless this option is used setuid and setgid programs are executed
674 without effective privileges.
675 .SS Miscellaneous
676 .TP 12
677 .TP
678 .B \-d
679 Show some debugging output of
680 .B strace
681 itself on the standard error.
682 .TP
683 .B \-F
684 This option is now obsolete and it has the same functionality as
685 .BR \-f .
686 .TP
687 .B \-h
688 Print the help summary.
689 .TP
690 .B \-V
691 Print the version number of
692 .BR strace .
693 .SH DIAGNOSTICS
694 When
695 .I command
696 exits,
697 .B strace
698 exits with the same exit status.
699 If
700 .I command
701 is terminated by a signal,
702 .B strace
703 terminates itself with the same signal, so that
704 .B strace
705 can be used as a wrapper process transparent to the invoking parent process.
706 Note that parent-child relationship (signal stop notifications,
707 getppid() value, etc) between traced process and its parent are not preserved
708 unless
709 .B \-D
710 is used.
711 .LP
712 When using
713 .B \-p
714 without a
715 .IR command ,
716 the exit status of
717 .B strace
718 is zero unless no processes has been attached or there was an unexpected error
719 in doing the tracing.
720 .SH "SETUID INSTALLATION"
721 If
722 .B strace
723 is installed setuid to root then the invoking user will be able to
724 attach to and trace processes owned by any user.
725 In addition setuid and setgid programs will be executed and traced
726 with the correct effective privileges.
727 Since only users trusted with full root privileges should be allowed
728 to do these things,
729 it only makes sense to install
730 .B strace
731 as setuid to root when the users who can execute it are restricted
732 to those users who have this trust.
733 For example, it makes sense to install a special version of
734 .B strace
735 with mode 'rwsr-xr--', user
736 .B root
737 and group
738 .BR trace ,
739 where members of the
740 .B trace
741 group are trusted users.
742 If you do use this feature, please remember to install
743 a non-setuid version of
744 .B strace
745 for ordinary lusers to use.
746 .SH NOTES
747 It is a pity that so much tracing clutter is produced by systems
748 employing shared libraries.
749 .LP
750 It is instructive to think about system call inputs and outputs
751 as data-flow across the user/kernel boundary.  Because user-space
752 and kernel-space are separate and address-protected, it is
753 sometimes possible to make deductive inferences about process
754 behavior using inputs and outputs as propositions.
755 .LP
756 In some cases, a system call will differ from the documented behavior
757 or have a different name.  For example, on System V-derived systems
758 the true
759 .BR time (2)
760 system call does not take an argument and the
761 .B stat
762 function is called
763 .B xstat
764 and takes an extra leading argument.  These
765 discrepancies are normal but idiosyncratic characteristics of the
766 system call interface and are accounted for by C library wrapper
767 functions.
768 .LP
769 Some system calls have different names in different architectures and
770 personalities.  In these cases, system call filtering and printing
771 uses the names that match corresponding
772 .BR __NR_ *
773 kernel macros of the tracee's architecture and personality.
774 There are two exceptions from this general rule:
775 .BR arm_fadvise64_64 (2)
776 ARM syscall and
777 .BR xtensa_fadvise64_64 (2)
778 Xtensa syscall are filtered and printed as
779 .BR fadvise64_64 (2).
780 .LP
781 On some platforms a process that is attached to with the
782 .B \-p
783 option may observe a spurious EINTR return from the current
784 system call that is not restartable.  (Ideally, all system calls
785 should be restarted on strace attach, making the attach invisible
786 to the traced process, but a few system calls aren't.
787 Arguably, every instance of such behavior is a kernel bug.)
788 This may have an unpredictable effect on the process
789 if the process takes no action to restart the system call.
790 .SH BUGS
791 Programs that use the
792 .I setuid
793 bit do not have
794 effective user
795 .SM ID
796 privileges while being traced.
797 .LP
798 A traced process runs slowly.
799 .LP
800 Traced processes which are descended from
801 .I command
802 may be left running after an interrupt signal (\c
803 .SM CTRL\s0-C).
804 .LP
805 The
806 .B \-i
807 option is weakly supported.
808 .SH HISTORY
809 The original
810 .B strace
811 was written by Paul Kranenburg
812 for SunOS and was inspired by its trace utility.
813 The SunOS version of
814 .B strace
815 was ported to Linux and enhanced
816 by Branko Lankester, who also wrote the Linux kernel support.
817 Even though Paul released
818 .B strace
819 2.5 in 1992,
820 Branko's work was based on Paul's
821 .B strace
822 1.5 release from 1991.
823 In 1993, Rick Sladkey merged
824 .B strace
825 2.5 for SunOS and the second release of
826 .B strace
827 for Linux, added many of the features of
828 .BR truss (1)
829 from SVR4, and produced an
830 .B strace
831 that worked on both platforms.  In 1994 Rick ported
832 .B strace
833 to SVR4 and Solaris and wrote the
834 automatic configuration support.  In 1995 he ported
835 .B strace
836 to Irix
837 and tired of writing about himself in the third person.
838 .SH REPORTING BUGS
839 Problems with
840 .B strace
841 should be reported to the
842 .B strace
843 mailing list at <strace\-devel@lists.sourceforge.net>.
844 .SH "SEE ALSO"
845 .BR ltrace (1),
846 .BR time (1),
847 .BR ptrace (2),
848 .BR proc (5)