]> granicus.if.org Git - strace/blobdiff - strace.1.in
strace.1.in: document -e kvm=vcpu option
[strace] / strace.1.in
index bb402747310669a1a7a1ea95c0471cfe885c2ef2..951431ab8dabbb3a2ff9507eacaf497ee8a7bf26 100644 (file)
 strace \- trace system calls and signals
 .SH SYNOPSIS
 .SY strace
-.OP \-CdffhikqrtttTvVxxy
+.if '@ENABLE_STACKTRACE_TRUE@'#' .ig end_unwind_opt
+.OP \-ACdffhikqrtttTvVxxy
+.end_unwind_opt
+.if '@ENABLE_STACKTRACE_FALSE@'#' .ig end_no_unwind_opt
+.OP \-ACdffhiqrtttTvVxxy
+.end_no_unwind_opt
 .OP \-I n
 .OP \-b execve
 .OM \-e expr
 .OP \-a column
 .OP \-o file
 .OP \-s strsize
+.OP \-X format
 .OM \-P path
 .OM \-p pid
 .BR "" {
@@ -170,7 +176,9 @@ This example shows the shell performing ">>xyzzy" output redirection:
 .CW
 open("xyzzy", O_WRONLY|O_APPEND|O_CREAT, 0666) = 3
 .CE
-Here, the third argument of open is decoded by breaking down the
+Here, the third argument of
+.B open
+is decoded by breaking down the
 flag argument into its three bitwise-OR constituents and printing the
 mode value in octal by tradition.  Where the traditional or native
 usage differs from ANSI or POSIX, the latter forms are preferred.
@@ -205,8 +213,7 @@ Syscalls unknown to
 are printed raw, with the unknown system call number printed in hexadecimal form
 and prefixed with "syscall_":
 .CW
-syscall_0xbad(0xfedcba9876543210, 0xfedcba9876543211, 0xfedcba9876543212,
-0xfedcba9876543213, 0xfedcba9876543214, 0xfedcba9876543215) = -1 (errno 38)
+syscall_0xbad(0x1, 0x2, 0x3, 0x4, 0x5, 0x6) = -1 ENOSYS (Function not implemented)
 .CE
 .LP
 Character pointers are dereferenced and printed as C strings.
@@ -252,12 +259,11 @@ Align return values in a specific column (default column 40).
 .TP
 .B \-i
 Print the instruction pointer at the time of the system call.
+.if '@ENABLE_STACKTRACE_TRUE@'#' .ig end_unwind
 .TP
 .B \-k
-Print the execution stack trace of the traced processes after each system call (experimental).
-This option is available only if
-.B strace
-is built with libunwind.
+Print the execution stack trace of the traced processes after each system call.
+.end_unwind
 .TP
 .BI "\-o " filename
 Write the trace output to the file
@@ -275,6 +281,11 @@ The latter is not compatible with
 .B \-ff
 option currently.
 .TP
+.B \-A
+Open the file provided in the
+.B \-o
+option in append mode.
+.TP
 .B \-q
 Suppress messages about attaching, detaching etc.  This happens
 automatically when output is redirected to a file and the command
@@ -287,6 +298,13 @@ If given twice, suppress messages about process exit status.
 Print a relative timestamp upon entry to each system call.  This
 records the time difference between the beginning of successive
 system calls.
+Note that since
+.B \-r
+option uses the monotonic clock time for measuring time difference and not the
+wall clock time, its measurements can differ from the difference in time
+reported by the
+.B \-t
+option.
 .TP
 .BI "\-s " strsize
 Specify the maximum string size to print (the default is 32).  Note
@@ -314,16 +332,39 @@ Print all non-ASCII strings in hexadecimal string format.
 .B \-xx
 Print all strings in hexadecimal string format.
 .TP
+.BI "\-X " format
+Set the format for printing of named constants and flags.
+Supported
+.I format
+values are:
+.RS
+.TP 10
+.B raw
+Raw number output, without decoding.
+.TP
+.B abbrev
+Output a named constant or a set of flags instead of the raw number if they are
+found.
+This is the default
+.B strace
+behaviour.
+.TP
+.B verbose
+Output both the raw value and the decoded string (as a comment).
+.RE
+.TP
 .B \-y
 Print paths associated with file descriptor arguments.
 .TP
 .B \-yy
-Print protocol specific information associated with socket file descriptors.
+Print protocol specific information associated with socket file descriptors,
+and block/character device number associated with device file descriptors.
 .SS Statistics
 .TP 12
 .B \-c
 Count time, calls, and errors for each system call and report a summary on
-program exit.  This attempts to show system time (CPU time spent running
+program exit, suppressing the regular output.
+This attempts to show system time (CPU time spent running
 in the kernel) independent of wall clock time.  If
 .B \-c
 is used with
@@ -386,8 +427,9 @@ is one of
 .BR read ,
 .BR write ,
 .BR fault ,
+.BR inject ,
 or
-.B inject
+.B kvm
 and
 .I value
 is a qualifier-dependent symbol or number.  The default
@@ -405,6 +447,9 @@ means to trace every system call except
 .BR open .
 Question mark before the syscall qualification allows suppression of error
 in case no syscalls matched the qualification provided.
+Appending one of "@64", "@32", or "@x32" suffixes to the syscall qualification
+allows specifying syscalls only for the 64-bit, 32-bit, or 32-on-64-bit
+personality, respectively.
 In addition, the special values
 .B all
 and
@@ -434,7 +479,7 @@ You can use
 .B POSIX
 Extended Regular Expression syntax (see
 .BR regex (7)).
-.PP
+.TP
 .BR "\-e\ trace" = %file
 .TQ
 .BR "\-e\ trace" = file " (deprecated)"
@@ -446,33 +491,33 @@ Furthermore, using the abbreviation will ensure that you don't
 accidentally forget to include a call like
 .B lstat
 in the list.  Betchya woulda forgot that one.
-.PP
+.TP
 .BR "\-e\ trace" = %process
 .TQ
 .BR "\-e\ trace" = process " (deprecated)"
 Trace all system calls which involve process management.  This
 is useful for watching the fork, wait, and exec steps of a process.
-.PP
+.TP
 .BR "\-e\ trace" = %network
 .TQ
 .BR "\-e\ trace" = network " (deprecated)"
 Trace all the network related system calls.
-.PP
+.TP
 .BR "\-e\ trace" = %signal
 .TQ
 .BR "\-e\ trace" = signal " (deprecated)"
 Trace all signal related system calls.
-.PP
+.TP
 .BR "\-e\ trace" = %ipc
 .TQ
 .BR "\-e\ trace" = ipc " (deprecated)"
 Trace all IPC related system calls.
-.PP
+.TP
 .BR "\-e\ trace" = %desc
 .TQ
 .BR "\-e\ trace" = desc " (deprecated)"
 Trace all file descriptor related system calls.
-.PP
+.TP
 .BR "\-e\ trace" = %memory
 .TQ
 .BR "\-e\ trace" = memory " (deprecated)"
@@ -542,15 +587,20 @@ This option has the effect of causing all arguments to be printed
 in hexadecimal.  This is mostly useful if you don't trust the
 decoding or you need to know the actual numeric value of an
 argument.
+See also
+.B \-X raw
+option.
 .TP
 \fB\-e\ signal\fR=\,\fIset\fR
 Trace only the specified subset of signals.  The default is
 .BR signal = all .
 For example,
-.B signal "=!" SIGIO
+.BR signal "=!" SIGIO
 (or
 .BR signal "=!" io )
-causes SIGIO signals not to be traced.
+causes
+.B SIGIO
+signals not to be traced.
 .TP
 \fB\-e\ read\fR=\,\fIset\fR
 Perform a full hexadecimal and ASCII dump of all the data read from
@@ -580,14 +630,16 @@ Note that this is independent from the normal tracing of the
 system call which is controlled by the option
 .BR -e "\ " trace = write .
 .TP
-\fB\-e\ inject\fR=\,\fIset\/\fR[:\fBerror\fR=\,\fIerrno\/\fR|:\fBretval\fR=\,\fIvalue\/\fR][:\fBsignal\fR=\,\fIsig\/\fR][:\fBwhen\fR=\,\fIexpr\/\fR]
+\fB\-e\ inject\fR=\,\fIset\/\fR[:\fBerror\fR=\,\fIerrno\/\fR|:\fBretval\fR=\,\fIvalue\/\fR][:\fBsignal\fR=\,\fIsig\/\fR][:\fBsyscall\fR=\fIsyscall\fR][:\fBdelay_enter\fR=\,\fIusecs\/\fR][:\fBdelay_exit\fR=\,\fIusecs\/\fR][:\fBwhen\fR=\,\fIexpr\/\fR]
 Perform syscall tampering for the specified set of syscalls.
 
 At least one of
 .BR error ,
 .BR retval ,
+.BR signal ,
+.BR delay_enter ,
 or
-.B signal
+.B delay_exit
 options has to be specified.
 .B error
 and
@@ -596,7 +648,8 @@ are mutually exclusive.
 
 If :\fBerror\fR=\,\fIerrno\/\fR option is specified,
 a fault is injected into a syscall invocation:
-the syscall number is replaced by -1 which corresponds to an invalid syscall,
+the syscall number is replaced by -1 which corresponds to an invalid syscall
+(unless a syscall is specified with :\fBsyscall=\fR option),
 and the error code is specified using a symbolic
 .I errno
 value like
@@ -614,19 +667,35 @@ or a numeric value within 1..\fBSIGRTMAX\fR range,
 that signal is delivered on entering every syscall specified by the
 .IR set .
 
+If :\fBdelay_enter\fR=\,\fIusecs\/\fR or :\fBdelay_exit\fR=\,\fIusecs\/\fR
+options are specified, delay injection is performed: the tracee is delayed
+by at least
+.IR usecs
+microseconds on entering or exiting the syscall.
+
 If :\fBsignal\fR=\,\fIsig\/\fR option is specified without
-:\fBerror\fR=\,\fIerrno\/\fR or :\fBretval\fR=\,\fIvalue\/\fR options,
+:\fBerror\fR=\,\fIerrno\/\fR, :\fBretval\fR=\,\fIvalue\/\fR or
+:\fBdelay_{enter,exit}\fR=\,\fIusecs\/\fR options,
 then only a signal
 .I sig
-is delivered without a syscall fault injection.
+is delivered without a syscall fault or delay injection.
 Conversely, :\fBerror\fR=\,\fIerrno\/\fR or
 :\fBretval\fR=\,\fIvalue\/\fR option without
-:\fBsignal\fR=\,\fIsig\/\fR option injects a fault without delivering a signal.
+:\fBdelay_enter\fR=\,\fIusecs\/\fR,
+:\fBdelay_exit\fR=\,\fIusecs\/\fR or
+:\fBsignal\fR=\,\fIsig\/\fR options injects a fault without delivering a signal
+or injecting a delay, etc.
 
 If both :\fBerror\fR=\,\fIerrno\/\fR or :\fBretval\fR=\,\fIvalue\/\fR
 and :\fBsignal\fR=\,\fIsig\/\fR options are specified, then both
 a fault or success is injected and a signal is delivered.
 
+if :\fBsyscall\fR=\fIsyscall\fR option is specified, the corresponding syscall
+with no side effects is injected instead of -1.
+Currently, only "pure" (see
+.BR "-e trace" = "%pure"
+description) syscalls can be specified there.
+
 Unless a :\fBwhen\fR=\,\fIexpr\fR subexpression is specified,
 an injection is being made into every invocation of each syscall from the
 .IR set .
@@ -702,6 +771,11 @@ This is equivalent to more generic
 option set to
 .IR ENOSYS .
 
+.TP
+.BR "\-e\ kvm" = vcpu
+Print the exit reason of kvm vcpu.  Requires Linux kernel version 4.16.0
+or higher.
+
 .TP
 .BI "\-P " path
 Trace only system calls accessing
@@ -981,6 +1055,14 @@ ARM syscall and
 Xtensa syscall are filtered and printed as
 .BR fadvise64_64 (2).
 .LP
+On x32, syscalls that are intended to be used by 64-bit processes and not x32
+ones (for example,
+.BR readv ,
+that has syscall number 19 on x86_64, with its x32 counterpart has syscall
+number 515), but called with
+.B __X32_SYSCALL_BIT
+flag being set, are designated with "#64" suffix.
+.LP
 On some platforms a process that is attached to with the
 .B \-p
 option may observe a spurious EINTR return from the current
@@ -990,6 +1072,18 @@ to the traced process, but a few system calls aren't.
 Arguably, every instance of such behavior is a kernel bug.)
 This may have an unpredictable effect on the process
 if the process takes no action to restart the system call.
+.LP
+As
+.B strace
+executes the specified
+.I command
+directly and does not employ a shell for that, scripts without shebang
+that usually run just fine when invoked by shell fail to execute with
+.B ENOEXEC
+error.
+It is advisable to manually supply a shell as a
+.I command
+with the script as its argument.
 .SH BUGS
 Programs that use the
 .I setuid
@@ -1046,7 +1140,7 @@ development migrated to CVS; ports to FreeBSD and many architectures on Linux
 (including ARM, IA-64, MIPS, PA-RISC, PowerPC, s390, SPARC) were introduced.
 In 2002, the burden of
 .B strace
-maintainership was transferred to Ronald McGrath.
+maintainership was transferred to Roland McGrath.
 Since then,
 .B strace
 gained support for several new Linux architectures (AMD64, s390x, SuperH),
@@ -1080,7 +1174,7 @@ Problems with
 .B strace
 should be reported to the
 .B strace
-mailing list at <strace\-devel@lists.sourceforge.net>.
+mailing list at <strace\-devel@lists.strace.io>.
 .SH "SEE ALSO"
 .BR strace-log-merge (1),
 .BR ltrace (1),