]> granicus.if.org Git - strace/log
strace
8 years agoWire up userfaultfd, membarrier, and mlock2 syscalls
Dmitry V. Levin [Sun, 15 Nov 2015 02:37:51 +0000 (02:37 +0000)]
Wire up userfaultfd, membarrier, and mlock2 syscalls

* linux/dummy.h (membarrier, mlock2, userfaultfd): New stub aliases.
* linux/32/syscallent.h (userfaultfd, membarrier, mlock2): New entries.
* linux/64/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/arm/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/hppa/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/i386/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/ia64/syscallent.h (userfaultfd, membarrier): Likewise.
* linux/m68k/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/microblaze/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/mips/syscallent-n32.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/mips/syscallent-n64.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/mips/syscallent-o32.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/powerpc/syscallent.h (userfaultfd, membarrier): Likewise.
* linux/s390/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/s390x/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/sparc/syscallent.h (membarrier, userfaultfd, mlock2): Likewise.
* linux/x32/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/x86_64/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.

8 years agosprintflags: skip zero flags
Dmitry V. Levin [Sun, 15 Nov 2015 20:44:13 +0000 (20:44 +0000)]
sprintflags: skip zero flags

Tweak sprintflags behaviour to match printflags.

* util.c (sprintflags): Skip zero flags unless the value passed
to sprintflags is also zero.

8 years agoprintflags: handle empty xlats
Mike Frysinger [Sat, 31 Oct 2015 04:47:59 +0000 (00:47 -0400)]
printflags: handle empty xlats

If the set of headers are unable to produce a valid list, printflags
will try to pass NULL to tprints which crashes.  Add a sanity check
for this edge case.

* util.c (printflags): Check xlat->str is not NULL.

8 years agompers: forward mpers_DEFS to mpers.sh
Dmitry V. Levin [Mon, 16 Nov 2015 01:12:18 +0000 (01:12 +0000)]
mpers: forward mpers_DEFS to mpers.sh

mpers_DEFS has to be forwarded to mpers.sh so that config.h would be
properly included by defs.h at preprocessor stage.

* Makefile.am (mpers-m%.stamp): Add the whole $(mpers_sh_opts) set of
options to mpers.sh's CPPFLAGS.

8 years agotests/ioctl: workaround glibc ioctl wrapper on powerpc
Dmitry V. Levin [Mon, 16 Nov 2015 01:53:43 +0000 (01:53 +0000)]
tests/ioctl: workaround glibc ioctl wrapper on powerpc

* tests/ioctl.c (main) [POWERPC] Disable TCGETS test.

8 years agopowerpc: wire up switch_endian syscall
Dmitry V. Levin [Sun, 15 Nov 2015 16:51:55 +0000 (16:51 +0000)]
powerpc: wire up switch_endian syscall

powerpc has switch_endian syscall starting with linux commit
v4.0-rc4-67-g529d235.

* linux/powerpc/syscallent.h (switch_endian): New entry.

8 years agosparc: reserve more space for new syscalls
Dmitry V. Levin [Sun, 15 Nov 2015 16:48:50 +0000 (16:48 +0000)]
sparc: reserve more space for new syscalls

Move socket subcalls further down the table to make room
for new syscalls.

* linux/sparc/syscallent.h (SYS_socket_subcall): Raise from 353 to 400.

8 years agom68k: wire up direct socket syscalls
Dmitry V. Levin [Sun, 15 Nov 2015 01:46:51 +0000 (01:46 +0000)]
m68k: wire up direct socket syscalls

Starting with linux commit v4.3-rc3-1-g5b3f33e, m68k has direct
socket syscalls in addition to traditional socketcall syscall.

* linux/m68k/syscallent.h (socket, socketpair, bind, connect, listen,
accept4, getsockopt, setsockopt, getsockname, getpeername, sendto,
sendmsg, recvfrom, recvmsg, shutdown, recvmmsg, sendmmsg): New entries.

8 years agoi386: wire up direct socket syscalls
Dmitry V. Levin [Sun, 15 Nov 2015 01:40:26 +0000 (01:40 +0000)]
i386: wire up direct socket syscalls

Starting with linux commit v4.2-rc1-64-g9dea5dc, x86 has direct
socket syscalls in addition to traditional socketcall syscall.

* linux/i386/syscallent.h (socket, socketpair, bind, connect, listen,
accept4, getsockopt, setsockopt, getsockname, getpeername, sendto,
sendmsg, recvfrom, recvmsg, shutdown): New entries.

8 years agos390, s390x: update syscall tables
Heiko Carstens [Tue, 10 Nov 2015 11:39:41 +0000 (12:39 +0100)]
s390, s390x: update syscall tables

* linux/s390/syscallent.h: Add new syscalls available with kernel 4.3.0.
* linux/s390x/syscallent.h: Likewise.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
8 years agoFix *_printer_defs.h rules ambiguousness
Dmitry V. Levin [Sat, 7 Nov 2015 23:22:24 +0000 (23:22 +0000)]
Fix *_printer_defs.h rules ambiguousness

There is an ambiguousness in *_printer_defs.h rules definition:

$ grep '^[^ ]*_defs\.h: ' Makefile.am
m%_defs.h: $(srcdir_mpers_source_files)
%_printer_defs.h: $(srcdir_mpers_source_files)

While it appears to work with GNU make, it has to be fixed nevertheless.

* Makefile.am (m%_defs.h): Rename to m%_type_defs.h.
(mpers_m32_targets): Rename m32_defs.h to m32_type_defs.h.
(mpers_mx32_targets): Rename mx32_defs.h to mx32_type_defs.h.
* mpers_type.h: Rename m32_defs.h to m32_type_defs.h,
mx32_defs.h to mx32_type_defs.h.
* .gitignore: Likewise.

Reported-by: Elliott Hughes <enh@google.com>
8 years agofcntl.c: make use of RVAL_DECODED
Dmitry V. Levin [Fri, 9 Oct 2015 01:55:46 +0000 (01:55 +0000)]
fcntl.c: make use of RVAL_DECODED

* fcntl.c (SYS_FUNC(fcntl)): Return RVAL_DECODED for write-only operations.

8 years agodesc.c: move parser of fcntl syscall to a separate file
Dmitry V. Levin [Thu, 1 Oct 2015 12:24:01 +0000 (12:24 +0000)]
desc.c: move parser of fcntl syscall to a separate file

* fcntl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (printflock64, printflock, SYS_FUNC(fcntl)): Move to fcntl.c.

8 years agodesc.c: move parser of flock syscall to a separate file
Dmitry V. Levin [Thu, 1 Oct 2015 12:20:11 +0000 (12:20 +0000)]
desc.c: move parser of flock syscall to a separate file

* flock.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (SYS_FUNC(flock)): Move to flock.c.

8 years agotests: fix false uio.test failures
Dmitry V. Levin [Thu, 8 Oct 2015 14:44:15 +0000 (14:44 +0000)]
tests: fix false uio.test failures

* tests/uio.c (main): Use descriptor number 0 in pread/pwrite
and preadv/pwritev syscalls.
* tests/uio.expected: Update regexps.

Reported-by: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
8 years agoFix make -j builds
Gabriel Laskar [Thu, 1 Oct 2015 12:49:25 +0000 (14:49 +0200)]
Fix make -j builds

In files generated by mpers scripts, includes directives are taken from
original files where the type definition was done.  This causes to
include defs.h in multiple files.  defs.h includes printers.h header,
which is a generated header.

This patch add an explicit dependency to printers.h for the mpers
scripts.

* Makefile.am (mpers-m%.stamp): Add printers.h to order-only
prerequisites.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
8 years agompers: fix shell code to conform better to POSIX
Mike Frysinger [Tue, 29 Sep 2015 19:02:35 +0000 (15:02 -0400)]
mpers: fix shell code to conform better to POSIX

The `echo -n` behavior is non-portable, so use printf instead.

* generate_mpers_am.sh: Change `echo -n` to `printf`.

8 years agoioctl: fix ioctl command number decoding in case of conflicts
Gabriel Laskar [Wed, 23 Sep 2015 08:11:55 +0000 (10:11 +0200)]
ioctl: fix ioctl command number decoding in case of conflicts

When a command number was decoded through ioctl_decode_command_number(),
there was no check for conflicts with other potential ioctls numbers.

For example:
ioctl(fd, MCE_GET_RECORD_LEN, &i);
output:
ioctl(3, MIXER_READ(1), 0x7ffddce74a58) = 0
instead of:
ioctl(3, MIXER_READ(1) or MCE_GET_RECORD_LEN, 0x7ffee435ce08) = 0

* ioctl.c (SYS_FUNC(ioctl)): Fix ioctl command number decoding
in case of conflicts.
* tests/ioctl.c (main): Add a case for command number conflicts.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
8 years agotests: convert ioctl.test from match_grep to match_diff
Dmitry V. Levin [Tue, 22 Sep 2015 21:22:37 +0000 (21:22 +0000)]
tests: convert ioctl.test from match_grep to match_diff

* tests/ioctl.c (main): Print expected output.
* tests/ioctl.test: Use match_diff instead of match_grep.
* tests/ioctl.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove ioctl.expected.

8 years agoConvert parser of seccomp filter program to new mpers infrastructure
Dmitry V. Levin [Sat, 19 Sep 2015 21:28:23 +0000 (21:28 +0000)]
Convert parser of seccomp filter program to new mpers infrastructure

* seccomp_fprog.h: New file.
* fetch_seccomp_fprog.c: New file.
* Makefile.am (strace_SOURCES): Add them.
* seccomp.c: Include "seccomp_fprog.h".
(print_seccomp_filter): Use fetch_seccomp_fprog.

8 years agotests/init.sh: enhance match_grep error diagnostics
Dmitry V. Levin [Sat, 19 Sep 2015 00:11:07 +0000 (00:11 +0000)]
tests/init.sh: enhance match_grep error diagnostics

* tests/init.sh (match_grep): Check patterns one by one,
output only those patterns that didn't match.

8 years agotests/init.sh: fix comment
Dmitry V. Levin [Sat, 19 Sep 2015 00:01:35 +0000 (00:01 +0000)]
tests/init.sh: fix comment

* tests/init.sh (match_awk): Fix usage description.

8 years agotests: add one more case to select.test
Dmitry V. Levin [Fri, 18 Sep 2015 21:54:52 +0000 (21:54 +0000)]
tests: add one more case to select.test

* tests/select.c (main): Check how timeout is printed
on exiting syscall.

8 years agotests: uncouple pselect6 from select.test
Dmitry V. Levin [Fri, 18 Sep 2015 21:45:36 +0000 (21:45 +0000)]
tests: uncouple pselect6 from select.test

* tests/select.c Do not include <string.h>.
Include <sys/syscall.h>.
[!__NR_select]: Skip the test.
(main): Remove pselect6 support, test just select syscall.
* tests/select.test: Remove all pselect6 checks, test just
select syscall.

8 years agotests: robustify select test
Dmitry V. Levin [Fri, 18 Sep 2015 21:37:09 +0000 (21:37 +0000)]
tests: robustify select test

* tests/select.c: Do not include <assert.h>.
(main): Skip the test instead of assertions.
Add some padding to the timeval structure.

8 years agotests: add one more case to pselect6.test
Dmitry V. Levin [Fri, 18 Sep 2015 21:20:56 +0000 (21:20 +0000)]
tests: add one more case to pselect6.test

* tests/pselect6.c (main): Check how timeout is printed
on exiting syscall.

8 years agotests: robustify pselect6 test
Dmitry V. Levin [Fri, 18 Sep 2015 21:20:56 +0000 (21:20 +0000)]
tests: robustify pselect6 test

* tests/pselect6.c: Do not include <assert.h> and <string.h>.
Include <sys/syscall.h>.
[!__NR_pselect6]: Skip the test.
(main): Skip the test instead of assertions.
Add some padding to the timespec structure.

8 years agoConvert another parser of struct timeval to new mpers infrastructure
Dmitry V. Levin [Fri, 18 Sep 2015 18:02:50 +0000 (18:02 +0000)]
Convert another parser of struct timeval to new mpers infrastructure

* print_time.c (sprint_timeval): New mpers printer.
[ALPHA] (sprint_timeval32): New function.
* defs.h [ALPHA] (sprint_timeval32): New prototype.
(bitness_t, TIMEVAL_TEXT_BUFSIZE, printtv_bitness, sprinttv): Remove.
* desc.c (decode_select): Replace bitness parameter with two printers.
Use them instead of printtv_bitness and sprinttv.
(sys_oldselect, sys_select): Pass print_timeval and sprint_timeval
to decode_select.
[ALPHA] (sys_osf_select): Pass print_timeval32 and sprint_timeval32
to decode_select.
(pselect6): Pass print_timespec and sprint_timespec to decode_select.
* time.c (UTIME_NOW, UTIME_OMIT, current_time_t_is_compat,
struct timeval32, printtv_bitness, do_sprinttv, sprinttv): Remove.

8 years agoConvert another parser of struct timespec to new mpers infrastructure
Dmitry V. Levin [Fri, 18 Sep 2015 17:44:16 +0000 (17:44 +0000)]
Convert another parser of struct timespec to new mpers infrastructure

* print_time.c (sprint_timespec): New mpers printer.
* defs.h (TIMESPEC_TEXT_BUFSIZE): Update.
(sprint_timespec): Remove.
* time.c (sprint_timespec): Remove.
* net.c (sys_recvmmsg): Update callers.
* poll.c (decode_poll_exiting): Likewise.

8 years agotests: add another case to pselect6 test
Dmitry V. Levin [Fri, 18 Sep 2015 17:05:35 +0000 (17:05 +0000)]
tests: add another case to pselect6 test

* tests/pselect6.c: Include <sys/time.h>.
(handler): New function.
(main): Install an interval timer.
Use it to check how ERESTARTNOHAND is printed.

8 years agoFix decoding of gettimeofday and settimeofday
Dmitry V. Levin [Fri, 18 Sep 2015 16:15:49 +0000 (16:15 +0000)]
Fix decoding of gettimeofday and settimeofday

* time.c (print_timezone): new function.
(sys_gettimeofday, sys_settimeofday): Use it instead of print_timeval
to print struct timezone.
[ALPHA] (sys_osf_gettimeofday, sys_osf_settimeofday): Use it
instead of print_timeval32 to print struct timezone.
* tests/xettimeofday.c: New file.
* tests/xettimeofday.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add xettimeofday.
(TESTS): Add xettimeofday.
* tests/.gitignore: Add xettimeofday.

8 years agoConvert parser of struct timeval to new mpers infrastructure
Dmitry V. Levin [Fri, 18 Sep 2015 15:16:11 +0000 (15:16 +0000)]
Convert parser of struct timeval to new mpers infrastructure

* defs.h (printtv, printtv_special): Remove.
[ALPHA] (print_timeval32, print_timeval32_pair): New prototypes.
* print_time.c (print_timeval): New mpers printer.
[ALPHA] (print_timeval32, print_timeval32_pair): New functions.
* time.c (sys_gettimeofday, sys_settimeofday): Use print_timeval
instead of printtv.
[ALPHA] (sys_osf_gettimeofday, sys_osf_settimeofday):
Use print_timeval32 instead of printtv_bitness.
* utimes.c [ALPHA] (sys_osf_utimes): Use print_timeval32_pair
instead of printtv_bitness.

8 years agoConvert parser of struct timespec to new mpers infrastructure
Dmitry V. Levin [Fri, 18 Sep 2015 15:16:11 +0000 (15:16 +0000)]
Convert parser of struct timespec to new mpers infrastructure

* defs.h (print_timespec): Remove.
* print_time.c (print_timespec): New mpers printer.
* futex.c (sys_futex): Use print_timespec instead of printtv.
* ipc_sem.c (sys_semtimedop): Likewise.
* mq.c (sys_mq_timedsend, sys_mq_timedreceive): Likewise.
* time.c (clock_settime, clock_gettime, clock_nanosleep): Likewise.
(print_timespec): Remove.

8 years agoRemove unused parser of adjtime syscall
Dmitry V. Levin [Fri, 18 Sep 2015 15:47:29 +0000 (15:47 +0000)]
Remove unused parser of adjtime syscall

* time.c (sys_adjtime): Remove.

8 years agoFix decoding of clock_nanosleep
Dmitry V. Levin [Fri, 18 Sep 2015 14:24:51 +0000 (14:24 +0000)]
Fix decoding of clock_nanosleep

* time.c (sys_clock_nanosleep): Use is_erestart,
temporarily_clear_syserror, and restore_cleared_syserror.
* tests/clock_nanosleep.c: New file.
* tests/clock_nanosleep.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add clock_nanosleep.
(TESTS): Add clock_nanosleep.test.
* tests/.gitignore: Add clock_nanosleep.

8 years agoAdd is_erestart helper function
Dmitry V. Levin [Fri, 18 Sep 2015 01:54:59 +0000 (01:54 +0000)]
Add is_erestart helper function

* defs.h (is_erestart): New prototype.
* syscall.c (is_erestart): New function.
* time.c (sys_nanosleep): Use is_erestart,
temporarily_clear_syserror, and restore_cleared_syserror.

8 years agoAdd helper functions to clear/restore syserror
Dmitry V. Levin [Fri, 18 Sep 2015 01:54:59 +0000 (01:54 +0000)]
Add helper functions to clear/restore syserror

* defs.h (temporarily_clear_syserror, restore_cleared_syserror):
New prototypes.
* syscall.c (saved_u_error): New variable.
(temporarily_clear_syserror, restore_cleared_syserror): New functions.
* aio.c (sys_io_getevents): Use temporarily_clear_syserror
and restore_cleared_syserror.
* mq.c (sys_mq_timedreceive): Likewise.
* signal.c (sys_rt_sigtimedwait): Likewise.

8 years agotests: add nanosleep.test
Dmitry V. Levin [Fri, 18 Sep 2015 02:18:03 +0000 (02:18 +0000)]
tests: add nanosleep.test

* tests/nanosleep.c: New file.
* tests/nanosleep.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add nanosleep.
(TESTS): Add nanosleep.test.
* tests/.gitignore: Add nanosleep.

8 years agotests: rewrite restart_syscall in C
Dmitry V. Levin [Fri, 18 Sep 2015 11:27:11 +0000 (11:27 +0000)]
tests: rewrite restart_syscall in C

* tests/restart_syscall.c: New file.
* tests/restart_syscall.expected: Remove.
* tests/restart_syscall_unknown.expected: Remove.
* tests/restart_syscall.test: Update to use restart_syscall.
* tests/Makefile.am (check_PROGRAMS): Add restart_syscall.
(EXTRA_DIST): Remove restart_syscall.expected
and restart_syscall_unknown.expected.
* tests/.gitignore: Add restart_syscall.

8 years agoProperly initialize siginfo_t object passed to print_stopped function
Dmitry V. Levin [Fri, 18 Sep 2015 13:04:02 +0000 (13:04 +0000)]
Properly initialize siginfo_t object passed to print_stopped function

* strace.c (trace): Clear the whole siginfo_t variable before passing it
to ptrace(PTRACE_GETSIGINFO) because the latter may initialize only a
part of the structure.

8 years agotests: add clock_xettime.test
Dmitry V. Levin [Thu, 17 Sep 2015 21:57:22 +0000 (21:57 +0000)]
tests: add clock_xettime.test

* tests/clock_xettime.c: New file.
* tests/clock_xettime.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add clock_xettime.
(TESTS): Add clock_xettime.test.
* tests/.gitignore: Add clock_xettime.

8 years agoConvert parser of struct itimerval to new mpers infrastructure
Dmitry V. Levin [Thu, 17 Sep 2015 20:23:31 +0000 (20:23 +0000)]
Convert parser of struct itimerval to new mpers infrastructure

* defs.h [ALPHA] (print_itimerval32): New prototype.
* print_time.c (print_itimerval): New mpers printer.
[ALPHA] (timeval32_t): New typedef.
[ALPHA] (print_timeval32_t, print_itimerval32): New functions.
* time.c (sys_getitimer, sys_setitimer): Use print_itimerval instead
of printitv.
[ALPHA] (sys_osf_getitimer, sys_osf_setitimer): Use print_itimerval32
instead of printitv_bitness.
(tprint_timeval32, tprint_timeval, printitv_bitness, printitv): Remove.

8 years agotests: add xetitimer.test
Dmitry V. Levin [Thu, 17 Sep 2015 20:44:22 +0000 (20:44 +0000)]
tests: add xetitimer.test

* tests/xetitimer.c: New file.
* tests/xetitimer.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add xetitimer.
(TESTS): Add xetitimer.test.
* tests/.gitignore: Add xetitimer.

8 years agoConvert parser of struct itimerspec to new mpers infrastructure
Dmitry V. Levin [Thu, 17 Sep 2015 16:47:03 +0000 (16:47 +0000)]
Convert parser of struct itimerspec to new mpers infrastructure

* print_time.c (print_itimerspec): New mpers printer.
* time.c (sys_timer_settime, sys_timer_gettime, sys_timerfd,
sys_timerfd_settime, sys_timerfd_gettime): Use it instead of printitv.

8 years agoprint_time.c: introduce print_timespec_t helper
Dmitry V. Levin [Thu, 17 Sep 2015 16:47:03 +0000 (16:47 +0000)]
print_time.c: introduce print_timespec_t helper

* print_time.c (time_fmt): New constant string.
(print_timeval_t): Use it.
(print_timespec_t): New function.
(print_timespec_t_utime): Use it.

8 years agotests: add timerfd_xettime.test
Dmitry V. Levin [Thu, 17 Sep 2015 20:05:20 +0000 (20:05 +0000)]
tests: add timerfd_xettime.test

* tests/timerfd_xettime.c: New file.
* tests/timerfd_xettime.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add timerfd_xettime.
(TESTS): Add timerfd_xettime.test.
* tests/.gitignore: Add timerfd_xettime.

8 years agotests: add timer_xettime.test
Dmitry V. Levin [Thu, 17 Sep 2015 18:25:12 +0000 (18:25 +0000)]
tests: add timer_xettime.test

* tests/timer_xettime.c: New file.
* tests/timer_xettime.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add timer_xettime.
(TESTS): Add timer_xettime.test.
* tests/.gitignore: Add timer_xettime.

8 years agotime.c: move parser of time syscall to print_time.c
Dmitry V. Levin [Thu, 17 Sep 2015 16:10:53 +0000 (16:10 +0000)]
time.c: move parser of time syscall to print_time.c

* time.c (current_time_t_is_int32): Remove.
(sys_time): Move ...
* print_time.c: ... here.  Mpersify time_t.

8 years agoprint_time.c: remove unused function parameters
Dmitry V. Levin [Thu, 17 Sep 2015 15:12:42 +0000 (15:12 +0000)]
print_time.c: remove unused function parameters

* print_time.c (print_timespec_t_utime, print_timeval_t): Remove
"struct tcb *" parameter.
(print_timespec_utime_pair, print_timeval_pair): Update callers.

8 years agoAdd struct timex.tai support
Dmitry V. Levin [Wed, 16 Sep 2015 23:15:55 +0000 (23:15 +0000)]
Add struct timex.tai support

* configure.ac (AC_CHECK_MEMBERS): Add struct timex.tai.
* print_timex.c (print_timex) [HAVE_STRUCT_TIMEX_TAI]: Print tai field.
* tests/adjtimex.c (main) [HAVE_STRUCT_TIMEX_TAI]: Likewise.

8 years agoConvert parser of struct timex to new mpers infrastructure
Dmitry V. Levin [Wed, 16 Sep 2015 21:58:36 +0000 (21:58 +0000)]
Convert parser of struct timex to new mpers infrastructure

* defs.h (adjtimex_modes, adjtimex_status): New xlat prototypes.
* print_timex.c (struct_timex): New typedef.  Mpersify it.
[IN_MPERS]: Do not include "xlat/adjtimex_modes.h"
and "xlat/adjtimex_status.h".
[SUPPORTED_PERSONALITIES > 1]: Remove.
(tprint_timeval): Remove.
(tprint_timex): Rename to print_timex.  Mpersify it.
* time.c (do_adjtimex): Rename tprint_timex to print_timex.
* tests/adjtimex.c: New file.
* tests/adjtimex.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add adjtimex.
(TESTS): Add adjtimex.test.
* tests/.gitignore: Add adjtimex.

8 years agoMove parser of struct timex to a separate file
Dmitry V. Levin [Wed, 16 Sep 2015 21:47:48 +0000 (21:47 +0000)]
Move parser of struct timex to a separate file

* print_timex.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* time.c (tprint_timex32, tprint_timex): Move to print_timex.c.

8 years agoEnhance parser of struct sigevent
Dmitry V. Levin [Wed, 16 Sep 2015 16:31:43 +0000 (16:31 +0000)]
Enhance parser of struct sigevent

* print_sigevent.c (print_sigevent): Always print names
of struct_sigevent fields along with their values.
Print signal name of sigev_signo for those sigev_notify values
that require valid signal numbers.
* tests/timer_create.c: New file.
* tests/timer_create.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add timer_create.
(TESTS): Add timer_create.test.
* tests/.gitignore: Add timer_create.

8 years agoConvert parser of struct sigevent to new mpers infrastructure
Dmitry V. Levin [Wed, 16 Sep 2015 16:31:43 +0000 (16:31 +0000)]
Convert parser of struct sigevent to new mpers infrastructure

* defs.h (sigev_value): New prototype.
(printsigevent): Remove.
* print_sigevent.c (struct_sigevent): New typedef.  Mpersify it.
[IN_MPERS]: Do not include "xlat/sigev_value.h".
(printsigevent32): Remove.
(printsigevent): Rename to print_sigevent.  Mpersify it.
* mq.c (sys_mq_notify): Rename printsigevent to print_sigevent.
* time.c (sys_timer_create): Likewise.

8 years agoMove parser of struct sigevent to a separate file
Dmitry V. Levin [Wed, 16 Sep 2015 18:05:43 +0000 (18:05 +0000)]
Move parser of struct sigevent to a separate file

* print_sigevent.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* time.c (printsigevent32, printsigevent): Move to print_sigevent.c.

8 years agotime.c: move fallback definitions of SIGEV_* values to xlat/
Dmitry V. Levin [Wed, 16 Sep 2015 12:09:52 +0000 (12:09 +0000)]
time.c: move fallback definitions of SIGEV_* values to xlat/

* time.c: Move fallback definitions of SIGEV_* values ...
* xlat/sigev_value.in: ... here.

8 years agoSimplify use of mpers printers
Dmitry V. Levin [Tue, 15 Sep 2015 21:51:15 +0000 (21:51 +0000)]
Simplify use of mpers printers

* native_defs.h: New file.
* syscall.c: Include it.
* mpers_type.h [!IN_MPERS] (MPERS_DEFS): Change to "native_defs.h".
* defs.h (MPERS_PRINTER_NAME): Remove.
[SUPPORTED_PERSONALITIES > 1] (MPERS_PRINTER_NAME, printers): Move ...
* Makefile.am (printers.h): ... here.
Add macro definitions for mpers printers.
(m%_defs.h): Add redefinition of MPERS_PRINTER_NAME and inclusion
of "$(mpers_PREFIX)printer_decls.h".
(strace_SOURCES): Add native_defs.h.
* README-mpers: Update instructions for using mpers printers.
* ipc_msg.c (tprint_msgsnd, tprint_msgrcv): Call tprint_msgbuf directly.
* mq.c (sys_mq_open, mq_getsetattr): Call printmqattr directly.
* process.c (sys_ptrace): Call printsiginfo_at directly.
* signal.c (print_sigqueueinfo, sys_rt_sigtimedwait): Likewise.
* resource.c (sys_getrusage): Call printrusage directly.
* utimes.c (sys_utimensat): Call print_timespec_utime_pair directly.
(sys_utimes, sys_futimesat): Call print_timeval_pair directly.
* wait.c (printwaitn): Call printrusage directly.
(sys_waitid): Call printrusage and printsiginfo_at directly.

8 years agoAdd a new helper function umove_ulong_array_or_printaddr
Dmitry V. Levin [Tue, 15 Sep 2015 02:17:32 +0000 (02:17 +0000)]
Add a new helper function umove_ulong_array_or_printaddr

* defs.h (umove_ulong_array_or_printaddr): New prototype.
* util.c (umove_ulong_array_or_printaddr): New function.
* desc.c (sys_pselect6): Use it instead of open-coding
a proxy struct parser for different personalities.
* io.c (tprint_iov_upto): Use it instead of open-coding
a struct iovec parser for different personalities.
* kexec.c (print_kexec_segments): Use it instead of open-coding
a struct kexec_segment parser for different personalities.
(print_seg): Pass arguments using an array.

8 years agotests: add pselect6.test
Dmitry V. Levin [Tue, 15 Sep 2015 02:14:38 +0000 (02:14 +0000)]
tests: add pselect6.test

* tests/pselect6.c: New file.
* tests/pselect6.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add pselect6.
(TESTS): Add pselect6.test.
* tests/.gitignore: Add pselect6.

8 years agoRename umove_long_or_printaddr to umove_ulong_or_printaddr
Dmitry V. Levin [Mon, 14 Sep 2015 23:02:29 +0000 (23:02 +0000)]
Rename umove_long_or_printaddr to umove_ulong_or_printaddr

Rename the recently added function to reflect what kind of data type
it actually deals with: unsigned long int, without sign extension.

* defs.h (umove_long_or_printaddr): Rename to umove_ulong_or_printaddr,
chage 3rd argument to unsigned long *.
* util.c (umove_long_or_printaddr): Likewise.
* aio.c (sys_io_submit): Update callers.

8 years agoaarch64, ppc64, sparc64, tile: hook up mpers printers
Dmitry V. Levin [Mon, 14 Sep 2015 22:33:23 +0000 (22:33 +0000)]
aarch64, ppc64, sparc64, tile: hook up mpers printers

* defs.h [AARCH64 && HAVE_M32_MPERS]: Define PERSONALITY0_INCLUDE_FUNCS,
PERSONALITY0_INCLUDE_PRINTERS_DECLS,
and PERSONALITY0_INCLUDE_PRINTERS_DEFS.
[POWERPC64 && HAVE_M32_MPERS]: Define PERSONALITY1_INCLUDE_FUNCS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS,
and PERSONALITY1_INCLUDE_PRINTERS_DEFS.
[SPARC64 && HAVE_M32_MPERS]: Likewise.
[TILE && HAVE_M32_MPERS]: Likewise.

8 years agoAdd PowerPC specific ptrace constants
Anton Blanchard [Tue, 1 Sep 2015 21:55:37 +0000 (07:55 +1000)]
Add PowerPC specific ptrace constants

* xlat/ptrace_cmds.in: Add PowerPC specific ptrace constants.

8 years agoUpdate SCTP_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 17:24:09 +0000 (17:24 +0000)]
Update SCTP_* constants

* xlat/socksctpoptions.in: Add SCTP_GET_ASSOC_ID_LIST, SCTP_AUTO_ASCONF,
SCTP_PEER_ADDR_THLDS, SCTP_RECVRCVINFO, SCTP_RECVNXTINFO,
SCTP_DEFAULT_SNDINFO, SCTP_SOCKOPT_CONNECTX, SCTP_SOCKOPT_CONNECTX3,
and SCTP_GET_ASSOC_STATS.

8 years agoUpdate F_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 17:21:10 +0000 (17:21 +0000)]
Update F_* constants

* xlat/fcntlcmds.in: Add F_SETPIPE_SZ, F_GETPIPE_SZ, F_ADD_SEALS,
and F_GET_SEALS.

8 years agoUpdate RENAME_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 17:16:32 +0000 (17:16 +0000)]
Update RENAME_* constants

* xlat/rename_flags.in: Add RENAME_WHITEOUT.

8 years agoUpdate SO_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 17:04:22 +0000 (17:04 +0000)]
Update SO_* constants

* xlat/sockoptions.in: Add SO_ATTACH_BPF, SO_BPF_EXTENSIONS,
SO_BUSY_POLL, SO_DETACH_BPF, SO_GET_FILTER, SO_INCOMING_CPU,
SO_LOCK_FILTER, SO_MAX_PACING_RATE, SO_PEEK_OFF, SO_RXQ_OVFL,
SO_SELECT_ERR_QUEUE, and SO_WIFI_STATUS.

8 years agoUpdate INPUT_PROP_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 16:20:25 +0000 (16:20 +0000)]
Update INPUT_PROP_* constants

* xlat/evdev_prop.in: Add INPUT_PROP_ACCELEROMETER.

8 years agoUpdate KEY_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 16:19:25 +0000 (16:19 +0000)]
Update KEY_* constants

* xlat/evdev_keycode.in: Add KEY_ROTATE_DISPLAY, KEY_NUMERIC_A,
KEY_NUMERIC_B, KEY_NUMERIC_C, and KEY_NUMERIC_D.

8 years agoUpdate FALLOC_FL_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 16:04:17 +0000 (16:04 +0000)]
Update FALLOC_FL_* constants

* xlat/falloc_flags.in: Add FALLOC_FL_INSERT_RANGE.

8 years agoUpdate AF_* and PF_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 16:00:39 +0000 (16:00 +0000)]
Update AF_* and PF_* constants

* xlat/addrfams.in: Add AF_IB and AF_MPLS.
* xlat/domains.in: Add PF_IB and PF_MPLS.

8 years agoUpdate TCP_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 15:50:44 +0000 (15:50 +0000)]
Update TCP_* constants

* xlat/socktcpoptions.in: Add TCP_NOTSENT_LOWAT, TCP_CC_INFO,
TCP_SAVE_SYN, and TCP_SAVED_SYN.

8 years agoUpdate PACKET_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 15:46:47 +0000 (15:46 +0000)]
Update PACKET_* constants

* xlat/sockpacketoptions.in: Add PACKET_VNET_HDR, PACKET_TX_TIMESTAMP,
PACKET_TIMESTAMP, PACKET_FANOUT, PACKET_TX_HAS_OFF, PACKET_QDISC_BYPASS,
PACKET_ROLLOVER_STATS, and PACKET_FANOUT_DATA.

8 years agoUpdate BPF_MAP_TYPE_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 15:40:17 +0000 (15:40 +0000)]
Update BPF_MAP_TYPE_* constants

* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_PERF_EVENT_ARRAY.

8 years agoUpdate IPPROTO_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 15:29:41 +0000 (15:29 +0000)]
Update IPPROTO_* constants

* xlat/inet_protocols.in: Add IPPROTO_MPLS.

8 years agoUpdate IP_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 15:01:02 +0000 (15:01 +0000)]
Update IP_* constants

* xlat/sockipoptions.in: Add IP_CHECKSUM and IP_BIND_ADDRESS_NO_PORT.

8 years agoUpdate PTRACE_O_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 14:42:28 +0000 (14:42 +0000)]
Update PTRACE_O_* constants

* ptrace.h: Define PTRACE_O_SUSPEND_SECCOMP.
* xlat/ptrace_setoptions_flags.in: Add it.

9 years agoUpdate PR_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 13:25:24 +0000 (13:25 +0000)]
Update PR_* constants

* xlat/prctl_options.in: Add PR_SET_FP_MODE, PR_GET_FP_MODE,
and PR_CAP_AMBIENT.

9 years agoUpdate SECBIT_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 13:21:01 +0000 (13:21 +0000)]
Update SECBIT_* constants

* xlat/secbits.in: Add SECBIT_NO_CAP_AMBIENT_RAISE
and SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED.

9 years agompers.m4: workaround missing gnu/stubs-*.h files
Dmitry V. Levin [Thu, 27 Aug 2015 19:51:05 +0000 (19:51 +0000)]
mpers.m4: workaround missing gnu/stubs-*.h files

On some systems missing gnu/stubs-*.h files make -m32/-mx32 compilation
checks fail.  As we want to support multiple personalities despite of
this limitation, workaround the check by creating empty gnu stub files
if necessary.

* m4/mpers.m4 (st_MPERS): Check for the gnu stub file.  Create an empty
gnu stub file if the system one is missing.
* Makefile.am (DISTCLEANFILES): Add gnu/stubs-32.h and gnu/stubs-x32.h.

9 years agotests: add times-fail.test
Elvira Khabirova [Thu, 20 Aug 2015 21:09:32 +0000 (00:09 +0300)]
tests: add times-fail.test

* tests/times-fail.c: New file.
* tests/times-fail.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add times-fail.
(TESTS): Add times-fail.test.
* tests/.gitignore: Add times-fail.

9 years agotests: add times.test
Eugene Syromyatnikov [Tue, 4 Aug 2015 12:52:55 +0000 (15:52 +0300)]
tests: add times.test

* tests/times.c: New file.
* tests/times.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add times.
(TESTS): Add times.test.
(times_LDADD): Define.
* tests/.gitignore: Add times.

9 years agoMpersify parser of times syscall
Elvira Khabirova [Mon, 3 Aug 2015 04:26:53 +0000 (07:26 +0300)]
Mpersify parser of times syscall

Fix multiple personalities support in parser of times syscall by
mpersifying struct tms.

* times.c (tms_t): New typedef.  Mpersify it.
(sys_times): Use it instead of struct tms.

9 years agotests: add sysinfo.test
Elvira Khabirova [Mon, 3 Aug 2015 03:30:49 +0000 (06:30 +0300)]
tests: add sysinfo.test

* tests/sysinfo.c: New file.
* tests/sysinfo.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add sysinfo.
(TESTS): Add sysinfo.test.
* tests/.gitignore: Add sysinfo.

9 years agoMpersify parser of sysinfo syscall
Elvira Khabirova [Mon, 3 Aug 2015 03:27:48 +0000 (06:27 +0300)]
Mpersify parser of sysinfo syscall

Fix multiple personalities support in parser of sysinfo syscall by
mpersifying struct sysinfo.

* sysinfo.c (sysinfo_t): New typedef.  Mpersify it.
(sys_sysinfo): Use it instead of struct sysinfo.

9 years agoEnhance msgctl syscall decoding
Elvira Khabirova [Mon, 17 Aug 2015 23:01:26 +0000 (02:01 +0300)]
Enhance msgctl syscall decoding

Make parser of msgctl syscall print struct msqid_ds.

* ipc_msgctl.c (msqid_ds_t): New typedef.  Mpersify it.
(print_msqid_ds): New function.  Use msqid_ds_t.
(sys_msgctl): Use print_msqid_ds.
* tests/ipc_msg.c: Update for struct msqid_ds support.

9 years agoEnhance shmctl syscall decoding
Elvira Khabirova [Fri, 31 Jul 2015 15:43:21 +0000 (18:43 +0300)]
Enhance shmctl syscall decoding

Make parser of shmctl syscall print struct shmid_ds.

* ipc_shmctl.c (shmid_ds_t): New typedef.  Mpersify it.
(print_shmid_ds): New function.  Use shmid_ds_t.
(sys_shmctl): Use print_shmid_ds.
* tests/ipc_shm.c: Update for struct shmid_ds support.

9 years agotests: add ipc_msgbuf.test
Elvira Khabirova [Mon, 3 Aug 2015 09:40:46 +0000 (12:40 +0300)]
tests: add ipc_msgbuf.test

* tests/ipc_msgbuf.c: New file.
* tests/ipc_msgbuf.expected: Likewise.
* tests/ipc_msgbuf.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add ipc_msgbuf.
(TESTS): Add ipc_msgbuf.test.
(EXTRA_DIST): Add ipc_msgbuf.expected.
* tests/.gitignore: Add ipc_msgbuf.

9 years agoMpersify tprint_msgsnd and tprint_msgrcv
Elvira Khabirova [Wed, 19 Aug 2015 02:33:34 +0000 (05:33 +0300)]
Mpersify tprint_msgsnd and tprint_msgrcv

Fix multiple personalities support in tprint_msgsnd and tprint_msgrcv
by converting tprint_msgbuf into a mpersified printer.

* print_msgbuf.c (msgbuf_t): New typedef.  Mpersify it.
(tprint_msgbuf): Use it instead of long.
Wrap function name into MPERS_PRINTER_DECL.
* ipc_msg.c (tprint_msgsnd, tprint_msgrcv): Use mpersified
tprint_msgbuf.

9 years agotests: add mq.test
Elvira Khabirova [Wed, 19 Aug 2015 02:28:48 +0000 (05:28 +0300)]
tests: add mq.test

* tests/mq.c: New file.
* tests/mq.expected: Likewise.
* tests/mq.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add mq.
(TESTS): Add mq.test.
(EXTRA_DIST): Add mq.expected.
(mq_LDADD): Add -lrt.
* tests/.gitignore: Add mq.

9 years agoMpersify parsers of mq_open and mq_getsetattr syscalls
Elvira Khabirova [Thu, 20 Aug 2015 18:15:41 +0000 (21:15 +0300)]
Mpersify parsers of mq_open and mq_getsetattr syscalls

Fix multiple personalities support in parsers of mq_open and
mq_getsetattr by converting printmqattr into a mpersified printer.

* print_mq_attr.c (mq_attr_t): New typedef.  Mpersify it.
(printmqattr): Use it instead of struct mq_attr.  Wrap function name
into MPERS_PRINTER_DECL.
* mq.c (mq_open, mq_getsetattr): Use mpersified printmqattr.

9 years agotests: add wait.test
Dmitry V. Levin [Wed, 15 Jul 2015 01:50:27 +0000 (01:50 +0000)]
tests: add wait.test

* tests/wait.c: New file.
* tests/wait.expected: Likewise.
* tests/wait.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add wait.
(TESTS): Add wait.test.
(EXTRA_DIST): Add wait.expected.
* tests/.gitignore: Add wait.

9 years agoMpersify parsers of getrusage, waitpid, wait4, and waitid syscalls
Dmitry V. Levin [Sat, 18 Jul 2015 00:19:50 +0000 (00:19 +0000)]
Mpersify parsers of getrusage, waitpid, wait4, and waitid syscalls

Fix multiple personalities support in parsers of getrusage, waitpid,
wait4, and waitid syscalls by converting printrusage into a mpersified
printer.

* defs.h (printrusage): Remove.
* printrusage.c (rusage_t): New typedef.  Mpersify it.
(printrusage): Use it instead of struct rusage.
Wrap function name into MPERS_PRINTER_DECL.
* resource.c (sys_getrusage): Use mpersified printrusage.
* wait.c (printwaitn, sys_waitid): Likewise.

9 years agotests: add rt_sigqueueinfo.test
Elvira Khabirova [Fri, 21 Aug 2015 15:49:14 +0000 (18:49 +0300)]
tests: add rt_sigqueueinfo.test

* tests/rt_sigqueueinfo.c: New file.
* tests/rt_sigqueueinfo.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add rt_sigqueueinfo.
(TESTS): Add rt_sigqueueinfo.test.
* tests/.gitignore: Add rt_sigqueueinfo.

9 years agoMpersify printsiginfo_at printer
Elvira Khabirova [Mon, 3 Aug 2015 23:16:40 +0000 (02:16 +0300)]
Mpersify printsiginfo_at printer

Fix multiple personalities support in parsers of ptrace,
rt_sigqueueinfo, rt_tgsigqueueinfo, rt_sigtimedwait and waitid syscalls
by converting printsiginfo_at into a mpersified printer.

* printsiginfo.c (siginfo_t): Mpersify.
(printsiginfo_at): Wrap function name into MPERS_PRINTER_DECL.
* defs.h (printsiginfo_at): Remove.
* signal.c (print_sigqueueinfo, sys_rt_sigtimedwait): Use mpersified
printsiginfo_at.
* process.c (sys_ptrace): Likewise.
* wait.c (sys_waitid): Likewise.

9 years agoMpersify parser of sigaltstack syscall
Elvira Khabirova [Mon, 3 Aug 2015 23:16:29 +0000 (02:16 +0300)]
Mpersify parser of sigaltstack syscall

Fix multiple personalities support in parser of sigaltstack syscall by
mpersifying stack_t typedef.

* sigaltstack.c (stack_t): Mpersify.
(print_stack_t): Use it.

9 years agoMpersify parser of utime syscall
Elvira Khabirova [Mon, 3 Aug 2015 23:16:20 +0000 (02:16 +0300)]
Mpersify parser of utime syscall

Fix multiple personalities support in parser of utime syscall by using
mpersified utimbuf_t typedef.

* utime.c (utimbuf_t): New typedef.  Mpersify it.
(sys_utime): Use it instead of a locally defined union.

9 years agotests: add utimensat.test
Dmitry V. Levin [Wed, 15 Jul 2015 15:34:59 +0000 (15:34 +0000)]
tests: add utimensat.test

* tests/utimensat.c: New file.
* tests/utimensat.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add utimensat.
(TESTS): Add utimensat.test.
* configure.ac (AC_CHECK_FUNCS): Add utimensat.
* tests/.gitignore: Add utimensat.

9 years agoMpersify parsers of utimes, futimesat, and utimensat syscalls
Dmitry V. Levin [Mon, 3 Aug 2015 22:52:40 +0000 (01:52 +0300)]
Mpersify parsers of utimes, futimesat, and utimensat syscalls

Fix multiple personalities support in parsers of utimes, futimesat,
and utimensat syscalls by introducing two mpersified printers:
print_timeval_pair and print_timespec_utime_pair.

* print_time.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* utimes.c (decode_utimes): Remove.
(sys_utimes, sys_futimesat): Use print_timeval_pair instead
of decode_utimes.
(sys_utimensat): Use print_timespec_utime_pair instead of decode_utimes.

9 years agoAdd mpers support
Elvira Khabirova [Mon, 3 Aug 2015 22:47:02 +0000 (01:47 +0300)]
Add mpers support

Add a subsystem for semi-automatical definition of how parsers should
work with personality-dependent (mpers) types of tracee's data.  Create
auxiliary libraries containing mpers syscall parsers and printer
functions, one library for each possible nonnative target personality.

Currently some parsers do not handle differences in definitions of data
types between personalities, namely LP64 and ILP32.  When
this is the case, long integers, pointers, and all compound
types containing long and pointer members may be printed incorrectly,
because of differences in sizes, offsets and alignments.

Since in most cases these are the only differences in desired behaviour
of parsers and printers for different personalities, a correct way
would be to compile one source code into multiple parsers, differing
only in definitions of mpers types.

To get a definition of a given type for nonnative personality
a very basic .c file containing a declaration of a variable of this type
is being compiled for this personality (using -m32 or -mx32 compiler
flag).  Information about the type is then being extracted from
this binary's DWARF debug info with an awk script and put
into a corresponding header file.  Resulting headers are being used to
compile mpers variations of syscall parsers and printer functions.

In addition to syscall parsers, there can occur a need to create mpers
printing functions, which then can be called from many places
in the code (for example, printsiginfo_at).  Such functions (printers)
are marked in a special manner.

For each possible nonnative target personality a library is being
created, containing mpers variations of syscall parsers and printers.
Only syscall parsers from files marked in a special manner and specially
marked functions from such files are being recompiled and included
in these libraries.

generate_mpers_am.sh is called by bootstrap to find the files
from strace_SOURCES which include MPERS_DEFS.  During compilation,
these files are being inspected for inclusions of DEF_MPERS_TYPE,
and nonnative variations of each included type are being generated
by an awk script.

Mpers parser names are being modified during inclusions of syscallent
headers for nonnative personalities.  Pointers to printers are
being stored in structs struct_printers, and a master
pointer printers is being updated on every set_personality.

* README-mpers: New README explaining how to use mpers support.
* empty.h: New empty file.
* generate_mpers_am.sh: New file.
* mpers.awk: Likewise.
* mpers.sh: Likewise.
* mpers_test.sh: Likewise.
* mpers_type.h: Likewise.
* Makefile.am (strace_SOURCES): Add empty.h and mpers_type.h.
(strace_CPPFLAGS, strace_LDFLAGS, strace_LDADD): Move to the beginning
of the file.
(strace_LDADD, noinst_LIBRARIES): Add libmpers-%.a.
(EXTRA_DIST): Add mpers.awk, mpers.sh, mpers_test.sh.
(BUILT_SOURCES, CLEANFILES): Add new generated files:
native_printer_decls.h, native_printer_defs.h, printers.h,
[HAVE_M32_MPERS] $(mpers_m32_targets), and [HAVE_MX32_MPERS]
$(mpers_mx32_targets).
(mpers_NAME, mpers_PREFIX, mpers_DEFS, mpers_INCLUDES, mpers_CPPFLAGS,
mpers_sh_opts, libmpers_CPPFLAGS, libmpers_m[x]32_a_SOURCES,
libmpers_m[x]32_a_CPPFLAGS, mpers_m[x]32_targets): New variables.
(mpers-m[x]32.stamp, m[x]32_defs.h, m[x]32_funcs.h, printers.h,
%_printer_decls.h, %_printer_defs.h, clean-local,
native_printer_decls.h, native_printer_defs.h, $mpers_m[x]32_targets):
New targets.
* bootstrap: Add generate_mpers_am.sh.
* configure.ac: Add AC_PROG_RANLIB.
* m4/mpers.m4: Add HAVE_MPERS variable.  Add $st_cv_mpers checks.
* defs.h: Include mpers_type.h.
Include printers.h, native_printer_decls.h, define MPERS_PRINTER_NAME.
Redefine SYS_FUNC_NAME.  Define MPERS_PRINTER_DECL.
[HAVE_M32_MPERS]: define PERSONALITY1_INCLUDE_FUNCS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS
for X86_64, X32.
[HAVE_MX32_MPERS]: define PERSONALITY2_INCLUDE_FUNCS,
PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS
for X86_64.
Add fallback definitions of
PERSONALITY1_INCLUDE_FUNCS, PERSONALITY2_INCLUDE_FUNCS,
PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS,
PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS.
* syscall.c: Include PERSONALITY1_INCLUDE_FUNCS,
PERSONALITY2_INCLUDE_FUNCS,
PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS,
PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS.
(printers): New struct.  Update it when needed.
* .gitignore: Add libmpers-m32.a, libmpers-mx32.a, m32_defs.h,
m32_funcs.h, m32_printer_decls.h, m32_printer_defs.h, mpers-m32,
mpers-m32.stamp, mpers-mx32, mpers-mx32.stamp, mpers.am, mx32_defs.h,
mx32_funcs.h, mx32_printer_decls.h, mx32_printer_defs.h,
native_printer_decls.h, native_printer_defs.h, and printers.h.

9 years agotests: convert readlink.test and readlinkat.test from match_awk to match_diff
Dmitry V. Levin [Fri, 28 Aug 2015 08:43:57 +0000 (08:43 +0000)]
tests: convert readlink.test and readlinkat.test from match_awk to match_diff

* tests/readlink.c (main): Print expected output.
* tests/readlinkat.c (main): Likewise.
* tests/readlink.test: Use match_diff instead of match_awk.
* tests/readlinkat.test: Likewise.
* tests/readlink.awk: Remove.
* tests/readlinkat.awk: Likewise.
* tests/Makefile.am (EXTRA_DIST): Remove readlink.awk and readlinkat.awk.