strace \- trace system calls and signals
.SH SYNOPSIS
.SY strace
+.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 "" {
.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.
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.
.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.
-This option is available only if
-.B strace
-is built using \-\-enable\-stacktrace configure option.
+.end_unwind
.TP
.BI "\-o " filename
Write the trace output to the file
The latter is not compatible with
.B \-ff
option currently.
-.TP \-A
+.TP
+.B \-A
Open the file provided in the
.B \-o
option in append mode.
.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
.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
.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
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
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][:\fBdelay_enter\fR=\,\fIusecs\/\fR][:\fBdelay_exit\fR=\,\fIusecs\/\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
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
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 .
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
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
(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),