<s>
strace	B-Language
is	O
a	O
diagnostic	O
,	O
debugging	O
and	O
instructional	O
userspace	B-Operating_System
utility	O
for	O
Linux	B-Application
.	O
</s>
<s>
It	O
is	O
used	O
to	O
monitor	O
and	O
tamper	O
with	O
interactions	O
between	O
processes	B-Operating_System
and	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
,	O
which	O
include	O
system	B-Operating_System
calls	I-Operating_System
,	O
signal	B-General_Concept
deliveries	O
,	O
and	O
changes	O
of	O
process	O
state	O
.	O
</s>
<s>
The	O
operation	O
of	O
strace	B-Language
is	O
made	O
possible	O
by	O
the	O
kernel	B-Operating_System
feature	O
known	O
as	O
ptrace	B-Operating_System
.	O
</s>
<s>
Some	O
Unix-like	B-Operating_System
systems	I-Operating_System
provide	O
other	O
diagnostic	O
tools	O
similar	O
to	O
strace	B-Language
,	O
such	O
as	O
truss	B-Device
.	O
</s>
<s>
Strace	B-Language
was	O
originally	O
written	O
for	O
SunOS	B-Operating_System
by	O
Paul	O
Kranenburg	O
in	O
1991	O
,	O
according	O
to	O
its	O
copyright	O
notice	O
,	O
and	O
published	O
early	O
in	O
1992	O
,	O
in	O
the	O
volume	O
three	O
of	O
comp.sources.sun	O
.	O
</s>
<s>
is	O
a	O
system	B-Operating_System
call	I-Operating_System
tracer	O
for	O
Sun(tm )	O
systems	O
much	O
like	O
the	O
Sun	O
supplied	O
program	O
.	O
</s>
<s>
is	O
a	O
useful	O
utility	O
to	O
sort	O
of	O
debug	O
programs	O
for	O
which	O
no	O
source	O
is	O
available	O
which	O
unfortunately	O
includes	O
almost	O
all	O
of	O
the	O
Sun	O
supplied	O
system	B-Application
software	I-Application
.	O
</s>
<s>
Later	O
,	O
Branko	O
Lankester	O
ported	O
this	O
version	O
to	O
Linux	B-Application
,	O
releasing	O
his	O
version	O
in	O
November	O
1992	O
with	O
the	O
second	O
release	O
following	O
in	O
1993	O
.	O
</s>
<s>
Richard	O
Sladkey	O
combined	O
these	O
separate	O
versions	O
of	O
strace	B-Language
in	O
1993	O
,	O
and	O
ported	O
the	O
program	O
to	O
SVR4	O
and	O
Solaris	B-Application
in	O
1994	O
,	O
resulting	O
in	O
strace3.0	O
that	O
was	O
announced	O
in	O
comp.sources.misc	O
in	O
mid-1994	O
.	O
</s>
<s>
Beginning	O
in	O
1996	O
,	O
strace	B-Language
was	O
maintained	O
by	O
Wichert	O
Akkerman	O
.	O
</s>
<s>
During	O
his	O
tenure	O
,	O
strace	B-Language
development	O
migrated	O
to	O
CVS	B-Application
;	O
ports	O
to	O
FreeBSD	B-Operating_System
and	O
many	O
architectures	O
on	O
Linux	B-Application
(	O
including	O
ARM	O
,	O
IA-64	B-General_Concept
,	O
MIPS	B-Device
,	O
PA-RISC	B-Device
,	O
PowerPC	O
,	O
s390	B-Device
,	O
SPARC	B-Architecture
)	O
were	O
introduced	O
.	O
</s>
<s>
In	O
2002	O
,	O
the	O
burden	O
of	O
strace	B-Language
maintainership	O
was	O
transferred	O
to	O
Roland	O
McGrath	O
.	O
</s>
<s>
Since	O
then	O
,	O
strace	B-Language
gained	O
support	O
for	O
several	O
new	O
Linux	B-Operating_System
architectures	I-Operating_System
(	O
AMD64	B-Device
,	O
s390x	O
,	O
SuperH	O
)	O
,	O
bi-architecture	O
support	O
for	O
some	O
of	O
them	O
,	O
and	O
received	O
numerous	O
additions	O
and	O
improvements	O
in	O
syscalls	B-Operating_System
decoders	O
on	O
Linux	B-Application
;	O
strace	B-Language
development	O
migrated	O
to	O
git	B-Application
during	O
that	O
period	O
.	O
</s>
<s>
Since	O
2009	O
,	O
strace	B-Language
is	O
actively	O
maintained	O
by	O
Dmitry	O
Levin	O
.	O
</s>
<s>
strace	B-Language
gained	O
support	O
for	O
AArch64	B-Architecture
,	O
ARC	B-Application
,	O
AVR32	B-Device
,	O
Blackfin	B-General_Concept
,	O
Meta	O
,	O
Nios	B-Device
II	I-Device
,	O
OpenSISC	O
1000	O
,	O
RISC-V	B-Device
,	O
Tile/TileGx	O
,	O
Xtensa	O
architectures	O
since	O
that	O
time	O
.	O
</s>
<s>
The	O
last	O
version	O
of	O
strace	B-Language
that	O
had	O
some	O
(	O
evidently	O
dead	O
)	O
code	O
for	O
non-Linux	O
operating	O
systems	O
was	O
4.6	O
,	O
released	O
in	O
March	O
2011	O
.	O
</s>
<s>
In	O
strace	B-Language
version	O
4.7	O
,	O
released	O
in	O
May	O
2012	O
,	O
all	O
non-Linux	O
code	O
had	O
been	O
removed	O
;	O
since	O
strace	B-Language
4.13	O
,	O
the	O
project	O
follows	O
Linux	B-Operating_System
kernel	I-Operating_System
's	O
release	O
schedule	O
,	O
and	O
with	O
the	O
version	O
5.0	O
,	O
it	O
follows	O
Linux	B-Application
's	O
versioning	O
scheme	O
as	O
well	O
.	O
</s>
<s>
In	O
2012	O
strace	B-Language
also	O
gained	O
support	O
for	O
path	O
tracing	O
and	O
file	O
descriptor	O
path	O
decoding	O
.	O
</s>
<s>
In	O
August	O
2014	O
,	O
strace	B-Language
4.9	O
was	O
released	O
,	O
where	O
support	O
for	O
stack	O
traces	O
printing	O
was	O
added	O
.	O
</s>
<s>
In	O
December	O
2016	O
,	O
syscall	B-Operating_System
fault	O
injection	O
feature	O
was	O
implemented	O
.	O
</s>
<s>
Added	O
support	O
for	O
64-bit	O
SPARC	B-Architecture
architecture	O
on	O
Linux	B-Application
.	O
</s>
<s>
Added	O
support	O
for	O
the	O
Irix	O
OS	O
,	O
m68k	B-Device
and	O
DEC	B-Device
Alpha	I-Device
architectures	O
on	O
Linux	B-Application
;	O
added	O
support	O
for	O
-o	O
!	O
</s>
<s>
The	O
most	O
common	O
use	O
is	O
to	O
start	O
a	O
program	O
using	O
strace	B-Language
,	O
which	O
prints	O
a	O
list	O
of	O
system	B-Operating_System
calls	I-Operating_System
made	O
by	O
the	O
program	O
.	O
</s>
<s>
This	O
is	O
useful	O
if	O
the	O
program	O
continually	O
crashes	O
,	O
or	O
does	O
not	O
behave	O
as	O
expected	O
;	O
for	O
example	O
using	O
strace	B-Language
may	O
reveal	O
that	O
the	O
program	O
is	O
attempting	O
to	O
access	O
a	O
file	O
which	O
does	O
not	O
exist	O
or	O
cannot	O
be	O
read	O
.	O
</s>
<s>
Among	O
other	O
features	O
,	O
strace	B-Language
allows	O
the	O
following	O
:	O
</s>
<s>
Specifying	O
a	O
filter	O
of	O
syscall	B-Operating_System
names	O
that	O
should	O
be	O
traced	O
(	O
via	O
the	O
-e	O
trace	O
=	O
option	O
)	O
:	O
by	O
name	O
,	O
like	O
;	O
using	O
one	O
of	O
the	O
predefined	O
groups	O
,	O
like	O
or	O
;	O
or	O
(	O
since	O
strace	B-Language
4.17	O
)	O
using	O
regular	O
expression	O
syntax	O
,	O
like	O
-e	O
trace	O
=	O
/clock_	O
.	O
</s>
<s>
Counting	O
syscall	B-Operating_System
execution	O
time	O
and	O
count	O
(	O
-T	O
,	O
-c	O
,	O
-C	O
,	O
and	O
-w	O
options	O
;	O
-U	O
option	O
enables	O
printing	O
of	O
additional	O
information	O
,	O
like	O
minimum	O
and	O
maximum	O
syscall	B-Operating_System
execution	O
time	O
)	O
.	O
</s>
<s>
Tampering	O
with	O
the	O
syscalls	B-Operating_System
being	O
executed	O
(	O
-e	O
inject	O
=	O
syscall	B-Operating_System
specification:tampering	O
specification	O
option	O
)	O
:	O
modifying	O
return	O
(	O
:	O
retval	O
=	O
;	O
since	O
strace	B-Language
4.16	O
)	O
and	O
error	O
code	O
(	O
:	O
error	O
=	O
;	O
since	O
strace	B-Language
4.15	O
)	O
of	O
the	O
specified	O
syscalls	B-Operating_System
,	O
inject	O
signals	O
(	O
:	O
signal	B-General_Concept
=	O
;	O
since	O
strace	B-Language
4.16	O
)	O
,	O
delays	O
(	O
:	O
delay_enter	O
=	O
and	O
:delay_exit	O
=	O
;	O
since	O
strace	B-Language
4.22	O
)	O
,	O
and	O
modify	O
data	O
pointed	O
by	O
syscall	B-Operating_System
arguments	O
(	O
:	O
poke_enter	O
=	O
and	O
:poke_exit	O
=	O
;	O
since	O
strace	B-Language
5.11	O
)	O
upon	O
their	O
execution	O
.	O
</s>
<s>
Printing	O
stack	O
traces	O
,	O
including	O
(	O
since	O
strace	B-Language
4.21	O
)	O
symbol	O
demangling	O
(	O
-k	O
option	O
)	O
.	O
</s>
<s>
Filtering	O
by	O
syscall	B-Operating_System
return	O
status	O
(	O
-e	O
status	O
=	O
option	O
;	O
since	O
strace	B-Language
5.2	O
)	O
.	O
</s>
<s>
Perform	O
translation	O
of	O
thread	O
,	O
process	O
,	O
process	O
group	O
,	O
and	O
session	O
IDs	B-Application
appearing	O
in	O
the	O
trace	O
into	O
strace	B-Language
's	O
PID	O
namespace	O
(	O
--pidns-translation	O
option	O
;	O
since	O
strace	B-Language
5.9	O
)	O
.	O
</s>
<s>
Decoding	O
SELinux	B-Application
context	O
information	O
associated	O
with	O
processes	B-Operating_System
,	O
files	O
,	O
and	O
descriptors	O
(	O
--secontext	O
option	O
;	O
since	O
strace	B-Language
5.12	O
)	O
.	O
</s>
<s>
strace	B-Language
supports	O
decoding	O
of	O
arguments	O
of	O
some	O
classes	O
of	O
ioctl	B-Operating_System
commands	O
,	O
such	O
as	O
BTRFS_*	B-Operating_System
,	O
V4L2_*	B-Application
,	O
DM_*	B-Application
,	O
NSFS_*	B-Architecture
,	O
MEM*	B-Application
,	O
EVIO*	B-Application
,	O
KVM_*	B-Application
,	O
and	O
several	O
others	O
;	O
it	O
also	O
supports	O
decoding	O
of	O
various	O
netlink	B-Application
protocols	O
.	O
</s>
<s>
As	O
strace	B-Language
only	O
details	O
system	B-Operating_System
calls	I-Operating_System
,	O
it	O
cannot	O
be	O
used	O
to	O
detect	O
as	O
many	O
problems	O
as	O
a	O
code	O
debugger	O
such	O
as	O
GNU	B-Language
Debugger	I-Language
(	O
gdb	B-Language
)	O
.	O
</s>
<s>
It	O
is	O
also	O
used	O
by	O
researchers	O
to	O
generate	O
system	B-Operating_System
call	I-Operating_System
traces	O
for	O
later	O
system	B-Operating_System
call	I-Operating_System
replay	O
.	O
</s>
<s>
The	O
following	O
is	O
an	O
example	O
of	O
typical	O
output	O
of	O
the	O
strace	B-Language
command	O
:	O
</s>
<s>
The	O
above	O
fragment	O
is	O
only	O
a	O
small	O
part	O
of	O
the	O
output	O
of	O
strace	B-Language
when	O
run	O
on	O
the	O
'	O
ls	B-Application
 '	O
command	O
.	O
</s>
<s>
Different	O
operating	O
systems	O
feature	O
other	O
similar	O
or	O
related	O
instrumentation	B-Application
tools	O
,	O
offering	O
similar	O
or	O
more	O
advanced	O
features	O
;	O
some	O
of	O
the	O
tools	O
(	O
although	O
using	O
the	O
same	O
or	O
a	O
similar	O
name	O
)	O
may	O
use	O
completely	O
different	O
work	O
mechanisms	O
,	O
resulting	O
in	O
different	O
feature	O
sets	O
or	O
results	O
.	O
</s>
<s>
Linux	B-Application
has	O
ltrace	B-Device
that	O
can	O
trace	O
library	O
and	O
system	B-Operating_System
calls	I-Operating_System
,	O
xtrace	O
that	O
can	O
trace	O
X	B-Operating_System
Window	I-Operating_System
programs	O
,	O
SystemTap	B-Application
,	O
perf	B-Application
,	O
and	O
trace-cmd	B-Application
and	O
KernelShark	B-Application
that	O
extend	O
ftrace	B-Application
.	O
</s>
<s>
macOS	B-Application
provides	O
ktrace	B-Device
(	O
10.4	O
and	O
earlier	O
)	O
,	O
DTrace	B-Application
(	O
from	O
Solaris	B-Application
)	O
and	O
associated	O
dtruss	O
in	O
10.5	O
and	O
later	O
.	O
</s>
<s>
Microsoft	B-Application
Windows	I-Application
has	O
a	O
similar	O
utility	O
called	O
StraceNT	O
,	O
written	O
by	O
Pankaj	O
Garg	O
,	O
and	O
a	O
similar	O
GUI-based	O
utility	O
called	O
Process	B-Language
Monitor	I-Language
,	O
developed	O
by	O
Sysinternals	O
.	O
</s>
