strace
{{short description|Diagnostic, debugging and instructional userspace utility for Linux}}
{{Lowercase|strace}}
{{Infobox software
|name = strace
|logo = Strace_logo.svg
|screenshot =
|caption =
|collapsible =4
|author = Paul Kranenburg
|developer = Dmitry Levin
|released =
|discontinued =
| latest release version = {{wikidata|property|preferred|references|edit|P348|P548=Q2804309}}
| latest release date = {{Start date and age|{{wikidata|qualifier|preferred|single|P348|P548=Q2804309|P577}}|df=yes}}
|latest preview version =
|latest preview date =
|programming language = C{{cite web|url=https://openhub.net/p/strace |title=The strace Open Source Project on Open Hub |publisher=Openhub.net |date= |accessdate=2021-11-23}}
|operating system = Linux
|platform = AArch64, DEC Alpha, ARC, ARM EABI/OABI, AVR32, Blackfin, C-SKY, HP PA-RISC, IA-32, IA-64, LoongArch, Motorola 68k, Imagination META, MicroBlaze, MIPS, Nios II, OpenRISC, Power ISA 32/64 bit, RISC-V, System/390/z/Architecture, SuperH 32/64 bit, SPARC 32/64 bit, TILE, TILEPro, TILE-Gx, x86-64, x32 ABI, Xtensa
|size =
|language = English{{refn|group=note|Decoding of system error messages, however, is performed in accordance with the current locale since strace 4.22.{{cite mailing list
| url = https://lists.strace.io/pipermail/strace-devel/2018-April/008103.html
| title = [PATCH] Add i18n support
| author = Dmitry V. Levin
| date = 2018-04-01
| accessdate= 2021-09-02
}}}}
|genre = Debugging
|license = LGPL v2.1+The test suite is licensed under GPL v2.0+.{{cite mailing list
| url = https://lists.strace.io/pipermail/strace-devel/2018-December/008548.html
| title = I: changing the license of strace to a copyleft license
| author = Dmitry V. Levin
| date = 2018-12-15
| accessdate= 2021-09-02
}}
}}
strace is a diagnostic, debugging and instructional userspace utility for Linux. It is used to monitor and tamper with interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state. The operation of strace is made possible by the kernel feature known as ptrace.
Some Unix-like systems provide other diagnostic tools similar to strace, such as truss.
History
Strace was originally written for SunOS by Paul Kranenburg in 1991, according to its copyright notice, and published early in 1992, in volume three of comp.sources.sun. The initial README file contained the following:{{cite newsgroup |url=https://stuff.mit.edu/afs/sipb/project/eichin/cruft/machine/sun/sun-Strace |author=Paul Kranenburg |date=March 2, 1992 |title=Strace - an alternative syscall tracer |newsgroup=comp.sources.sun}}
{{Mono|strace(1)}} is a system call tracer for Sun(tm) systems much like the Sun supplied program {{Mono|trace(1)}}. {{Mono|strace(1)}} is a useful utility to sort of debug programs for which no source is available which unfortunately includes almost all of the Sun supplied system software.
Later, Branko Lankester ported this version to Linux, releasing his version in November 1992 with the second release following in 1993.{{cite web |url=http://ftp.funet.fi/pub/Linux/tools/strace.tar.Z |title=first Linux release of strace |author=Branko Lankester |date=November 5, 1992 }}{{cite web |url=http://ftp.funet.fi/pub/Linux/tools/strace-2.tgz |title=second Linux release of strace |author=Branko Lankester |date=June 18, 1993 }} Richard Sladkey combined these separate versions of strace in 1993, and ported the program to SVR4 and Solaris in 1994,{{cite web |url=http://manned.org/strace/e47b83b9 |title=strace |publisher=manned.org |date=June 21, 1994 }} resulting in strace 3.0 that was announced in comp.sources.misc in mid-1994.{{cite web |url=http://ftp.sunet.se/pub/usenet/ftp.uu.net/comp.sources.misc/index |title=SUNET's Index of /pub/usenet/ftp.uu.net/comp.sources.misc/volume43/strace |accessdate=January 14, 2015 |archive-date=September 11, 2007 |archive-url=https://web.archive.org/web/20070911180544/http://ftp.sunet.se/pub/usenet/ftp.uu.net/comp.sources.misc/index |url-status=dead }}
Beginning in 1996, strace was maintained by Wichert Akkerman. During his tenure, strace 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 strace maintainership was transferred to Roland McGrath. Since then, strace gained support for several new Linux architectures (AMD64, s390x, SuperH), bi-architecture support for some of them, and received numerous additions and improvements in syscalls decoders on Linux; strace development migrated to git during that period. Since 2009, strace is actively maintained by Dmitry Levin. strace gained support for AArch64, ARC, AVR32, Blackfin, Meta, Nios II, OpenSISC 1000, RISC-V, Tile/TileGx, Xtensa architectures since that time.
The last version of strace that had some (evidently dead){{cite web |url=http://sourceforge.net/p/strace/mailman/message/28799000/ |title=How about removing non-Linux code? |author=Denys Vlasenko |date=February 7, 2012}} code for non-Linux operating systems was 4.6, released in March 2011.{{cite web |url=http://sourceforge.net/p/strace/mailman/message/27209257/ |title=strace 4.6 released |author=Dmitry V. Levin |date=March 16, 2011}} In strace version 4.7, released in May 2012,{{cite web |url=http://sourceforge.net/p/strace/mailman/message/29210530/ |title=strace 4.7 released |author=Dmitry V. Levin |date=May 2, 2012}} all non-Linux code had been removed;{{cite web |url=http://sourceforge.net/p/strace/code/ci/v4.7/tree/NEWS |title=Noteworthy changes in release 4.7 |author=Dmitry V. Levin |date=April 20, 2012}} since strace 4.13,{{cite web |url=https://lists.strace.io/pipermail/strace-devel/2016-October/005679.html|title=strace 4.14 released|author=Dmitry V. Levin |date=October 4, 2016}} the project follows Linux kernel's release schedule, and as of version 5.0,{{cite web |url=https://lists.strace.io/pipermail/strace-devel/2019-March/008672.html|title=strace 5.0 released|author=Dmitry V. Levin |date=March 19, 2019}} it follows Linux's versioning scheme as well.
In 2012 strace also gained support for path tracing and file descriptor path decoding.{{cite web|url=https://github.com/strace/strace/blob/v4.7/NEWS|title=Noteworthy changes in release 4.7|author=Dmitry V. Levin|website=GitHub|date=May 1, 2012}} In August 2014, strace 4.9 was released,{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2014-August/003500.html|title=strace 4.9 released|author=Dmitry V. Levin |date=August 15, 2014}}{{cite web|url=https://github.com/strace/strace/blob/v4.9/NEWS|title=Noteworthy changes in release 4.9|author=Dmitry V. Levin|website=GitHub|date=August 15, 2014}} where support for stack traces printing was added. In December 2016,{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2016-December/005841.html|title=strace 4.15 released|author=Dmitry V. Levin|date=December 14, 2016}}{{cite web|url=https://github.com/strace/strace/blob/v4.15/NEWS|title=Noteworthy changes in release 4.15|author=Dmitry V. Levin|website=GitHub|date=December 14, 2016}} syscall fault injection feature was implemented.
= Version history =
class="wikitable mw-collapsible mw-collapsed"
! Version ! Release date ! Notable changes | |
6.2 | {{dts|format=dmy|2023|02|26}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2023-February/011172.html|title=strace 6.2 released|author=Dmitry V. Levin|date=2023-02-26}}
| Implemented collision resolution for overlapping terminal/sound ioctl commands |
6.1 | {{dts|format=dmy|2022|12|12}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2022-December/011128.html|title=strace 6.1 released|author=Dmitry V. Levin|date=2022-12-12}}
| Enhanced decoding of |
6.0 | {{dts|format=dmy|2022|10|29}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2022-October/011125.html|title=strace 6.0 released|author=Dmitry V. Levin|date=2022-10-29}}
| Enhanced decoding of |
5.19 | {{dts|format=dmy|2022|08|12}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2022-August/011094.html|title=strace 5.19 released|author=Dmitry V. Levin|date=2022-08-12}}
| The "(deleted)" marker of unlinked file descriptor paths is no longer interpreted as a part of a path; enhanced decoding of |
5.18 | {{dts|format=dmy|2022|06|18}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2022-June/011079.html|title=strace 5.18 released|author=Dmitry V. Levin|date=2022-06-18}}
| |
5.17 | {{dts|format=dmy|2022|03|26}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2022-March/011048.html|title=strace 5.17 released|author=Dmitry V. Levin|date=2022-03-27}}
| Added support for a new |
5.16 | {{dts|format=dmy|2022|01|10}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2022-January/010884.html|title=strace 5.16 released|author=Dmitry V. Levin|date=2022-01-10}}
| Added support for printing SELinux context mismatches ( |
5.15 | {{dts|format=dmy|2021|12|01}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2021-December/010783.html|title=strace 5.15 released|author=Dmitry V. Levin|date=2021-12-01}}
| |
5.14 | {{dts|format=dmy|2021|09|02}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2021-September/010674.html|title=strace 5.14 released|author=Dmitry V. Levin|date=2021-09-02}}
| Added support for the new |
5.13 | {{dts|format=dmy|2021|07|18}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2021-July/010613.html|title=strace 5.13 released|author=Dmitry V. Levin|date=2021-07-18}}
| Implemented System Call Vectored ABI support on the IBM POWER architecture |
5.12 | {{dts|format=dmy|2021|04|26}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2021-April/010516.html|title=strace 5.12 released|author=Dmitry V. Levin|date=2021-04-26}}
| Added support for the new |
5.11 | {{dts|format=dmy|2021|02|17}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2021-February/010405.html|title=strace 5.11 released|author=Dmitry V. Levin|date=2021-02-17}}
| Added option for injecting data on syscall entry/exit ( |
5.10 | {{dts|format=dmy|2020|12|14}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2020-December/010295.html|title=strace 5.10 released|author=Dmitry V. Levin|date=2020-12-14}}
| Stack tracing is supported for non-native personalities when compiled with |
5.9 | {{dts|format=dmy|2020|09|24}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2020-September/010250.html|title=strace 5.9 released|author=Dmitry V. Levin|date=2020-09-24}}
| Added support for |
5.8 | {{dts|format=dmy|2020|08|06}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2020-August/010057.html|title=strace 5.8 released|author=Dmitry V. Levin|date=2020-08-06}}
| Changed the list of syscalls covered by the |
5.7 | {{dts|format=dmy|2020|06|01}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2020-June/009783.html|title=strace 5.7 released|author=Dmitry V. Levin|date=2020-06-01}}
| |
5.6 | {{dts|format=dmy|2020|04|07}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2020-April/009624.html|title=strace 5.6 released|author=Dmitry V. Levin|date=2020-04-07}}
| Added long option aliases along with possibilities for more precise option specifications via |
5.5 | {{dts|format=dmy|2020|02|06}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2020-February/009337.html|title=strace 5.5 released|author=Dmitry V. Levin|date=2020-02-06}}
| |
5.4 | {{dts|format=dmy|2019|11|28}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2019-November/009261.html|title=strace 5.4 released|author=Dmitry V. Levin|date=2019-11-28}} |
5.3 | {{dts|format=dmy|2019|09|25}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2019-September/009155.html|title=strace 5.3 released|author=Dmitry V. Levin|date=2019-09-25}} |
5.2 | {{dts|format=dmy|2019|07|12}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2019-July/008954.html|title=strace 5.2 released|author=Dmitry V. Levin|date=2019-07-12}} |
5.1 | {{dts|format=dmy|2019|05|22}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2019-May/008778.html|title=strace 5.1 released|author=Dmitry V. Levin|date=2019-05-22}} |
5.0 | {{dts|format=dmy|2019|03|19}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2019-March/008672.html|title=strace 5.0 released|author=Dmitry V. Levin|date=2019-03-19}} |
4.26 | {{dts|format=dmy|2018|12|26}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2018-December/008573.html|title=strace 4.26 released|author=Dmitry V. Levin|date=2018-12-26}} |
4.25 | {{dts|format=dmy|2018|10|30}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2018-October/008399.html|title=strace 4.25 released|author=Dmitry V. Levin|date=2018-10-30}} |
4.24 | {{dts|format=dmy|2018|08|14}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2018-August/008347.html|title=strace 4.24 released|author=Dmitry V. Levin|date=2018-08-14}} |
4.23 | {{dts|format=dmy|2018|06|14}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2018-June/008234.html|title=strace 4.23 released|author=Dmitry V. Levin|date=2018-06-14}} |
4.22 | {{dts|format=dmy|2018|04|05}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2018-April/008110.html|title=strace 4.22 released|author=Dmitry V. Levin|date=2018-04-05}} |
4.21 | {{dts|format=dmy|2018|02|13}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2018-February/007895.html|title=strace 4.21 released|author=Dmitry V. Levin|date=2018-02-13}} |
4.20 | {{dts|format=dmy|2017|11|13}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2017-November/007696.html|title=strace 4.20 released|author=Dmitry V. Levin|date=2017-11-13}} |
4.19 | {{dts|format=dmy|2017|09|05}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2017-September/007596.html|title=strace 4.19 released|author=Dmitry V. Levin|date=2017-09-05}} |
4.18 | {{dts|format=dmy|2017|07|05}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2017-July/006897.html|title=strace 4.18 released|author=Dmitry V. Levin|date=2017-07-05}} |
4.17 | {{dts|format=dmy|2017|05|24}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2017-May/006415.html|title=strace 4.17 released|author=Dmitry V. Levin|date=2017-05-24}} |
4.16 | {{dts|format=dmy|2017|02|14}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2017-February/005995.html|title=strace 4.16 released|author=Dmitry V. Levin|date=2017-02-14}} |
4.15 | {{dts|format=dmy|2016|12|14}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2016-December/005841.html|title=strace 4.15 released|author=Dmitry V. Levin|date=2016-12-14}} |
4.14 | {{dts|format=dmy|2016|10|04}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2016-October/005679.html|title=strace 4.14 released|author=Dmitry V. Levin|date=2016-10-04}} |
4.13 | {{dts|format=dmy|2016|07|26}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2016-July/005406.html|title=strace 4.13 released|author=Dmitry V. Levin|date=2016-07-26}} |
4.12 | {{dts|format=dmy|2016|05|31}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2016-May/005205.html|title=strace 4.12 released|author=Dmitry V. Levin|date=2016-05-31}} |
4.11 | {{dts|format=dmy|2015|12|21}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2015-December/004428.html|title=strace 4.11 released|author=Dmitry V. Levin|date=2015-12-21}} |
4.10 | {{dts|format=dmy|2015|03|06}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2015-March/003953.html|title=strace 4.10 released|author=Dmitry V. Levin|date=2015-03-06}} |
4.9 | {{dts|format=dmy|2014|08|15}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2014-August/003500.html|title=strace 4.9 released|author=Dmitry V. Levin|date=2014-08-15}} |
4.8 | {{dts|format=dmy|2013|06|03}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2013-June/002656.html|title=strace 4.8 released|author=Dmitry V. Levin|date=2013-06-03}} |
4.7 | {{dts|format=dmy|2012|05|02}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2012-May/002292.html|title=strace 4.7 released|author=Dmitry V. Levin|date=2012-05-02}}
| All non-Linux code had been removed |
4.6 | {{dts|format=dmy|2011|03|15}}{{cite web|url=https://lists.strace.io/pipermail/strace-devel/2011-March/001803.html|title=strace 4.6 released|author=Dmitry V. Levin|date=2011-03-15}} |
4.5.20 | {{dts|format=dmy|2010|04|13}}
| Added support for new |
4.5.19 | {{dts|format=dmy|2009|10|21}}
| Maintainership passed to Dmitry Levin; strace now terminates with the same exit code/signal as the traced program (if it was started by strace); added support for new |
4.5.18 | {{dts|format=dmy|2008|08|28}}
| Added support for |
4.5.17 | {{dts|format=dmy|2008|07|21}}
| |
4.5.16 | {{dts|format=dmy|2007|08|03}}
| |
4.5.15 | {{dts|format=dmy|2007|01|16}}
| Added support for new |
4.5.14 | {{dts|format=dmy|2007|01|16}}
| System call number can be supplied in |
4.5.13 | {{dts|format=dmy|2005|08|03}}
| Add |
4.5.12 | {{dts|format=dmy|2005|06|08}}
| |
4.5.11 | {{dts|format=dmy|2005|03|22}}
| |
4.5.10 | {{dts|format=dmy|2005|03|13}}
| |
4.5.9 | {{dts|format=dmy|2004|02|04}}
| |
4.5.8 | {{dts|format=dmy|2004|10|19}}
| Decode |
4.5.7 | {{dts|format=dmy|2004|08|31}}
| |
4.5.6 | {{dts|format=dmy|2004|07|12}}
| Added support for 64-bit SPARC architecture on Linux. |
4.5.5 | {{dts|format=dmy|2004|06|27}}
| |
4.5.4 | {{dts|format=dmy|2004|06|03}}
| |
4.5.3 | {{dts|format=dmy|2004|04|16}}
| Added support for |
4.5.2 | {{dts|format=dmy|2004|03|01}}
| |
4.5.1 | {{dts|format=dmy|2003|11|13}}
| |
4.5 | {{dts|format=dmy|2003|09|24}}
| Maintainership passed to Roland McGrath; added x86-64 support on Linux with support of tracing of compat processes; added support for SH and SH64 architectures on Linux; |
4.4 | {{dts|format=dmy|2001|08|19}}
| |
4.3.1 | {{dts|format=dmy|2001|04|07}}
| |
4.3 | {{dts|format=dmy|2001|04|01}}
| Added support for HP PA/RISC and IA-64 architectures on Linux; added support for 32-bit UID/GID syscalls on Linux; added support for FreeBSD on x86 |
4.2 | {{dts|format=dmy|2000|01|21}}
| Added support for IBM Z architecture on Linux |
4.1 | {{dts|format=dmy|1999|11|26}}
| Added support for MIPS architecture on Linux; |
4.0.1 | {{dts|format=dmy|1999|07|25}}
| |
4.0 | {{dts|format=dmy|1999|07|09}}
| Fixed 64-bit |
3.99.1 | {{dts|format=dmy|1999|06|09}}
| |
3.99 | {{dts|format=dmy|1999|04|27}}
| New maintainer, Wichert Akkerman; added support for IBM POWER, SPARC, and ARM architectures on Linux; added support for many syscalls on Linux |
3.1 | {{dts|format=dmy|1996|06|01}}
| Added support for the Irix OS, m68k and DEC Alpha architectures on Linux; added support for |
3.0 | {{dts|format=dmy|1994|07|09}}{{cite web|url=https://groups.google.com/forum/#!topic/comp.sources.misc/ScA8PaNwsBU|title=v43i075: strace - system call tracer for sunos, linux, svr4, solaris2, Part01/10|author=Rick Sladkey|date=1994-07-09}}
| Initial cross-platform version by Richard Sladkey. Includes support for |
Usage and features
The most common use is to start a program using strace, which prints a list of system calls made by the program. This is useful if the program continually crashes, or does not behave as expected; for example using strace may reveal that the program is attempting to access a file which does not exist or cannot be read.
An alternative application is to use the {{code|-p}} flag to attach to a running process. This is useful if a process has stopped responding, and might reveal, for example, that the process is blocking whilst attempting to make a network connection.
Among other features, strace allows the following:
- Specifying a filter of syscall names that should be traced (via the
-e trace=
option): by name, like {{Mono|clone,fork,vfork}}; using one of the predefined groups, like {{Mono|%ipc}} or {{Mono|%file}}; or (since strace 4.17) using regular expression syntax, like-e trace=/clock_.*
. - Specifying a list of paths to be traced (
-P /etc/ld.so.cache
, for example). - Specifying a list of file descriptors whose I/O should be dumped (
-e read=
and-e write=
options). - Counting syscall execution time and count (
-T
,-c
,-C
, and-w
options;-U
option enables printing of additional information, like minimum and maximum syscall execution time). - Printing relative or absolute time stamps (
-t
and-r
options). - Tampering with the syscalls being executed (
-e inject=syscall specification:tampering specification
option): modifying return (:retval=
; since strace 4.16) and error code (:error=
; since strace 4.15) of the specified syscalls, inject signals (:signal=
; since strace 4.16), delays (:delay_enter=
and:delay_exit=
; since strace 4.22), and modify data pointed by syscall arguments (:poke_enter=
and:poke_exit=
; since strace 5.11) upon their execution. - Extracting information about file descriptors (including sockets,
-y
option;-yy
option provides some additional information, like endpoint addresses for sockets, paths and device major/minor numbers for files). - Printing stack traces, including (since strace 4.21) symbol demangling (
-k
option). - Filtering by syscall return status (
-e status=
option; since strace 5.2Its shorthand for showing only successful calls,-z
option, was originally added in strace 4.5, but was never documented as it did not work properly.). - Perform translation of thread, process, process group, and session IDs appearing in the trace into strace's PID namespace (
--pidns-translation
option; since strace 5.9). - Decoding SELinux context information associated with processes, files, and descriptors (
--secontext
option; since strace 5.12).
strace supports decoding of arguments of some classes of ioctl commands, such as BTRFS_*, V4L2_*, DM_*, NSFS_*, MEM*, EVIO*, KVM_*, and several others; it also supports decoding of various netlink protocols.
As strace only details system calls, it cannot be used to detect as many problems as a code debugger such as GNU Debugger (gdb). It is, however, easier to use than a code debugger, and is a very useful tool for system administrators. It is also used by researchers to generate system call traces for later system call replay.
{{cite web
|last = Horky
|first = Jiri
| year = 2013
| title = The ioapps IO profiler and IO traces replayer
| url = http://code.google.com/p/ioapps/
| accessdate = 2013-09-16}}
{{cite web
|last = Waterland
|first = Amos
|year = 2007
| title = The sreplay system call replayer
| url = http://people.seas.harvard.edu/~apw/sreplay/
| accessdate = 2013-09-16}}
{{cite web
|last = Burton
|first = Ariel
|year = 1998
| title = Workload characterization using lightweight system call tracing and reexecution
| url = http://www.doc.ic.ac.uk/~phjk/Publications/WkldChctrsnUsngTracesReex.pdf
| accessdate = 2013-09-16}}
Examples
The following is an example of typical output of the strace
command:
user@server:~$ strace ls
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
fcntl64(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
getdents64(3, /* 18 entries */, 4096) = 496
getdents64(3, /* 0 entries */, 4096) = 0
close(3) = 0
fstat64(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f2c000
write(1, "autofs\nbackups\ncache\nflexlm\ngames"..., 86autofsA
The above fragment is only a small part of the output of strace when run on the 'ls' command. It shows that the current working directory is opened, inspected and its contents retrieved. The resulting list of file names is written to standard output.
{{Anchor|XTRACE}}Similar tools
Different operating systems feature other similar or related instrumentation tools, offering similar or more advanced features; some of the tools (although using the same or a similar name) may use completely different work mechanisms, resulting in different feature sets or results. Such tools include the following:
- Linux has ltrace that can trace library and system calls, xtrace that can trace X Window System programs,{{cite web |url=http://xtrace.alioth.debian.org/ |title=XTrace - trace X protocol connections |website=xtrace.alioth.debian.org |date= |accessdate=2014-08-12 |archive-date=2014-08-05 |archive-url=https://web.archive.org/web/20140805180608/http://xtrace.alioth.debian.org/ |url-status=dead }} SystemTap, perf, and trace-cmd and KernelShark that extend ftrace.
- AIX provides the {{Mono|truss}} command
- HP-UX offers the {{Mono|Tusc}} command
- Solaris / Illumos has truss and DTrace
- UnixWare provides the {{Mono|truss}} command
- FreeBSD provides the {{Mono|truss}} command, ktrace and DTrace
- NetBSD provides ktrace and DTrace
- OpenBSD uses ktrace and kdump
- macOS provides ktrace (10.4 and earlier), DTrace (from Solaris) and associated dtruss in 10.5 and later.{{cite web|url=https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/dtrace.1.html |title=dtrace(1) Mac OS X Manual Page |publisher=Developer.apple.com |date= |accessdate=2014-07-23}}
- Microsoft Windows has a similar utility called StraceNT, written by Pankaj Garg,{{cite web|url=http://intellectualheaven.com/default.asp?BH=StraceNT|title=IntellectualHeaven - Strace For Windows|work=intellectualheaven.com|accessdate=29 January 2015|archive-date=5 March 2016|archive-url=https://web.archive.org/web/20160305001814/http://intellectualheaven.com/default.asp?BH=StraceNT|url-status=dead}} and a similar GUI-based utility called Process Monitor, developed by Sysinternals.
See also
{{Portal|Free and open-source software|Computer programming}}
Notes
{{Reflist|group="note"}}
References
{{Reflist|30em}}
External links
- [https://strace.io/ strace project page]
- [http://man7.org/linux/man-pages/man1/strace.1.html Manual page]
- [http://www.osreviews.net/reviews/admin/strace OS Reviews article on strace]
- [http://man7.org/conf/ndctechtown2018/system_call_tracing_with_strace-NDC-TechTown-Kerrisk.pdf "System Call Tracing with strace"], a talk with an overview of strace features and usage, given by Michael Kerrisk at [https://ndctechtown.com/ NDC TechTown] 2018
- [https://static.sched.com/hosted_files/devconfcz2019/a8/devconfcz_2019-slides-modern_strace.pdf "Modern strace"] ([https://gitlab.com/strace/strace-talks/tree/master/2019-devconf.cz-brno-modern_strace source]), a talk with an overview of strace features, given by Dmitry Levin at DevConf.cz 2019
Category:Command-line software
Category:Free software programmed in C
Category:Software using the GNU Lesser General Public License