Jump to content

Strace: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
strace 5.12 released
Add category
 
(25 intermediate revisions by 18 users not shown)
Line 11: Line 11:
|released =
|released =
|discontinued =
|discontinued =
|latest release version = 5.12<ref>{{cite mailing list
| 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}}
| url = https://lists.strace.io/pipermail/strace-devel/2021-April/010516.html
| title = strace 5.12 released
| date = 2021-04-26
| accessdate = 2021-04-26
}}</ref>
|latest release date = {{Start date and age|2021|04|26}}
|latest preview version =
|latest preview version =
|latest preview date =
|latest preview date =
|programming language = [[C (programming language)|C]]<ref>https://openhub.net/p/strace</ref>
|programming language = [[C (programming language)|C]]<ref>{{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}}</ref>
|operating system = [[Linux]]
|operating system = [[Linux]]
|platform = [[AArch64]], [[DEC Alpha]], [[ARC (processor)|ARC]], [[ARM architecture|ARM EABI/OABI]], [[AVR32]], [[Blackfin]], C-SKY, [[PA-RISC|HP PA-RISC]], [[IA-32]], [[IA-64]], [[Motorola 68000 series|Motorola 68k]], [[Imagination META]], [[MicroBlaze]], [[MIPS architecture|MIPS]], [[Nios II]], [[OpenRISC]], [[Power ISA]] 32/64 bit, [[RISC-V]], [[System/390]]/[[z/Architecture]], [[SuperH]] 32/64 bit, [[SPARC]] 32/64 bit, [[TILE64|TILE]], [[TILEPro64|TILEPro]], [[TILE-Gx]], [[x86-64]], [[x32 ABI]], [[Xtensa]]
|platform = [[AArch64]], [[DEC Alpha]], [[ARC (processor)|ARC]], [[ARM architecture|ARM EABI/OABI]], [[AVR32]], [[Blackfin]], C-SKY, [[PA-RISC|HP PA-RISC]], [[IA-32]], [[IA-64]], [[LoongArch]], [[Motorola 68000 series|Motorola 68k]], [[Imagination META]], [[MicroBlaze]], [[MIPS architecture|MIPS]], [[Nios II]], [[OpenRISC]], [[Power ISA]] 32/64 bit, [[RISC-V]], [[System/390]]/[[z/Architecture]], [[SuperH]] 32/64 bit, [[SPARC]] 32/64 bit, [[TILE64|TILE]], [[TILEPro64|TILEPro]], [[TILE-Gx]], [[x86-64]], [[x32 ABI]], [[Xtensa]]
|size =
|size =
|language = [[English language|English]]
|language = [[English language|English]]{{refn|group=note|Decoding of system error messages, however, is performed in accordance with the current locale since strace 4.22.<ref>{{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
}}</ref>}}
|genre = [[Debugging]]
|genre = [[Debugging]]
|license = [[GNU Lesser General Public License|LGPL v2.1+]]
|license = [[GNU Lesser General Public License|LGPL v2.1+]]<ref group="note">The test suite is licensed under [[GNU General Public License|GPL v2.0+]].</ref><ref>{{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
}}</ref>
}}
}}


Line 34: Line 41:


== History ==
== History ==
Strace was originally written for [[SunOS]] by Paul Kranenburg in 1991, according to its copyright notice, and published early in 1992, in the volume three of comp.sources.sun. The initial [[README]] file contained the following:<ref>{{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}}</ref>
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:<ref>{{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}}</ref>


<blockquote>
<blockquote>
Line 40: Line 47:
</blockquote>
</blockquote>


Later, Branko Lankester ported this version to [[Linux]], releasing his version in November 1992 with the second release following in 1993.<ref>{{cite web |url=ftp://ftp.funet.fi/pub/Linux/tools/strace.tar.Z |title=first Linux release of strace |author=Branko Lankester |date=November 5, 1992 }}</ref><ref>{{cite web |url=ftp://ftp.funet.fi/pub/Linux/tools/strace-2.tgz |title=second Linux release of strace |author=Branko Lankester |date=June 18, 1993 }}</ref> Richard Sladkey combined these separate versions of strace in 1993, and ported the program to [[SVR4]] and [[Solaris (operating system)|Solaris]] in 1994,<ref>{{cite web |url=http://manned.org/strace/e47b83b9 |title=strace |publisher=manned.org |date=June 21, 1994 }}</ref> resulting in strace&nbsp;3.0 that was announced in comp.sources.misc in mid-1994.<ref>{{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}}</ref>
Later, Branko Lankester ported this version to [[Linux]], releasing his version in November 1992 with the second release following in 1993.<ref>{{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 }}</ref><ref>{{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 }}</ref> Richard Sladkey combined these separate versions of strace in 1993, and ported the program to [[SVR4]] and [[Solaris (operating system)|Solaris]] in 1994,<ref>{{cite web |url=http://manned.org/strace/e47b83b9 |title=strace |publisher=manned.org |date=June 21, 1994 }}</ref> resulting in strace&nbsp;3.0 that was announced in comp.sources.misc in mid-1994.<ref>{{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 }}</ref>


Beginning in 1996, strace was maintained by Wichert Akkerman. During his tenure, strace development migrated to [[Concurrent Versions System|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.
Beginning in 1996, strace was maintained by Wichert Akkerman. During his tenure, strace development migrated to [[Concurrent Versions System|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)<ref>{{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}}</ref> code for non-[[Linux]] operating systems was 4.6, released in March 2011.<ref>{{cite web |url=http://sourceforge.net/p/strace/mailman/message/27209257/ |title=strace 4.6 released |author=Dmitry V. Levin |date=March 16, 2011}}</ref> In strace version 4.7, released in May 2012,<ref>{{cite web |url=http://sourceforge.net/p/strace/mailman/message/29210530/ |title=strace 4.7 released |author=Dmitry V. Levin |date=May 2, 2012}}</ref> all non-Linux code had been removed;<ref>{{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}}</ref> since strace 4.13,<ref>{{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}}</ref> the project follows Linux kernel's release schedule, and with the version 5.0,<ref>{{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}}</ref> it follows Linux's versioning scheme as well.
The last version of strace that had some (evidently dead)<ref>{{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}}</ref> code for non-[[Linux]] operating systems was 4.6, released in March 2011.<ref>{{cite web |url=http://sourceforge.net/p/strace/mailman/message/27209257/ |title=strace 4.6 released |author=Dmitry V. Levin |date=March 16, 2011}}</ref> In strace version 4.7, released in May 2012,<ref>{{cite web |url=http://sourceforge.net/p/strace/mailman/message/29210530/ |title=strace 4.7 released |author=Dmitry V. Levin |date=May 2, 2012}}</ref> all non-Linux code had been removed;<ref>{{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}}</ref> since strace 4.13,<ref>{{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}}</ref> the project follows Linux kernel's release schedule, and as of version 5.0,<ref>{{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}}</ref> it follows Linux's versioning scheme as well.


In 2012 strace also gained support for path tracing and file descriptor path decoding.<ref>{{cite web|url=https://github.com/strace/strace/blob/v4.7/NEWS|title=Noteworthy changes in release 4.7|author=Dmitry V. Levin|date=May 1, 2012}}</ref> In August 2014, strace 4.9 was released,<ref>{{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}}</ref><ref>{{cite web|url=https://github.com/strace/strace/blob/v4.9/NEWS|title=Noteworthy changes in release 4.9|author=Dmitry V. Levin|date=August 15, 2014}}</ref> where support for stack traces printing was added. In December 2016,<ref>{{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}}</ref><ref>{{cite web|url=https://github.com/strace/strace/blob/v4.15/NEWS|title=Noteworthy changes in release 4.15|author=Dmitry V. Levin|date=December 14, 2016}}</ref> syscall [[fault injection]] feature was implemented.
In 2012 strace also gained support for path tracing and file descriptor path decoding.<ref>{{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}}</ref> In August 2014, strace 4.9 was released,<ref>{{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}}</ref><ref>{{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}}</ref> where support for stack traces printing was added. In December 2016,<ref>{{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}}</ref><ref>{{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}}</ref> syscall [[fault injection]] feature was implemented.


=== Version history ===
=== Version history ===
Line 52: Line 59:
! Version
! Version
! Release date
! Release date
! Notable changes
|-
| 6.2 || {{dts|format=dmy|2023|02|26}}<ref>{{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}}</ref>
| Implemented collision resolution for overlapping terminal/sound ioctl commands
|-
| 6.1 || {{dts|format=dmy|2022|12|12}}<ref>{{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}}</ref>
| Enhanced decoding of <code>statx</code> syscall and terminal ioctl commands
|-
| 6.0 || {{dts|format=dmy|2022|10|29}}<ref>{{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}}</ref>
| Enhanced decoding of <code>setns</code> syscall and <code>PTP_*</code> ioctl commands
|-
| 5.19 || {{dts|format=dmy|2022|08|12}}<ref>{{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}}</ref>
| The "(deleted)" marker of unlinked file descriptor paths is no longer interpreted as a part of a path; enhanced decoding of <code>arch_prctl</code>, <code>io_uring_register</code>, and <code>prctl</code> syscalls; enhanced decoding of <code>siginfo_t</code> structure
|-
| 5.18 || {{dts|format=dmy|2022|06|18}}<ref>{{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}}</ref>
|
|-
| 5.17 || {{dts|format=dmy|2022|03|26}}<ref>{{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}}</ref>
| Added support for a new <code>set_mempolicy_home_node</code> syscall on Linux
|-
| 5.16 || {{dts|format=dmy|2022|01|10}}<ref>{{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}}</ref>
| Added support for printing SELinux context mismatches (<code>--secontext=mismatch</code> option); added support for a new <code>futex_waitv</code> syscall on Linux
|-
| 5.15 || {{dts|format=dmy|2021|12|01}}<ref>{{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}}</ref>
|
|-
| 5.14 || {{dts|format=dmy|2021|09|02}}<ref>{{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}}</ref>
| Added support for the new <code>memfd_secret</code> and <code>quotactl_fd</code> syscalls decoding
|-
| 5.13 || {{dts|format=dmy|2021|07|18}}<ref>{{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}}</ref>
| Implemented System Call Vectored ABI support on the IBM POWER architecture
|-
|-
| 5.12 || {{dts|format=dmy|2021|04|26}}<ref>{{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}}</ref>
| 5.12 || {{dts|format=dmy|2021|04|26}}<ref>{{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}}</ref>
| Added support for the new <code>mount_setattr</code> syscall decoding
|-
|-
| 5.11 || {{dts|format=dmy|2021|02|17}}<ref>{{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}}</ref>
| 5.11 || {{dts|format=dmy|2021|02|17}}<ref>{{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}}</ref>
| Added option for injecting data on syscall entry/exit (<code>poke_enter=</code> and <code>poke_exit=</code> parameters of the <code>--inject</code> option); added support for the new <code>epoll_pwait2</code> syscall decoding; imlemented decoding of <code>FS_IOC_FS[GS]ETXATTR</code>, <code>FS_IOC{,32}_[GS]ETFLAGS</code>, <code>GPIO_*</code>, <code>SIOCADDMULTI</code>, <code>SIOCDELMULTI</code>, <code>SIOCGIFENCAP</code>, <code>SIOCOUTQNSD</code>, <code>SIOCSIFENCAP</code>, <code>SIOCSIFHWBROADCAST</code>, <code>UBI_IOCRPEB</code>, <code>UBI_IOCSPEB</code>, <code>V4L2_BUF_TYPE_META_CAPTURE</code>, <code>V4L2_BUF_TYPE_META_OUTPUT</code>, and <code>VIDIOC_QUERY_EXT_CTRL</code> ioctl commands
|-
|-
| 5.10 || {{dts|format=dmy|2020|12|14}}<ref>{{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}}</ref>
| 5.10 || {{dts|format=dmy|2020|12|14}}<ref>{{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}}</ref>
| Stack tracing is supported for non-native personalities when compiled with [[GNU Binutils#elfutils|<code>libdw</code>]]; added support for <code>process_madvise</code> syscall decoding
|-
|-
| 5.9 || {{dts|format=dmy|2020|09|24}}<ref>{{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}}</ref>
| 5.9 || {{dts|format=dmy|2020|09|24}}<ref>{{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}}</ref>
| Added support for <code>close_range</code> syscall decoding; added support for [[Trusted execution environment|<code>TEE_*</code>]] ioctl decoding; implemented decoding of <code>{msg,msq,sem}info</code> and <code>{msg,msq,sem}id_ds</code> structures used in the respective System V IPC syscalls commands
|-
|-
| 5.8 || {{dts|format=dmy|2020|08|06}}<ref>{{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}}</ref>
| 5.8 || {{dts|format=dmy|2020|08|06}}<ref>{{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}}</ref>
| Changed the list of syscalls covered by the <code>%process</code> group to contain syscalls associated with process lifecycle: <code>kill</code>, <code>tkill</code>, <code>tgkill</code>, <code>pidfd_send_signal</code>, and <code>rt_sigqueueinfo</code> were added, <code>arch_prctl</code> and <code>unshare</code> were removed; added support for <code>faccessat2</code> syscall decoding; added support for <code>LOOP_CONFIGURE</code> ioctl decoding
|-
|-
| 5.7 || {{dts|format=dmy|2020|06|01}}<ref>{{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}}</ref>
| 5.7 || {{dts|format=dmy|2020|06|01}}<ref>{{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}}</ref>
|
|-
|-
| 5.6 || {{dts|format=dmy|2020|04|07}}<ref>{{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}}</ref>
| 5.6 || {{dts|format=dmy|2020|04|07}}<ref>{{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}}</ref>
| Added long option aliases along with possibilities for more precise option specifications via <code>-e quiet</code>/<code>--quiet</code>, <code>-e decode-fds</code>/<code>--decode-fds</code>, <code>--absolute-timestamps</code>, <code>--relative-timestamps</code>, and <code>--syscall-times</code> options; implemented various syscall statistics improvements
|-
|-
| 5.5 || {{dts|format=dmy|2020|02|06}}<ref>{{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}}</ref>
| 5.5 || {{dts|format=dmy|2020|02|06}}<ref>{{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}}</ref>
|
|-
|-
| 5.4 || {{dts|format=dmy|2019|11|28}}<ref>{{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}}</ref>
| 5.4 || {{dts|format=dmy|2019|11|28}}<ref>{{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}}</ref>
Line 117: Line 163:
| 4.8 || {{dts|format=dmy|2013|06|03}}<ref>{{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}}</ref>
| 4.8 || {{dts|format=dmy|2013|06|03}}<ref>{{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}}</ref>
|-
|-
| 4.7 || {{dts|format=dmy|2012|05|02}}<ref>{{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}}</ref>
| 4.7 || {{dts|format=dmy|2012|05|02}}<ref>{{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}}</ref>
| All non-Linux code had been removed
|-
|-
| 4.6 || {{dts|format=dmy|2011|03|15}}<ref>{{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}}</ref>
| 4.6 || {{dts|format=dmy|2011|03|15}}<ref>{{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}}</ref>
|-
|-
| 4.5.20 || {{dts|format=dmy|2010|04|13}}
| 4.5.20 || {{dts|format=dmy|2010|04|13}}
| Added support for new <code>inotify_init1</code>, <code>perf_event_open</code>, <code>preadv</code>, <code>pwritev</code>, <code>recvmmsg</code>, <code>rt_tgsigqueueinfo</code> syscalls on Linux; <code>-C</code> option added, that combines regular and summary output; added Tile architecture support on Linux
|-
|-
| 4.5.19 || {{dts|format=dmy|2009|10|21}}
| 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 <code>accept4</code>, <code>dup3</code>, <code>epoll_create1</code>, <code>eventfd2</code>, <code>inotify_init1</code>, <code>pipe2</code>, <code>signalfd4</code> syscalls on Linux; added Blackfin, AVR32, and CRIS architedcture support on Linux
|-
|-
| 4.5.18 || {{dts|format=dmy|2008|08|28}}
| 4.5.18 || {{dts|format=dmy|2008|08|28}}
| Added support for <code>subpage_prot</code> POWER-specific syscall on Linux
|-
|-
| 4.5.17 || {{dts|format=dmy|2008|07|21}}
| 4.5.17 || {{dts|format=dmy|2008|07|21}}
| <code>-F</code> flag is deprecated, as <code>-f</code> traces <code>vfork</code> on Linux since long time
|-
|-
| 4.5.16 || {{dts|format=dmy|2007|08|03}}
| 4.5.16 || {{dts|format=dmy|2007|08|03}}
|
|-
|-
| 4.5.15 || {{dts|format=dmy|2007|01|16}}
| 4.5.15 || {{dts|format=dmy|2007|01|16}}
| Added support for new <code>*at</code>, <code>inotify*</code>, <code>pselect6</code>, <code>ppoll</code> and <code>unshare</code> syscalls on Linux
|-
|-
| 4.5.14 || {{dts|format=dmy|2007|01|16}}
| 4.5.14 || {{dts|format=dmy|2007|01|16}}
| System call number can be supplied in <code>-e</code> specification
|-
|-
| 4.5.13 || {{dts|format=dmy|2005|08|03}}
| 4.5.13 || {{dts|format=dmy|2005|08|03}}
| Add <code>desc</code> syscall group support to <code>-e trace=</code>
|-
|-
| 4.5.12 || {{dts|format=dmy|2005|06|08}}
| 4.5.12 || {{dts|format=dmy|2005|06|08}}
|
|-
|-
| 4.5.11 || {{dts|format=dmy|2005|03|22}}
| 4.5.11 || {{dts|format=dmy|2005|03|22}}
|
|-
|-
| 4.5.10 || {{dts|format=dmy|2005|03|13}}
| 4.5.10 || {{dts|format=dmy|2005|03|13}}
|
|-
|-
| 4.5.9 || {{dts|format=dmy|2004|02|04}}
| 4.5.9 || {{dts|format=dmy|2004|02|04}}
|
|-
|-
| 4.5.8 || {{dts|format=dmy|2004|10|19}}
| 4.5.8 || {{dts|format=dmy|2004|10|19}}
| Decode <code>mbind</code>, <code>[sg]et_mempolicy</code>, <code>waitid</code>, <code>fadvise64{,_64}</code>, and <code>epoll_*</code> syscalls, <code>RTC_*</code> ioctls on Linux
|-
|-
| 4.5.7 || {{dts|format=dmy|2004|08|31}}
| 4.5.7 || {{dts|format=dmy|2004|08|31}}
|
|-
|-
| 4.5.6 || {{dts|format=dmy|2004|07|12}}
| 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.5 || {{dts|format=dmy|2004|06|27}}
|
|-
|-
| 4.5.4 || {{dts|format=dmy|2004|06|03}}
| 4.5.4 || {{dts|format=dmy|2004|06|03}}
| <code>-p</code> attaches to all NPTL threads on Linux only when <code>-f</code> is supplied
|-
|-
| 4.5.3 || {{dts|format=dmy|2004|04|16}}
| 4.5.3 || {{dts|format=dmy|2004|04|16}}
| Added support for <code>mq_*</code> syscalls on Linux; <code>-p</code> now attaches to all NPTL threads on Linux
|-
|-
| 4.5.2 || {{dts|format=dmy|2004|03|01}}
| 4.5.2 || {{dts|format=dmy|2004|03|01}}
|
|-
|-
| 4.5.1 || {{dts|format=dmy|2003|11|13}}
| 4.5.1 || {{dts|format=dmy|2003|11|13}}
|
|-
|-
| 4.5 || {{dts|format=dmy|2003|09|24}}
| 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; <code>-E</code> option added
|-
|-
| 4.4 || {{dts|format=dmy|2001|08|19}}
| 4.4 || {{dts|format=dmy|2001|08|19}}
|
|-
|-
| 4.3.1 || {{dts|format=dmy|2001|04|07}}
| 4.3.1 || {{dts|format=dmy|2001|04|07}}
|
|-
|-
| 4.3 || {{dts|format=dmy|2001|04|01}}
| 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}}
| 4.2 || {{dts|format=dmy|2000|01|21}}
| Added support for IBM Z architecture on Linux
|-
|-
| 4.1 || {{dts|format=dmy|1999|11|26}}
| 4.1 || {{dts|format=dmy|1999|11|26}}
| Added support for MIPS architecture on Linux; <code>strace-graph</code> script added
|-
|-
| 4.0.1 || {{dts|format=dmy|1999|07|25}}
| 4.0.1 || {{dts|format=dmy|1999|07|25}}
|
|-
|-
| 4.0 || {{dts|format=dmy|1999|07|09}}
| 4.0 || {{dts|format=dmy|1999|07|09}}
| Fixed 64-bit <code>struct stat</code> decoding on Linux; Irix 64 updates; Solaris updates
|-
|-
| 3.99.1 || {{dts|format=dmy|1999|06|09}}
| 3.99.1 || {{dts|format=dmy|1999|06|09}}
|
|-
|-
| 3.99 || {{dts|format=dmy|1999|04|27}}
| 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}}
| 3.1 || {{dts|format=dmy|1996|06|01}}
| Added support for the Irix OS, m68k and DEC Alpha architectures on Linux; added support for <code>-o!</code> option syntax; added support for syscall classes (<code>file</code>, <code>process</code>); added support for IPC syscalls on Sun OS
|-
|-
| 3.0 || {{dts|format=dmy|1994|07|09}}<ref>{{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}}</ref>
| 3.0 || {{dts|format=dmy|1994|07|09}}<ref>{{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}}</ref>
| Initial cross-platform version by Richard Sladkey. Includes support for <code>-x</code>, <code>-q</code>, <code>-e</code> (<code>trace</code>, <code>abbrev</code>, <code>verbose</code>, <code>raw</code>, <code>signal</code>, <code>read</code>, and <code>write</code> qualifiers), <code>-c</code>, <code>-i</code> options
|}
|}


Line 195: Line 274:
* Specifying a list of paths to be traced (<code>-P /etc/ld.so.cache</code>, for example).
* Specifying a list of paths to be traced (<code>-P /etc/ld.so.cache</code>, for example).
* Specifying a list of file descriptors whose I/O should be dumped (<code>-e read=</code> and <code>-e write=</code> options).
* Specifying a list of file descriptors whose I/O should be dumped (<code>-e read=</code> and <code>-e write=</code> options).
* Counting syscall execution time and count (<code>-T</code>, <code>-c</code>, <code>-C</code>, and <code>-w</code> options).
* Counting syscall execution time and count (<code>-T</code>, <code>-c</code>, <code>-C</code>, and <code>-w</code> options; <code>-U</code> option enables printing of additional information, like minimum and maximum syscall execution time).
* Printing relative or absolute time stamps (<code>-t</code> and <code>-r</code> options).
* Printing relative or absolute time stamps (<code>-t</code> and <code>-r</code> options).
* Tampering with the syscalls being executed (<code>-e inject=''syscall specification'':''tampering specification''</code> option): modifying return (<code>:retval=</code>; since strace 4.16) and error code (<code>:error=</code>; since strace 4.15) of the specified syscalls, inject signals (<code>:signal=</code>; since strace 4.16), delays (<code>:delay_enter=</code> and <code>:delay_exit=</code>; since strace 4.22), and modify data pointed by syscall arguments (<code>:poke_enter=</code> and <code>:poke_exit=</code>; since strace 5.11) upon their execution.
* Modifying return and error code of the specified syscalls, and inject signals upon their execution (since strace 4.15, <code>-e inject=</code> option).
* Extracting information about file descriptors (including sockets, <code>-y</code> option).
* Extracting information about file descriptors (including sockets, <code>-y</code> option; <code>-yy</code> 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 (<code>-k</code> option).
* Printing stack traces, including (since strace 4.21) symbol demangling (<code>-k</code> option).
* Filtering by syscall return status (<code>-e status=</code> option; since strace 5.2<ref>Its shorthand for showing only successful calls, <code>-z</code> option, was originally added in strace 4.5, but was never documented as it did not work properly.</ref>).
* Filtering by syscall return status (<code>-e status=</code> option; since strace 5.2<ref group="note">Its shorthand for showing only successful calls, <code>-z</code> option, was originally added in strace 4.5, but was never documented as it did not work properly.</ref>).
* Perform translation of thread, process, process group, and session IDs appearing in the trace into strace's [[Linux namespaces#Process ID (pid)|PID namespace]] (<code>--pidns-translation</code> option; since strace 5.9).
* Decoding [[SELinux]] context information associated with processes, files, and descriptors (<code>--secontext</code> option; since strace 5.12).


strace supports decoding of arguments of some classes of [[ioctl]] commands, such as [[btrfs|BTRFS_*]], [[Video4Linux|V4L2_*]], [[Device mapper|DM_*]], [[Linux namespaces|NSFS_*]], [[Memory Technology Device|MEM*]], [[evdev|EVIO*]], [[Kernel-based Virtual Machine|KVM_*]], and several others.
strace supports decoding of arguments of some classes of [[ioctl]] commands, such as [[btrfs|BTRFS_*]], [[Video4Linux|V4L2_*]], [[Device mapper|DM_*]], [[Linux namespaces|NSFS_*]], [[Memory Technology Device|MEM*]], [[evdev|EVIO*]], [[Kernel-based Virtual Machine|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''.<ref name=Horky13>
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''.<ref name=Horky13>
Line 252: Line 333:
Different operating systems feature other similar or related [[Instrumentation (computer programming)|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:
Different operating systems feature other similar or related [[Instrumentation (computer programming)|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]] programs,<ref>{{cite web|url=http://xtrace.alioth.debian.org/ |title=XTrace - trace X protocol connections |website=xtrace.alioth.debian.org |date= |accessdate=2014-08-12}}</ref> [[SystemTap]], [[perf (Linux)|perf]], and [[trace-cmd]] and [[KernelShark]] that extend [[ftrace]].
* [[Linux]] has [[ltrace]] that can trace library and system calls, ''xtrace'' that can trace [[X Window System]] programs,<ref>{{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 }}</ref> [[SystemTap]], [[perf (Linux)|perf]], and [[trace-cmd]] and [[KernelShark]] that extend [[ftrace]].
* [[AIX]] provides the {{Mono|[[Truss (Unix)|truss]]}} command
* [[AIX]] provides the {{Mono|[[Truss (Unix)|truss]]}} command
* [[HP-UX]] offers the {{Mono|[[Tusc (Unix)|Tusc]]}} command
* [[HP-UX]] offers the {{Mono|[[Tusc (Unix)|Tusc]]}} command
Line 261: Line 342:
* [[OpenBSD]] uses [[ktrace]] and kdump
* [[OpenBSD]] uses [[ktrace]] and kdump
* [[macOS]] provides [[ktrace]] (10.4 and earlier), DTrace (from Solaris) and associated dtruss in 10.5 and later.<ref>{{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}}</ref>
* [[macOS]] provides [[ktrace]] (10.4 and earlier), DTrace (from Solaris) and associated dtruss in 10.5 and later.<ref>{{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}}</ref>
* [[Microsoft Windows|MS Windows]] has a similar utility called StraceNT, written by Pankaj Garg,<ref>{{cite web|url=http://intellectualheaven.com/default.asp?BH=StraceNT|title=IntellectualHeaven - Strace For Windows|work=intellectualheaven.com|accessdate=29 January 2015}}</ref> and a similar [[GUI]]-based utility called [[Process Monitor]], developed by [[Sysinternals]].
* [[Microsoft Windows]] has a similar utility called StraceNT, written by Pankaj Garg,<ref>{{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}}</ref> and a similar [[GUI]]-based utility called [[Process Monitor]], developed by [[Sysinternals]].


==See also==
==See also==
Line 268: Line 349:
* [[List of Unix commands]]
* [[List of Unix commands]]
* [[lsof]]
* [[lsof]]

== Notes ==
{{Reflist|group="note"}}


== References ==
== References ==
Line 279: Line 363:
* [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
* [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:Unix programming tools]]
[[Category:Command-line software]]
[[Category:Command-line software]]
[[Category:Debuggers]]
[[Category:Free software programmed in C]]
[[Category:Free software programmed in C]]
[[Category:Software using the LGPL license]]
[[Category:Unix programming tools]]

Latest revision as of 15:54, 16 October 2024

strace
Original author(s)Paul Kranenburg
Developer(s)Dmitry Levin
Stable release
6.12[1] Edit this on Wikidata / 18 November 2024; 15 days ago (18 November 2024)
Repository
Written inC[2]
Operating systemLinux
PlatformAArch64, 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
Available inEnglish[note 1]
TypeDebugging
LicenseLGPL v2.1+[note 2][4]
Websitestrace.io Edit this on Wikidata

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

[edit]

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:[5]

strace(1) is a system call tracer for Sun(tm) systems much like the Sun supplied program trace(1). 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.[6][7] Richard Sladkey combined these separate versions of strace in 1993, and ported the program to SVR4 and Solaris in 1994,[8] resulting in strace 3.0 that was announced in comp.sources.misc in mid-1994.[9]

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)[10] code for non-Linux operating systems was 4.6, released in March 2011.[11] In strace version 4.7, released in May 2012,[12] all non-Linux code had been removed;[13] since strace 4.13,[14] the project follows Linux kernel's release schedule, and as of version 5.0,[15] it follows Linux's versioning scheme as well.

In 2012 strace also gained support for path tracing and file descriptor path decoding.[16] In August 2014, strace 4.9 was released,[17][18] where support for stack traces printing was added. In December 2016,[19][20] syscall fault injection feature was implemented.

Version history

[edit]
Version Release date Notable changes
6.2 26 February 2023[21] Implemented collision resolution for overlapping terminal/sound ioctl commands
6.1 12 December 2022[22] Enhanced decoding of statx syscall and terminal ioctl commands
6.0 29 October 2022[23] Enhanced decoding of setns syscall and PTP_* ioctl commands
5.19 12 August 2022[24] The "(deleted)" marker of unlinked file descriptor paths is no longer interpreted as a part of a path; enhanced decoding of arch_prctl, io_uring_register, and prctl syscalls; enhanced decoding of siginfo_t structure
5.18 18 June 2022[25]
5.17 26 March 2022[26] Added support for a new set_mempolicy_home_node syscall on Linux
5.16 10 January 2022[27] Added support for printing SELinux context mismatches (--secontext=mismatch option); added support for a new futex_waitv syscall on Linux
5.15 1 December 2021[28]
5.14 2 September 2021[29] Added support for the new memfd_secret and quotactl_fd syscalls decoding
5.13 18 July 2021[30] Implemented System Call Vectored ABI support on the IBM POWER architecture
5.12 26 April 2021[31] Added support for the new mount_setattr syscall decoding
5.11 17 February 2021[32] Added option for injecting data on syscall entry/exit (poke_enter= and poke_exit= parameters of the --inject option); added support for the new epoll_pwait2 syscall decoding; imlemented decoding of FS_IOC_FS[GS]ETXATTR, FS_IOC{,32}_[GS]ETFLAGS, GPIO_*, SIOCADDMULTI, SIOCDELMULTI, SIOCGIFENCAP, SIOCOUTQNSD, SIOCSIFENCAP, SIOCSIFHWBROADCAST, UBI_IOCRPEB, UBI_IOCSPEB, V4L2_BUF_TYPE_META_CAPTURE, V4L2_BUF_TYPE_META_OUTPUT, and VIDIOC_QUERY_EXT_CTRL ioctl commands
5.10 14 December 2020[33] Stack tracing is supported for non-native personalities when compiled with libdw; added support for process_madvise syscall decoding
5.9 24 September 2020[34] Added support for close_range syscall decoding; added support for TEE_* ioctl decoding; implemented decoding of {msg,msq,sem}info and {msg,msq,sem}id_ds structures used in the respective System V IPC syscalls commands
5.8 6 August 2020[35] Changed the list of syscalls covered by the %process group to contain syscalls associated with process lifecycle: kill, tkill, tgkill, pidfd_send_signal, and rt_sigqueueinfo were added, arch_prctl and unshare were removed; added support for faccessat2 syscall decoding; added support for LOOP_CONFIGURE ioctl decoding
5.7 1 June 2020[36]
5.6 7 April 2020[37] Added long option aliases along with possibilities for more precise option specifications via -e quiet/--quiet, -e decode-fds/--decode-fds, --absolute-timestamps, --relative-timestamps, and --syscall-times options; implemented various syscall statistics improvements
5.5 6 February 2020[38]
5.4 28 November 2019[39]
5.3 25 September 2019[40]
5.2 12 July 2019[41]
5.1 22 May 2019[42]
5.0 19 March 2019[43]
4.26 26 December 2018[44]
4.25 30 October 2018[45]
4.24 14 August 2018[46]
4.23 14 June 2018[47]
4.22 5 April 2018[48]
4.21 13 February 2018[49]
4.20 13 November 2017[50]
4.19 5 September 2017[51]
4.18 5 July 2017[52]
4.17 24 May 2017[53]
4.16 14 February 2017[54]
4.15 14 December 2016[55]
4.14 4 October 2016[56]
4.13 26 July 2016[57]
4.12 31 May 2016[58]
4.11 21 December 2015[59]
4.10 6 March 2015[60]
4.9 15 August 2014[61]
4.8 3 June 2013[62]
4.7 2 May 2012[63] All non-Linux code had been removed
4.6 15 March 2011[64]
4.5.20 13 April 2010 Added support for new inotify_init1, perf_event_open, preadv, pwritev, recvmmsg, rt_tgsigqueueinfo syscalls on Linux; -C option added, that combines regular and summary output; added Tile architecture support on Linux
4.5.19 21 October 2009 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 accept4, dup3, epoll_create1, eventfd2, inotify_init1, pipe2, signalfd4 syscalls on Linux; added Blackfin, AVR32, and CRIS architedcture support on Linux
4.5.18 28 August 2008 Added support for subpage_prot POWER-specific syscall on Linux
4.5.17 21 July 2008 -F flag is deprecated, as -f traces vfork on Linux since long time
4.5.16 3 August 2007
4.5.15 16 January 2007 Added support for new *at, inotify*, pselect6, ppoll and unshare syscalls on Linux
4.5.14 16 January 2007 System call number can be supplied in -e specification
4.5.13 3 August 2005 Add desc syscall group support to -e trace=
4.5.12 8 June 2005
4.5.11 22 March 2005
4.5.10 13 March 2005
4.5.9 4 February 2004
4.5.8 19 October 2004 Decode mbind, [sg]et_mempolicy, waitid, fadvise64{,_64}, and epoll_* syscalls, RTC_* ioctls on Linux
4.5.7 31 August 2004
4.5.6 12 July 2004 Added support for 64-bit SPARC architecture on Linux.
4.5.5 27 June 2004
4.5.4 3 June 2004 -p attaches to all NPTL threads on Linux only when -f is supplied
4.5.3 16 April 2004 Added support for mq_* syscalls on Linux; -p now attaches to all NPTL threads on Linux
4.5.2 1 March 2004
4.5.1 13 November 2003
4.5 24 September 2003 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; -E option added
4.4 19 August 2001
4.3.1 7 April 2001
4.3 1 April 2001 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 21 January 2000 Added support for IBM Z architecture on Linux
4.1 26 November 1999 Added support for MIPS architecture on Linux; strace-graph script added
4.0.1 25 July 1999
4.0 9 July 1999 Fixed 64-bit struct stat decoding on Linux; Irix 64 updates; Solaris updates
3.99.1 9 June 1999
3.99 27 April 1999 New maintainer, Wichert Akkerman; added support for IBM POWER, SPARC, and ARM architectures on Linux; added support for many syscalls on Linux
3.1 1 June 1996 Added support for the Irix OS, m68k and DEC Alpha architectures on Linux; added support for -o! option syntax; added support for syscall classes (file, process); added support for IPC syscalls on Sun OS
3.0 9 July 1994[65] Initial cross-platform version by Richard Sladkey. Includes support for -x, -q, -e (trace, abbrev, verbose, raw, signal, read, and write qualifiers), -c, -i options

Usage and features

[edit]

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 -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 clone,fork,vfork; using one of the predefined groups, like %ipc or %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.2[note 3]).
  • 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.[66][67][68]

Examples

[edit]

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.

Similar tools

[edit]

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:

See also

[edit]

Notes

[edit]
  1. ^ Decoding of system error messages, however, is performed in accordance with the current locale since strace 4.22.[3]
  2. ^ The test suite is licensed under GPL v2.0+.
  3. ^ Its 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.

References

[edit]
  1. ^ "Release 6.12". 18 November 2024. Retrieved 30 November 2024.
  2. ^ "The strace Open Source Project on Open Hub". Openhub.net. Retrieved 2021-11-23.
  3. ^ Dmitry V. Levin (2018-04-01). "[PATCH] Add i18n support" (Mailing list). Retrieved 2021-09-02.
  4. ^ Dmitry V. Levin (2018-12-15). "I: changing the license of strace to a copyleft license" (Mailing list). Retrieved 2021-09-02.
  5. ^ Paul Kranenburg (March 2, 1992). "Strace - an alternative syscall tracer". Newsgroupcomp.sources.sun.
  6. ^ Branko Lankester (November 5, 1992). "first Linux release of strace".
  7. ^ Branko Lankester (June 18, 1993). "second Linux release of strace".
  8. ^ "strace". manned.org. June 21, 1994.
  9. ^ "SUNET's Index of /pub/usenet/ftp.uu.net/comp.sources.misc/volume43/strace". Archived from the original on September 11, 2007. Retrieved January 14, 2015.
  10. ^ Denys Vlasenko (February 7, 2012). "How about removing non-Linux code?".
  11. ^ Dmitry V. Levin (March 16, 2011). "strace 4.6 released".
  12. ^ Dmitry V. Levin (May 2, 2012). "strace 4.7 released".
  13. ^ Dmitry V. Levin (April 20, 2012). "Noteworthy changes in release 4.7".
  14. ^ Dmitry V. Levin (October 4, 2016). "strace 4.14 released".
  15. ^ Dmitry V. Levin (March 19, 2019). "strace 5.0 released".
  16. ^ Dmitry V. Levin (May 1, 2012). "Noteworthy changes in release 4.7". GitHub.
  17. ^ Dmitry V. Levin (August 15, 2014). "strace 4.9 released".
  18. ^ Dmitry V. Levin (August 15, 2014). "Noteworthy changes in release 4.9". GitHub.
  19. ^ Dmitry V. Levin (December 14, 2016). "strace 4.15 released".
  20. ^ Dmitry V. Levin (December 14, 2016). "Noteworthy changes in release 4.15". GitHub.
  21. ^ Dmitry V. Levin (2023-02-26). "strace 6.2 released".
  22. ^ Dmitry V. Levin (2022-12-12). "strace 6.1 released".
  23. ^ Dmitry V. Levin (2022-10-29). "strace 6.0 released".
  24. ^ Dmitry V. Levin (2022-08-12). "strace 5.19 released".
  25. ^ Dmitry V. Levin (2022-06-18). "strace 5.18 released".
  26. ^ Dmitry V. Levin (2022-03-27). "strace 5.17 released".
  27. ^ Dmitry V. Levin (2022-01-10). "strace 5.16 released".
  28. ^ Dmitry V. Levin (2021-12-01). "strace 5.15 released".
  29. ^ Dmitry V. Levin (2021-09-02). "strace 5.14 released".
  30. ^ Dmitry V. Levin (2021-07-18). "strace 5.13 released".
  31. ^ Dmitry V. Levin (2021-04-26). "strace 5.12 released".
  32. ^ Dmitry V. Levin (2021-02-17). "strace 5.11 released".
  33. ^ Dmitry V. Levin (2020-12-14). "strace 5.10 released".
  34. ^ Dmitry V. Levin (2020-09-24). "strace 5.9 released".
  35. ^ Dmitry V. Levin (2020-08-06). "strace 5.8 released".
  36. ^ Dmitry V. Levin (2020-06-01). "strace 5.7 released".
  37. ^ Dmitry V. Levin (2020-04-07). "strace 5.6 released".
  38. ^ Dmitry V. Levin (2020-02-06). "strace 5.5 released".
  39. ^ Dmitry V. Levin (2019-11-28). "strace 5.4 released".
  40. ^ Dmitry V. Levin (2019-09-25). "strace 5.3 released".
  41. ^ Dmitry V. Levin (2019-07-12). "strace 5.2 released".
  42. ^ Dmitry V. Levin (2019-05-22). "strace 5.1 released".
  43. ^ Dmitry V. Levin (2019-03-19). "strace 5.0 released".
  44. ^ Dmitry V. Levin (2018-12-26). "strace 4.26 released".
  45. ^ Dmitry V. Levin (2018-10-30). "strace 4.25 released".
  46. ^ Dmitry V. Levin (2018-08-14). "strace 4.24 released".
  47. ^ Dmitry V. Levin (2018-06-14). "strace 4.23 released".
  48. ^ Dmitry V. Levin (2018-04-05). "strace 4.22 released".
  49. ^ Dmitry V. Levin (2018-02-13). "strace 4.21 released".
  50. ^ Dmitry V. Levin (2017-11-13). "strace 4.20 released".
  51. ^ Dmitry V. Levin (2017-09-05). "strace 4.19 released".
  52. ^ Dmitry V. Levin (2017-07-05). "strace 4.18 released".
  53. ^ Dmitry V. Levin (2017-05-24). "strace 4.17 released".
  54. ^ Dmitry V. Levin (2017-02-14). "strace 4.16 released".
  55. ^ Dmitry V. Levin (2016-12-14). "strace 4.15 released".
  56. ^ Dmitry V. Levin (2016-10-04). "strace 4.14 released".
  57. ^ Dmitry V. Levin (2016-07-26). "strace 4.13 released".
  58. ^ Dmitry V. Levin (2016-05-31). "strace 4.12 released".
  59. ^ Dmitry V. Levin (2015-12-21). "strace 4.11 released".
  60. ^ Dmitry V. Levin (2015-03-06). "strace 4.10 released".
  61. ^ Dmitry V. Levin (2014-08-15). "strace 4.9 released".
  62. ^ Dmitry V. Levin (2013-06-03). "strace 4.8 released".
  63. ^ Dmitry V. Levin (2012-05-02). "strace 4.7 released".
  64. ^ Dmitry V. Levin (2011-03-15). "strace 4.6 released".
  65. ^ Rick Sladkey (1994-07-09). "v43i075: strace - system call tracer for sunos, linux, svr4, solaris2, Part01/10".
  66. ^ Horky, Jiri (2013). "The ioapps IO profiler and IO traces replayer". Retrieved 2013-09-16.
  67. ^ Waterland, Amos (2007). "The sreplay system call replayer". Retrieved 2013-09-16.
  68. ^ Burton, Ariel (1998). "Workload characterization using lightweight system call tracing and reexecution" (PDF). Retrieved 2013-09-16.
  69. ^ "XTrace - trace X protocol connections". xtrace.alioth.debian.org. Archived from the original on 2014-08-05. Retrieved 2014-08-12.
  70. ^ "dtrace(1) Mac OS X Manual Page". Developer.apple.com. Retrieved 2014-07-23.
  71. ^ "IntellectualHeaven - Strace For Windows". intellectualheaven.com. Archived from the original on 5 March 2016. Retrieved 29 January 2015.
[edit]