Commit Graph

96 Commits

Author SHA1 Message Date
3c17d1b5e1 Implement caching of print_sockaddr_by_inode
As -yy parser, compared to -y, needs to do at least 5 extra syscalls
(getxattr, socket, sendmsg, recvmsg, close) to print socket details,
caching results of netlink conversations between strace and kernel
noticeably reduces amount of system time spent by strace.

The caching is safe since sockets do not change their addresses after
successful bind or connect syscall.

* defs.h (string_quote, print_sockaddr_by_inode_cached): New prototypes.
* socketutils.c (cache_entry): New type.
(CACHE_SIZE, CACHE_MASK): New macros.
(cache): New static array.
(cache_and_print_inode_details): New static function.
(print_sockaddr_by_inode_cached): New function.
(inet_parse_response, unix_parse_response): Use
cache_and_print_inode_details.
* util.c (printfd): Use string_quote and print_sockaddr_by_inode_cached.
(string_quote): Remove static qualifier.
* NEWS: Mention this improvement.
* tests/unix-yy.c (main): Update.
2016-02-03 12:43:22 +00:00
dfea1da0e6 Fixed decoding of mincore syscall's last argument
* mem.c (SYS_FUNC(mincore)): Print only those bytes of the vector
that were written by the kernel.
* NEWS: Mention this fix.
* tests/mincore.c: New file.
* tests/mincore.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add mincore.
(TESTS): Add mincore.test.
* tests/.gitignore: Add mincore.
2016-01-29 02:39:40 +00:00
fa8c286d50 Implement simultaneous use of -p option and tracing of a command
* strace.c (init): Allow -p option along with a command.
(startup_child): In -D mode, record the parent of the tracer process
as strace_child.
(startup_attach): Save trace_tracer_pid before -D mode fork.
When tracing a command in -f mode, do not check for the command's
threads as it has no threads at this moment.
Never attach to the tracer process.
In -D mode, never attach to the parent of the tracer process,
terminate that process only once at the end of startup_attach,
and reset strace_child.
* strace.1: Document that -p option can be used along with tracing
of a command.
* NEWS: Mention it.
* tests/attach-p-cmd-cmd.c: New file.
* tests/attach-p-cmd-p.c: Likewise.
* tests/attach-p-cmd.test: New test.
* tests/.gitignore: Add attach-p-cmd-cmd and attach-p-cmd-p.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add attach-p-cmd.test.

This fixes Debian bug #549942.
2016-01-22 19:37:11 +00:00
d44707d889 Fix dumping of recvmmsg syscall in case of short read
* net.c (dumpiov_in_mmsghdr): Call dumpiov_upto instead of dumpiov,
pass data size limit to dumpiov_upto.
* NEWS: Mention this fix.
* tests/mmsg.c (main): Update.
2016-01-20 17:36:41 +00:00
93c9d1cdbd Fix dumping of recvmsg syscall in case of short read
* defs.h (dumpiov_in_msghdr): Add unsigned long argument.
* net.c (dumpiov_in_msghdr): Add data_size argument.  Call dumpiov_upto
instead of dumpiov, pass data_size to dumpiov_upto.
* syscall.c (dumpio): Pass data size limit to dumpiov_in_msghdr.
* NEWS: Mention this fix.
* tests/recvmsg.c: New file.
* tests/recvmsg.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add recvmsg.
(TESTS): Add recvmsg.test.
* tests/.gitignore: Add recvmsg.
2016-01-20 17:35:27 +00:00
05a0af6d60 Fix decoding and dumping of readv syscall in case of short read
* defs.h (dumpiov_upto): New prototype.
(dumpiov): Change to a wrapper around dumpiov_upto.
* util.c (dumpiov): Rename to dumpiov_upto, add and check data_size
argument.
* io.c (SYS_FUNC(readv)): Call tprint_iov_upto instead
of tprint_iov and specify syscall return value as a data size limit.
* syscall.c (dumpio): In case of SEN_readv, call dumpiov_upto instead
of dumpiov and specify syscall return value as a data size limit.
* NEWS: Mention this fix.
* tests/readv.c: New file.
* tests/readv.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add readv.
(TESTS): Add readv.test.
* tests/.gitignore: Add readv.
2016-01-20 15:31:26 +00:00
1763fa5f62 s390, s390x: fix printing of syscalls unknown to the kernel
On s390/s390x, syscalls with NR up to 255 can be implemented
directly using "svc NR", for NR >= 256 "svc 0" with %r1=NR is used.
The latter method is allowed for NR < 256, too.

When the syscall number specified directly or indirectly is recognized
by the kernel, i.e. it is less than its NR_syscalls value, it is stored
in %r2 and is available to arch_get_scno via s390_regset.gprs[2].
For syscall numbers >= NR_syscalls this register is set to 0,
but %r1 remains unchanged and could be used by arch_get_scno
via s390_regset.gprs[1] to decide what the syscall number is.

* linux/s390/get_scno.c (arch_get_scno): If s390_regset.gprs[2] is zero,
take syscall number from s390_regset.gprs[1].
* NEWS: Mention this fix.

This fixes Debian bug #485979 and Fedora bug #1298294.
2016-01-13 21:27:48 +00:00
b1110543d9 sparc: fix mlock2 sysentry, wire up bind, listen, and setsockopt syscalls
* linux/sparc/syscallent.h [353]: Move mlock2 entry to 356.
[353, 354, 355]: Add bind, listen, and setsockopt entries.
* NEWS: Mention this.
2016-01-09 21:58:44 +00:00
2720a61832 alpha: enhance decoding of getxpid, getxuid, and getxgid syscalls
Print the second return value of getxpid, getxuid, and getxgid syscalls
that return a pair of values using the same mechanism as pipe syscall.

* alpha.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/alpha/syscallent.h [20]: Change SEN(getpid) to SEN(getxpid).
[24]: Change SEN(getuid) to SEN(getxuid).
[47]: Change SEN(getgid) to SEN(getxgid).
* NEWS: Mention this enhancement.
* tests/uid.awk: Update for getxgid output change.
* tests/uid.test: Cleanup.
* tests/getxxid.c: New file.
* tests/getxxid.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add getxxid.
(TESTS): Add getxxid.test.
* tests/.gitignore: Add getxxid.
2016-01-09 00:09:04 +00:00
be1cb92c72 Fix printing of 32-bit times syscall return value on 64-bit architectures
This change complements commit v4.9-359-gd93d9f8 by fixing
RVAL_UDECIMAL case.
The only syscall that appears to be affected is the times syscall.

* syscall.c (trace_syscall_exiting): In case of RVAL_UDECIMAL,
when current personality is 32-bit, print 32-bit return code.
* NEWS: Mention this fix.

Reported-by: Steve McIntyre <steve@einval.com>
2016-01-07 19:47:23 +00:00
6bf08e3e4a Fix and enhance decoding of sched_[gs]etaffinity syscalls
Print cpu_set_t as a set of integers, similar to the way
fd_set is printed as a set of descriptors.

* affinity.c: Include <sched.h>.
(get_cpuset_size): New function.
(print_affinitylist): Rewrite using get_cpuset_size and next_set_bit.
(sched_getaffinity, sched_setaffinity): Print first two args as ints.
* NEWS: Mention this enhancement.
* tests/sched_xetaffinity.c: New file.
* tests/sched_xetaffinity.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add sched_xetaffinity.
(TESTS): Add sched_xetaffinity.test.
* tests/.gitignore: Add sched_xetaffinity.

Reported-by: Joe Korty <joe.korty@ccur.com>
2016-01-07 02:11:55 +00:00
97cbf69756 Enhance personality syscall decoding
* personality.c (SYS_FUNC(personality)): On entering syscall,
print first argument not as a hex value but as a set of flags.
On exiting syscall, print return code as a set of flags.
* NEWS: Mention this enhancement.
2015-12-25 00:46:07 +00:00
dd1a80c8d2 arc, metag, nios2, or1k, tile: fix build
Fix build regression introduced by commit
34683e3926.

* linux/32/syscallent.h: Add sys_ prefix to ARCH_mmap and mmap.
* linux/arc/syscallent.h: Add sys_ prefix to ARCH_mmap and mmap_pgoff.
* linux/nios2/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/tile/syscallent1.h: Add sys_ prefix to ARCH_mmap and sys_mmap_4koff.
* pathtrace.c (pathtrace_match): Handle SEN_ARCH_mmap.
* NEWS: Mention this build fix.

Reported-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
2015-12-24 17:36:58 +00:00
cbde4e2671 maint: post-release administrivia
* NEWS: Add header line for the next release.
2015-12-23 04:35:59 +00:00
2acb065f42 Prepare for 4.11 release
* NEWS: Update for 4.11 release.
* debian/changelog: 4.11-1.
* strace.spec: 4.11-1.
2015-12-21 20:21:22 +00:00
7405b1225a NEWS: Prepare for 4.11 release 2015-12-19 20:57:30 +00:00
91bdbb46ff maint: post-release administrivia
* NEWS: Add header line for next release.
2015-03-09 22:05:40 +00:00
dfabccf997 Prepare for 4.10 release
* NEWS: Update for 4.10 release.
* debian/changelog: 4.10-1.
* strace.spec: 4.10-1.
2015-03-06 13:14:15 +00:00
48f0890953 ia64: use PTRACE_GETREGS to fetch registers
* linux/ia64/arch_regs.h: Stop including <asm/rse.h>.
(ia64_frame_ptr): New declaration.
* signal.c (sys_sigreturn) [IA64]: Use ia64_frame_ptr.
* syscall.c [IA64]: Include <asm/rse.h>.
[IA64] (ia64_regs, ia64_frame_ptr): New variable.
[IA64] (ARCH_REGS_FOR_GETREGS): New macro.
[IA64] (ia64_ia32mode): Convert to macro.
[IA64] (ia64_r8, ia64_r10): Remove.
(getrval2, print_pc, get_scno, get_syscall_args, get_error) [IA64]:
Use ia64_regs.
(get_syscall_result) [IA64]: Remove.
2015-03-05 23:37:27 +00:00
20eca8a1c5 s390, s390x: use PTRACE_GETREGSET to fetch registers
* linux/s390/arch_regs.h: New file.
* linux/s390x/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add them.
* signal.c (sys_sigreturn) [S390 || S390X]: Use s390_frame_ptr.
* syscall.c [S390 || S390X] (s390_regset, s390_frame_ptr): New variable.
[S390 || S390X] (ARCH_REGS_FOR_GETREGSET): New macro.
(print_pc) [S390 || S390X]: Use s390_regset.
(get_scno) [S390 || S390X]: Likewise.
(get_syscall_args) [S390 || S390X]: Likewise.
(get_error) [S390 || S390X]: Likewise.
(get_syscall_result) [S390 || S390X]: Remove.
2015-03-05 22:10:15 +00:00
a671a2c7b4 NEWS: Prepare for 4.10 release 2015-02-24 03:36:38 +00:00
e277a90fbd maint: post-release administrivia
* NEWS: Add header line for next release.
2014-08-19 11:34:44 +00:00
e4db4c4bdd Prepare for 4.9 release
* NEWS: Update for 4.9 release.
* debian/changelog: 4.9-1.
* strace.spec: 4.9-1.
2014-08-15 13:14:15 +00:00
6d32e463ab NEWS: Update for 4.9 release 2014-08-15 00:36:36 +00:00
2734a7010f Document -k option as experimental
strace -k does not produce a reliable output on all supported
configurations yet, even basic strace-k.test is known to fail
on some of them.

* strace.c (usage): Document -k option as experimental.
* strace.1: Likewise.
* NEWS: Likewise.
2014-06-18 15:41:19 +00:00
d04bb2bb80 Fix delete_module decoding
* xlat/delete_module_flags.in: New file.
* file.c (sys_delete_module): Move ...
* bjm.c (sys_delete_module): ... to here.
Decode 1st argument using printstr instead of printpath.
* NEWS: Mention it.
2014-06-04 16:29:18 +00:00
327102c7f6 NEWS: Prepare for 4.9 release 2014-06-03 13:31:37 +00:00
Mark Hills
e53bf23f1c Optionally produce stats on syscall latency
Time spent in system time is not useful where a syscall depends on some
non-CPU resource, eg. typically open() or stat() to a network drive.

This patch adds a new flag (-w) to produce a summary of the time
difference between beginning and end of the system call (ie. latency)

This functionality has been useful to profile slow processes that
are not CPU-bound.

Signed-off-by: Mark Hills <mark.hills@framestore.com>
2014-05-29 18:15:38 +00:00
02d2c708de maint: post-release administrivia
* NEWS: Add header line for next release.
2013-06-05 21:33:45 +00:00
1cd3f5f844 ioctlent: add UAPI support
* Makefile.am (IOCTLSORT_INCLUDEDIR): Define.
(ioctlsort): Use it.
* linux/ioctlent.sh (lookup_ioctls): Look into uapi directory tree.
Strip "uapi/" prefix from output path names.
* linux/ioctlent.h.in: Regenerate from v3.9 headers.
* NEWS: Mention it.
2013-06-03 16:24:53 +00:00
d845411e8c Prepare for 4.8 release
* NEWS: Update for 4.8 release.
* debian/changelog: 4.8-1.
* strace.spec: 4.8-1.
2013-06-03 12:34:56 +00:00
dce7593cab build: introduce git-version-gen
* .gitignore: Add .version.
* Makefile.am (EXTRA_DIST, BUILT_SOURCES): Add $(srcdir)/.version.
Add rules to check NEWS, generate $(srcdir)/.version and
$(distdir)/.tarball-version files.
Change ChangeLog and CREDITS generation rules to depend on
$(srcdir)/.version instead of $(srcdir)/.git/refs/heads/*.
* NEWS: Add dates to recent releases.
* configure.ac (AC_INIT): Use git-version-gen.
(AM_INIT_AUTOMAKE): Remove check-news.
* git-version-gen: Import from gnulib.
* make-dist: Check NEWS.
2013-04-30 23:52:12 +00:00
503faaae3a maint: post-release administrivia
* NEWS: Add header line for next release.
2012-05-02 23:00:34 +00:00
a28fbfd523 Update STA_* constants
* time.c (adjtimex_status): Add STA_NANO, STA_MODE, and STA_CLK.
* NEWS (Improvements): Mention it.
2012-05-01 21:17:51 +00:00
4ef3063c95 NEWS: update for release
* NEWS (Improvements): Mention recent recvmsg/recvmmsg decoders
enhancements.
(Portability): Add a recommendation for the minimum Linux kernel
version to use.
2012-05-01 21:04:18 +00:00
Mike Frysinger
9b4fca2853 NEWS: clarify & fix typo
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-27 23:38:45 +00:00
84e50fc764 Update NEWS for upcoming 4.7 release
* NEWS: Update for 4.7 release.
2012-04-20 17:32:50 +00:00
50e69cbe74 Prepare for 4.6 release
* NEWS: Update for 4.6 release.
* configure.ac: Version 4.6.
* debian/changelog: 4.6-1.
* strace.spec: 4.6-1.
2011-03-14 15:39:36 +00:00
acbe51899a Prepare for 4.5.20 release
* NEWS: Update for 4.5.20 release.
* configure.ac: Version 4.5.20.
* debian/changelog: 4.5.20-1.
* strace.spec: 4.5.20-1.
2010-04-13 16:09:23 +00:00
d7bb8b49cc * NEWS: Update for 4.5.19 release. 2009-10-08 22:29:20 +00:00
84c693e99a * NEWS: Update for 4.5.19 release. 2009-10-06 10:40:17 +00:00
fbfed22854 Prepare for 4.5.19 release
* NEWS: Update for 4.5.19 release.
* configure.ac: Version 4.5.19.
* debian/changelog: 4.5.19-1.
* strace.spec: 4.5.19-1.
2009-09-19 00:52:24 +00:00
Roland McGrath
09db705c51 Prepare for 4.5.18 release 2008-08-28 22:00:46 +00:00
Roland McGrath
55dd2780de 2008-07-17 Roland McGrath <roland@redhat.com>
* NEWS, strace.spec: Updates in preparation for release.
2008-07-18 02:21:11 +00:00
Roland McGrath
47d3223c73 2007-08-03 Roland McGrath <roland@redhat.com>
* configure.ac, NEWS: Version 4.5.16.
	* debian/changelog, strace.spec: 4.5.16-1.
2007-08-03 10:28:55 +00:00
Roland McGrath
0a45fae03e log updates 2007-01-16 23:25:34 +00:00
Roland McGrath
a0de7c1f64 log update 2007-01-16 01:02:38 +00:00
Roland McGrath
16a3a52e0c 2007-01-11 Roland McGrath <roland@redhat.com>
* configure.ac, NEWS: Version 4.5.15.
	* debian/changelog, strace.spec: 4.5.15-1.
2007-01-11 22:22:42 +00:00
Roland McGrath
f4d9b49453 2006-01-16 Roland McGrath <roland@redhat.com>
* configure.ac, NEWS: Version 4.5.14.
	* debian/changelog, strace.spec: 4.5.14-1.
2006-01-17 06:22:57 +00:00
Roland McGrath
cab4380dbb 2005-08-03 Roland McGrath <roland@redhat.com>
* configure.ac, NEWS: Version 4.5.13.
	* debian/changelog, strace.spec: 4.5.13-1.
2005-08-03 11:42:35 +00:00