Commit Graph

96 Commits

Author SHA1 Message Date
92e347b556 Add copyright headers to some files that lack them
We do our best to keep copyright headers up to date, yet
git history provides better information on this subject
and is more accurate than copyright headers.
2018-12-24 23:46:43 +00:00
b93d52fe3d Change the license of strace to LGPL-2.1-or-later
strace is now provided under the terms of the GNU Lesser General
Public License version 2.1 or later, see COPYING for more details.

strace test suite is now provided under the terms of the GNU General
Public License version 2 or later, see tests/COPYING for more details.
2018-12-10 00:00:00 +00:00
51d89ef0a0 Refactor get_syscall_args() and get_error()
* linux/*/get_error.c: Rename all arch-specific implementations
of get_error() to arch_get_error().
* linux/*/get_syscall_args.c: Rename all arch-specific implementations
of get_syscall_args() to arch_get_syscall_args().
* syscall.c (get_syscall_args, get_error): New functions.
(tamper_with_syscall_exiting, get_syscall_result): Do not clear
tcp->u_error before get_error() invocation as the latter does it now.
2018-12-05 16:10:05 +00:00
917c2ccf3a Refactor stack pointers
Change all linux/*/arch_regs.c to provide either ARCH_SP_REG
or ARCH_SP_PEEK_ADDR.  Introduce get_stack_pointer(), rewrite
all code accessing stack pointers to use get_stack_pointer().
On some architectures stack pointers were referred to as frame pointers,
clean up this confusion.

* defs.h (get_stack_pointer): New prototype.
* syscall.c (get_stack_pointer): New function.
* linux/arch_rt_sigframe.c: New file.
* linux/aarch64/arch_regs.c (aarch64_sp_ptr, arm_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/alpha/arch_regs.c: Import linux/alpha/arch_regs.h.
(REG_FP): Rename to REG_SP.
(ARCH_SP_PEEK_ADDR): New macro.
* linux/alpha/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
* linux/arc/arch_regs.c (arc_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/arm/arch_regs.c (arm_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/arm/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
* linux/avr32/arch_regs.c (avr32_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/bfin/arch_regs.c (ARCH_SP_PEEK_ADDR): New macro.
* linux/hppa/arch_regs.c: Import linux/hppa/arch_regs.h.
(PT_GR30, ARCH_SP_PEEK_ADDR): New macros.
* linux/hppa/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
get_stack_pointer.
* linux/i386/arch_regs.c (i386_esp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/i386/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
get_stack_pointer.
* linux/i386/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/ia64/arch_regs.c (ia64_frame_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/ia64/arch_regs.h (ia64_frame_ptr): Remove.
* linux/ia64/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
get_stack_pointer.
* linux/m68k/arch_regs.c (m68k_usp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/m68k/arch_rt_sigframe.c: Link to i386/arch_rt_sigframe.c.
* linux/m68k/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
* linux/metag/arch_regs.c (metag_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/metag/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
get_stack_pointer.
* linux/microblaze/arch_regs.c (ARCH_SP_PEEK_ADDR): New macro.
* linux/mips/arch_regs.c: Import linux/mips/arch_regs.h.
(mips_regs): Add static qualifier.
(ARCH_SP_REG): New macro.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
* linux/nios2/arch_regs.c (nios2_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/or1k/arch_regs.c (or1k_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/powerpc/arch_regs.c (ppc_regs): Add static qualifier.
(ARCH_SP_REG): New macro.
* linux/powerpc/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
get_stack_pointer.
* linux/powerpc/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
* linux/powerpc64/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
get_stack_pointer.
* linux/riscv/arch_regs.c (riscv_sp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/s390/arch_regs.c (s390_frame_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/s390/arch_sigreturn.c (S390_FRAME_PTR): Remove.
(arch_sigreturn): Use get_stack_pointer.
* linux/s390x/arch_regs.c (s390_frame_ptr, s390x_frame_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/s390x/arch_sigreturn.c (S390_FRAME_PTR): Remove.
* linux/sh/arch_regs.c (ARCH_SP_PEEK_ADDR): New macro.
* linux/sh64/arch_regs.c: Likewise.
* linux/sparc/arch_regs.c: Import linux/sparc/arch_regs.h.
(sparc_regs): Add static qualifier.
(ARCH_SP_REG): New macro.
* linux/sparc/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
* linux/sparc64/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
get_stack_pointer.
* linux/tile/arch_regs.c (tile_regs): Add static qualifier.
(ARCH_SP_REG): New macro.
* linux/tile/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
* linux/x86_64/arch_regs.c (i386_esp_ptr, x86_64_rsp_ptr): Remove.
(ARCH_SP_REG): New macro.
* linux/x86_64/arch_regs.h (i386_esp_ptr, x86_64_rsp_ptr): Remove.
* linux/x86_64/arch_rt_sigframe.c: Link to i386/arch_rt_sigframe.c.
* linux/xtensa/arch_regs.c (ARCH_SP_PEEK_ADDR): New macro.
* linux/aarch64/arch_regs.h: Remove.
* linux/aarch64/arch_rt_sigframe.c: Remove.
* linux/alpha/arch_regs.h: Remove.
* linux/alpha/arch_rt_sigframe.c: Remove.
* linux/arc/arch_regs.h: Remove.
* linux/arc/arch_rt_sigframe.c: Remove.
* linux/arm/arch_regs.h: Remove.
* linux/arm/arch_rt_sigframe.c: Remove.
* linux/avr32/arch_regs.h: Remove.
* linux/avr32/arch_rt_sigframe.c: Remove.
* linux/bfin/arch_rt_sigframe.c: Remove.
* linux/hppa/arch_regs.h: Remove.
* linux/i386/arch_regs.h: Remove.
* linux/m68k/arch_regs.h: Remove.
* linux/metag/arch_regs.h: Remove.
* linux/microblaze/arch_rt_sigframe.c: Remove.
* linux/mips/arch_regs.h: Remove.
* linux/mips/arch_rt_sigframe.c: Remove.
* linux/nios2/arch_regs.h: Remove.
* linux/nios2/arch_rt_sigframe.c: Remove.
* linux/or1k/arch_regs.h: Remove.
* linux/or1k/arch_rt_sigframe.c: Remove.
* linux/powerpc/arch_regs.h: Remove.
* linux/powerpc64/arch_regs.h: Remove.
* linux/riscv/arch_regs.h: Remove.
* linux/riscv/arch_rt_sigframe.c: Remove.
* linux/s390/arch_regs.h: Remove.
* linux/s390/arch_rt_sigframe.c: Remove.
* linux/s390x/arch_regs.h: Remove.
* linux/s390x/arch_rt_sigframe.c: Remove.
* linux/sh/arch_rt_sigframe.c: Remove.
* linux/sh64/arch_rt_sigframe.c: Remove.
* linux/sparc/arch_regs.h: Remove.
* linux/sparc/arch_rt_sigframe.c: Remove.
* linux/sparc64/arch_regs.h: Remove.
* linux/tile/arch_regs.h: Remove.
* linux/tile/arch_rt_sigframe.c: Remove.
* linux/xtensa/arch_rt_sigframe.c: Remove.
* Makefile.am (EXTRA_DIST): Remove them, add linux/arch_rt_sigframe.c.
2018-12-05 16:10:05 +00:00
dcfb3c0d47 Introduce raw syscall invocation wrappers
Unfortunately, syscall(3) provided by libc is too smart
for some of our needs.

* linux/raw_syscall.h: New file.
* linux/aarch64/raw_syscall.h: Likewise.
* linux/alpha/raw_syscall.h: Likewise.
* linux/arc/raw_syscall.h: Likewise.
* linux/arm/raw_syscall.h: Likewise.
* linux/avr32/raw_syscall.h: Likewise.
* linux/bfin/raw_syscall.h: Likewise.
* linux/hppa/raw_syscall.h: Likewise.
* linux/i386/raw_syscall.h: Likewise.
* linux/ia64/raw_syscall.h: Likewise.
* linux/m68k/raw_syscall.h: Likewise.
* linux/metag/raw_syscall.h: Likewise.
* linux/microblaze/raw_syscall.h: Likewise.
* linux/mips/raw_syscall.h: Likewise.
* linux/nios2/raw_syscall.h: Likewise.
* linux/or1k/raw_syscall.h: Likewise.
* linux/powerpc/raw_syscall.h: Likewise.
* linux/powerpc64/raw_syscall.h: Likewise.
* linux/riscv/raw_syscall.h: Likewise.
* linux/s390/raw_syscall.h: Likewise.
* linux/s390x/raw_syscall.h: Likewise.
* linux/sh/raw_syscall.h: Likewise.
* linux/sh64/raw_syscall.h: Likewise.
* linux/sparc/raw_syscall.h: Likewise.
* linux/sparc64/raw_syscall.h: Likewise.
* linux/tile/raw_syscall.h: Likewise.
* linux/x32/raw_syscall.h: Likewise.
* linux/x86_64/raw_syscall.h: Likewise.
* linux/xtensa/raw_syscall.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
2018-03-23 13:43:13 +00:00
daaf8ab7fe Update copyright headers
Headers updated automatically using maint/update_copyright_years.sh
script.
2018-02-13 22:00:00 +00:00
Eugene Syromyatnikov
eb45473d7f Add pure syscall flag
* basic_filters.c (lookup_class) <syscall_class>: Add "%pure" for
TRACE_PURE.
* sysent.h (TRACE_PURE): New syscall flag.
* sysent_shorthand_defs.h (PU): New shorthand macro.
* linux/32/syscallent.h ([172], [173], [174], [175], [176], [177],
[178]): Add PU flag to getpid, getppid, getuid, geteuid, getgid,
getegid, gettid syscalls.
* linux/64/syscallent.h ([172], [173], [174], [175], [176], [177],
[178]): Add PU flag to getpid, getppid, getuid, geteuid, getgid,
getegid, gettid syscalls.
* linux/aarch64/syscallent.h ([1060]): Add PU flag to getpgrp syscalls.
* linux/alpha/syscallent.h ([20], [24], [47], [63], [64], [89],
[378]): Add PU flag to getxpid, getxuid, getxgid, getpgrp, getpagesize,
getdtablesize, gettid syscalls.
* linux/arc/syscallent.h ([246]): Add PU flag to arc_gettls syscalls.
* linux/arm/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[199], [200], [201], [202], [224], [ARM_FIRST_SHUFFLED_SYSCALL+1+6]):
Add PU flag to getpid, getuid, getgid, geteuid, getegid, getppid,
getpgrp, getuid32, getgid32, geteuid32, getegid32, gettid, get_tls
syscalls.
* linux/avr32/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[176]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
getppid, getpgrp, gettid syscalls.
* linux/bfin/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[199], [200], [201], [202], [224]): Add PU flag to getpid, getuid,
getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
geteuid32, getegid32, gettid syscalls.
* linux/hppa/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[206]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
getppid, getpgrp, gettid syscalls.
* linux/i386/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[199], [200], [201], [202], [224]): Add PU flag to getpid, getuid,
getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
geteuid32, getegid32, gettid syscalls.
* linux/ia64/syscallent.h ([1041], [1042], [1046], [1047], [1062],
[1063], [1105], [1171]): Add PU flag to getpid, getppid, getuid,
geteuid, getgid, getegid, gettid, getpagesize syscalls.
* linux/m68k/syscallent.h ([20], [24], [47], [49], [50], [64],
[65], [166], [199], [200], [201], [202], [221], [333]): Add PU flag
to getpid, getuid, getgid, geteuid, getegid, getppid, getpgrp,
getpagesize, getuid32, getgid32, geteuid32, getegid32, gettid,
get_thread_area syscalls.
* linux/metag/syscallent.h ([248]): Add PU flag to metag_get_tls
syscalls.
* linux/microblaze/syscallent.h ([20], [24], [47], [49], [50], [64],
[65], [199], [200], [201], [202], [224]): Add PU flag to getpid,
getuid, getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
geteuid32, getegid32, gettid syscalls.
* linux/powerpc64/syscallent.h ([20], [24], [47], [49], [50], [64],
[65], [207]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
getppid, getpgrp, gettid syscalls.
* linux/powerpc/syscallent.h ([20], [24], [47], [49], [50], [64],
[65], [207]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
getppid, getpgrp, gettid syscalls.
* linux/s390/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[199], [200], [201], [202], [236]): Add PU flag to getpid, getuid,
getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
geteuid32, getegid32, gettid syscalls.
* linux/s390x/syscallent.h ([20], [64], [65], [199], [200], [201],
[202], [236]): Add PU flag to getpid, getppid, getpgrp, getuid,
getgid, geteuid, getegid, gettid syscalls.
* linux/sh64/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[199], [200], [201], [202], [252]): Add PU flag to getpid, getuid,
getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
geteuid32, getegid32, gettid syscalls.
* linux/sh/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[199], [200], [201], [202], [224]): Add PU flag to getpid, getuid,
getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
geteuid32, getegid32, gettid syscalls.
* linux/sparc64/syscallent.h ([20], [24], [47], [49], [50], [64], [81],
[143], [197], [340]): Add PU flag to getpid, getuid, getgid, geteuid,
getegid, getpagesize, getpgrp, gettid, getppid, kern_features syscalls.
* linux/sparc/syscallent.h ([20], [24], [44], [47], [49], [50], [53],
[64], [69], [70], [81], [143], [197], [340]): Add PU flag to getpid,
getuid, getuid32, getgid, geteuid, getegid, getgid32, getpagesize,
geteuid32, getegid32, getpgrp, gettid, getppid, kern_features syscalls.
* linux/x32/syscallent.h ([39], [102], [104], [107], [108], [110],
[111], [186]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
getppid, getpgrp, gettid syscalls.
* linux/x86_64/syscallent.h ([39], [102], [104], [107], [108], [110],
[111], [186]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
getppid, getpgrp, gettid syscalls.
* linux/xtensa/syscallent.h ([120], [127], [137], [139], [140], [141],
[150], [151]): Add PU flag to getpid, gettid, getuid, getgid, geteuid,
getegid, getppid, getpgrp syscalls.
* strace.1.in (.SS Filtering): Document it.
* NEWS: Mention it.
2018-02-10 01:33:49 +00:00
Eugene Syromyatnikov
8048b48881 Add SYSCALL_NEVER_FAILS flag to getpgrp
As glibc, at least, treats it this way.

* linux/aarch64/syscallent.h (getpgrp): Add NF flag.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
2018-02-09 04:41:55 +00:00
8672a7189d Enhance decoding of mq_* syscalls
* mq.c (SYS_FUNC(mq_open)): Add RVAL_FD to return value.
(SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive), SYS_FUNC(mq_notify),
SYS_FUNC(mq_getsetattr)): Print the first argument using printfd.
* NEWS: Mention this change.
* pathtrace.c (pathtrace_match_set) <SEN_mq_getsetattr, SEN_mq_notify,
SEN_mq_open, SEN_mq_timedreceive, SEN_mq_timedsend>: Skip matching.
* linux/32/syscallent.h (mq_getsetattr, mq_notify, mq_open,
mq_timedreceive, mq_timedsend): Add TD flag.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
2018-01-15 22:47:38 +00:00
Nikolay Marchuk
86259ebb47 Add TF flag to inotify_add_watch syscall entries
The second argument of the inotify_add_watch syscall is a file name,
but inotify_add_watch has no TF flag set.

* linux/32/syscallent.h (inotify_add_watch): Add TF flag.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
2017-08-11 10:48:38 +00:00
Lazar Trsic
72aba2be32 Move is_negated_errno() to new header negated_errno.h
Move is_negated_errno() to a separate new header file negated_errno.h
and include it just for architectures which require it.

is_negated_errno() is not used on those architectures
that have a dedicated register to signal a syscall error.

The issue was raised when compiling with clang, which is more
strict regarding semantics of unused static inline functions
defined in C files and will issue a -Wunused-function warrning
if they are not used anywhere.

* syscall.c (is_negated_errno): Move to ...
* negated_errno.h: ... new file.
* Makefile.am (strace_SOURCES): Add it.
* linux/aarch64/get_error.c: Include it.
* linux/arc/get_error.c: Likewise.
* linux/arm/get_error.c: Likewise.
* linux/avr32/get_error.c: Likewise.
* linux/bfin/get_error.c: Likewise.
* linux/crisv10/get_error.c: Likewise.
* linux/hppa/get_error.c: Likewise.
* linux/i386/get_error.c: Likewise.
* linux/ia64/get_error.c: Likewise.
* linux/m68k/get_error.c: Likewise.
* linux/metag/get_error.c: Likewise.
* linux/microblaze/get_error.c: Likewise.
* linux/or1k/get_error.c: Likewise.
* linux/riscv/get_error.c: Likewise.
* linux/s390/get_error.c: Likewise.
* linux/sh/get_error.c: Likewise.
* linux/sh64/get_error.c: Likewise.
* linux/tile/get_error.c: Likewise.
* linux/x86_64/get_error.c: Likewise.
* linux/xtensa/get_error.c: Likewise.
2017-07-14 23:55:23 +00:00
Eugene Syromyatnikov
9d095c7860 Add copyright headers 2017-05-22 17:33:51 +00:00
Eugene Syromyatnikov
e15d00536b Implement -e trace=%stat option
linux/*/syscallent*.h part is updated automatically by:

    sed -i '/statx/! s/TF|TSTA,/TF|TST|TSTA,/' linux/*/syscallent*.h

* sysent.h (TRACE_STAT): New macro.
* syscall.c: Alias LST to TRACE_STAT around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_STAT for "%stat".
* strace.1 (.SS Filtering): Add information about %stat syscall class.
* NEWS: Mention this change.
* linux/aarch64/syscallent.h (stat): Add TST flag.
* linux/ia64/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h (oldstat, stat, stat64): Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/avr32/syscallent.h (stat, stat64): Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h (oldstat, stat): Likewise.
* linux/alpha/syscallent.h (osf_old_stat, osf_stat, stat, stat64): Likewise.
* linux/mips/syscallent-compat.h (bsd43_oldstat, bsd43_stat, posix_stat,
svr4_stat, svr4_xstat, sysv_stat, sysv_xstat): Likewise.
* tests/gen_tests.in (trace_stat): New entry.
* tests/trace_stat.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TST): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-21 19:49:03 +00:00
Eugene Syromyatnikov
9a36c8e55d Implement -e trace=%lstat option
linux/*/syscallent*.h part is updated automatically by:

    sed -i '/TSTA,.*lx\?stat/ s/TSTA,/TLST|&/' linux/*/syscallent*.h

* sysent.h (TRACE_LSTAT): New macro.
* syscall.c: Alias TLST to TRACE_LSTAT around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_LSTAT for "%lstat".
* strace.1 (.SS Filtering): Add information about %lstat syscall class.
* NEWS: Mention this change.
* linux/aarch64/syscallent.h (lstat): Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h (lstat, lstat64, oldlstat): Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/avr32/syscallent.h (lstat, lstat64): Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/alpha/syscallent.h (lstat, lstat64, osf_lstat, osf_old_lstat): Likewise.
* linux/mips/syscallent-compat.h (bsd43_lstat, posix_lstat, svr4_lstat,
sysv_lstat): Likewise.
* tests/gen_tests.in (trace_lstat): New entry.
* tests/trace_lstat.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TLST): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-21 19:49:03 +00:00
Eugene Syromyatnikov
aad36c50dc Implement -e trace=%fstat option
linux/*/syscallent*.h part is updated automatically by:

    sed -i -e '/TSTA.*fx\?stat/ s/TSTA,/TFST|&/' \
           -e 's/\(TD|TF|TFST|TSTA,\)[[:space:]]/\1/' linux/*/syscallent*.h

* sysent.h (TRACE_FSTAT): New macro.
* syscall.c: Alias TFST to TRACE_FSTAT around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_FSTAT for "%fstat".
* strace.1 (.SS Filtering): Add information about %fstat syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h (fstat64, fstatat64): Add TFST flag.
* linux/64/syscallent.h (fstat, newfstatat): Likewise.
* linux/aarch64/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h (fstat, fstat64, fstatat64, oldfstat): Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/avr32/syscallent.h (fstat, fstat64, fstatat64): Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/alpha/syscallent.h (fstat, fstat64, fstatat64, osf_fstat,
osf_old_fstat): Likewise.
* linux/powerpc64/syscallent.h (fstat, newfstatat, oldfstat): Likewise.
* linux/mips/syscallent-compat.h (bsd43_fstat, bsd43_oldfstat, posix_fstat,
svr4_fstat, sysv_fstat): Likewise.
* tests/gen_tests.in (trace_fstat): New entry.
* tests/trace_fstat.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TFST): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-21 19:49:03 +00:00
Eugene Syromyatnikov
ed84a97da5 Implement -e trace=%%stat option
linux/*/syscallent*.h part is updated automatically by:

    sed -i '/TSFA\|stat[iu]s/! s/,[[:space:]]\?\([[:space:]]*SEN(.*stat\)/|TSTA,\1/' \
        linux/*/syscallent*.h

* sysent.h (TRACE_STAT_LIKE): New macro.
* syscall.c: Alias TSTA to TRACE_STAT_LIKE around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_STAT_LIKE for "%%stat".
* strace.1 (.SS Filtering): Add information about %%stat syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h (fstat64, fstatat64, statx): Add TSTA flag.
* linux/64/syscallent.h (fstat, newfstatat, statx): Likewise.
* linux/aarch64/syscallent.h (fstat, lstat, newfstatat, stat): Likewise.
* linux/alpha/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
osf_fstat, osf_lstat, osf_old_fstat, osf_old_lstat, osf_old_stat, osf_stat,
stat, stat64): Likewise.
* linux/arm/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
oldlstat, oldstat, stat, stat64, statx): Likewise.
* linux/avr32/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
stat64): Likewise.
* linux/bfin/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldfstat, oldlstat, oldstat, stat, stat64): Likewise.
* linux/crisv10/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldfstat, oldlstat, oldstat, stat, stat64): Likewise.
* linux/hppa/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
stat64): Likewise.
* linux/i386/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
oldlstat, oldstat, stat, stat64, statx): Likewise.
* linux/ia64/syscallent.h (fstat, lstat, newfstatat, stat): Likewise.
* linux/m68k/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
oldlstat, oldstat, stat, stat64, statx): Likewise.
* linux/microblaze/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldfstat, oldlstat, oldstat, stat, stat64): Likewise.
* linux/mips/syscallent-compat.h (bsd43_fstat, bsd43_lstat, bsd43_oldfstat,
bsd43_oldstat, bsd43_stat, posix_fstat, posix_lstat, posix_stat, svr4_fstat,
svr4_fxstat, svr4_lstat, svr4_lxstat, svr4_stat, svr4_xstat, sysv_fstat,
sysv_fxstat, sysv_lstat, sysv_lxstat, sysv_stat, sysv_xstat): Likewise.
* linux/mips/syscallent-n32.h (fstat, lstat, newfstatat, stat, statx): Likewise.
* linux/mips/syscallent-n64.h (fstat, lstat, newfstatat, stat, statx): Likewise.
* linux/mips/syscallent-o32.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldfstat, oldlstat, oldstat, stat, stat64, statx): Likewise.
* linux/powerpc64/syscallent.h (fstat, lstat, newfstatat, oldfstat, oldlstat,
oldstat, stat): Likewise.
* linux/powerpc/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldfstat, oldlstat, oldstat, stat, stat64, statx): Likewise.
* linux/s390/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
stat64, statx): Likewise.
* linux/s390x/syscallent.h (fstat, lstat, newfstatat, stat, statx): Likewise.
* linux/sh64/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
oldlstat, oldstat, stat, stat64): Likewise.
* linux/sh/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
oldlstat, oldstat, stat, stat64): Likewise.
* linux/sparc64/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldlstat, stat, stat64): Likewise.
* linux/sparc/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldlstat, stat, stat64): Likewise.
* linux/x32/syscallent.h (fstat, lstat, newfstatat, stat, statx): Likewise.
* linux/x86_64/syscallent.h (fstat, lstat, newfstatat, stat, statx): Likewise.
* linux/xtensa/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
stat64, statx): Likewise.
* tests/gen_tests.in (trace_stat_like): New entry.
* tests/trace_stat_like.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TSTA): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-21 19:49:03 +00:00
Eugene Syromyatnikov
c05b95334c Implement -e trace=%%statfs option
linux/*/syscallent*.h part is updated automatically by:

    sed -i 's/\(TSF\),[[:space:]]\?/\1|TSFA,/' linux/*/syscallent*.h
    sed -i 's/\(TFSF\),/\1|TSFA,/' linux/*/syscallent*.h
    sed -i 's/0\(,.*ustat\)/TSFA\1/' linux/*/syscallent*.h

* sysent.h (TRACE_STATFS_LIKE): New macro.
* syscall.c: Alias TSFA to TRACE_STATFS_LIKE around syscallent.h inclusion.
* qualify.c (lookup_class): Add SCHED_STATFS_LIKE for "%%statfs".
* strace.1 (.SS Filtering): Add information about %%statfs syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h (statfs64, fstatfs64): Add TSFA flag.
* linux/64/syscallent.h (statfs, fstatfs): Likewise.
* linux/aarch64/syscallent.h (statfs, fstatfs, ustat): Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h (statfs, statfs64, fstatfs, fstatfs64, ustat):
Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/alpha/syscallent.h (osf_statfs, osf_statfs64, statfs,
ofs_fstatfs, osf_fstatfs64, ustat): Likewise.
* linux/mips/syscallent-compat.h (*_statfs, *_statvfs, *_fstatfs): Likewise.
* tests/gen_tests.in (trace_statfs_like): New entry.
* tests/trace_statfs_like.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TSFA): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-21 19:49:03 +00:00
Eugene Syromyatnikov
b4aabcb16f Implement -e trace=%fstatfs option
linux/*/syscallent*.h part is updated automatically by:

    sed -i 's/TD,[[:space:]]\([[:space:]]*SEN.*[_"]fstatv\?fs\)/TD|TFSF,\1/' \
           linux/*/syscallent*.h

* sysent.h (TRACE_FSTATFS): New macro.
* syscall.c: Alias TFSF to TRACE_FSTATFS around syscallent.h inclusion.
* qualify.c (lookup_class): Add SCHED_FSTATFS for "%fstatfs".
* strace.1 (.SS Filtering): Add information about %fstatfs syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h (fstatfs64): Add TFSF flag.
* linux/64/syscallent.h (fstatfs): Likewise.
* linux/aarch64/syscallent.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h (fstatfs, fstatfs64):
Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/alpha/syscallent.h (ofs_fstatfs, osf_fstatfs64): Likewise.
* linux/mips/syscallent-compat.h (*_fstatfs, *_fstatvfs): Likewise.
* tests/gen_tests.in (trace_fstatfs): New entry.
* tests/trace_fstatfs.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TFSF): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-21 19:49:03 +00:00
3330d4ad28 Revert "Implement -e trace=%sched option"
-e trace=%sched became redundant as -e trace=/sched does the same.

This reverts commit 811638e9c1.

* syscall.c (TSC): Remove.
* sysent.h (TRACE_SCHED): Remove.
* qualify.c (lookup_class): Remove %sched.
* strace.1 (.SS Filtering): Likewise.
* NEWS: Likewise.
* linux/32/syscallent.h: Remove TSC flag from sched* syscalls.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/sched.test: Replace trace=%sched with trace=/sched.
* tests/ksysent.c (TSC): Remove.
* tests/nsyscalls.c: Likewise.
2017-04-14 15:06:42 +00:00
676d2460b9 Revert "Implement -e trace=%clock option"
-e trace=%clock became redundant as -e trace=/clock does the same.

This reverts commit 0a13d2391c.

* syscall.c (TCL): Remove.
* sysent.h (TRACE_CLOCK): Remove.
* qualify.c (lookup_class): Remove %clock.
* strace.1 (.SS Filtering): Likewise.
* NEWS: Likewise.
* linux/32/syscallent.h: Remove TCL flag from clock_* syscalls.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/clock.test: Replace trace=%clock with trace=/clock.
* tests/ksysent.c (TCL): Remove.
* tests/nsyscalls.c: Likewise.
2017-04-14 15:06:42 +00:00
Abhishek Tiwari
2fa95ae169 Implement -e trace=%statfs option
linux/*/syscallent*.h part is modified automatically by:

	sed -i 's/TF\(,[[:space:]]*SEN.*[_"]statv\?fs\)/TF|TSF\1/' \
		linux/*/syscallent*.h

[ldv: rewritten trace_statfs.test using sched.test as a template]

* sysent.h (TRACE_STATFS): New macro.
* syscall.c: Alias TSF to TRACE_STATFS around syscallent.h inclusion.
* qualify.c (lookup_class): Add SCHED_STATFS for "%statfs".
* strace.1 (.SS Filtering): Add information about %statfs syscall class.
* NEWS: Mention this change.
* linux/64/syscallent.h (statfs): Add TSF flag.
* linux/aarch64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/32/syscallent.h (statfs64): Likewise.
* linux/arm/syscallent.h (statfs, statfs64): Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/alpha/syscallent.h (osf_statfs, osf_statfs64, statfs): Likewise.
* linux/mips/syscallent-compat.h (*_statfs, *_statvfs): Likewise.
* tests/trace_statfs.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
* tests/ksysent.c (TSF): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-07 01:21:36 +00:00
Rishi Bhatt
0a13d2391c Implement -e trace=%clock option
linux/*/syscallent.h part is modified automatically by
sed -i 's/0\(,[[:space:]]*SEN(clock_\)/TCL\1/' linux/*/syscallent*.h

[ldv: rewritten clock.test using sched.test as a template]

* sysent.h (TRACE_CLOCK): New macro.
* syscall.c: Alias TCL to TRACE_CLOCK around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_CLOCK for "%clock".
* strace.1 (.SS Filtering): Add information about %clock syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h: Add TCL flag for clock_* syscalls.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/clock.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
* tests/ksysent.c (TCL): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-06 22:47:09 +00:00
c57cf9acf5 Introduce get_rt_sigframe_addr function
Add get_rt_sigframe_addr function for all supported architectures.
It is going to be used in a parser of rt_sigreturn syscall.

* defs.h (get_rt_sigframe_addr): New function prototype.
* rt_sigframe.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/aarch64/arch_rt_sigframe.c: New file.
* linux/alpha/arch_rt_sigframe.c: Likewise.
* linux/arc/arch_rt_sigframe.c: Likewise.
* linux/arm/arch_rt_sigframe.c: Likewise.
* linux/avr32/arch_rt_sigframe.c: Likewise.
* linux/bfin/arch_rt_sigframe.c: Likewise.
* linux/crisv10/arch_rt_sigframe.c: Likewise.
* linux/crisv32/arch_rt_sigframe.c: Likewise.
* linux/hppa/arch_rt_sigframe.c: Likewise.
* linux/i386/arch_rt_sigframe.c: Likewise.
* linux/ia64/arch_rt_sigframe.c: Likewise.
* linux/m68k/arch_rt_sigframe.c: Likewise.
* linux/metag/arch_rt_sigframe.c: Likewise.
* linux/microblaze/arch_rt_sigframe.c: Likewise.
* linux/mips/arch_rt_sigframe.c: Likewise.
* linux/nios2/arch_rt_sigframe.c: Likewise.
* linux/or1k/arch_rt_sigframe.c: Likewise.
* linux/powerpc/arch_rt_sigframe.c: Likewise.
* linux/powerpc64/arch_rt_sigframe.c: Likewise.
* linux/riscv/arch_rt_sigframe.c: Likewise.
* linux/s390/arch_rt_sigframe.c: Likewise.
* linux/s390x/arch_rt_sigframe.c: Likewise.
* linux/sh/arch_rt_sigframe.c: Likewise.
* linux/sh64/arch_rt_sigframe.c: Likewise.
* linux/sparc/arch_rt_sigframe.c: Likewise.
* linux/sparc64/arch_rt_sigframe.c: Likewise.
* linux/tile/arch_rt_sigframe.c: Likewise.
* linux/x32/arch_rt_sigframe.c: Likewise.
* linux/x86_64/arch_rt_sigframe.c: Likewise.
* linux/xtensa/arch_rt_sigframe.c: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
2017-03-13 15:22:50 +00:00
3403f14ece avr32: export avr32_sp_ptr
Export SP register for later use by get_rt_sigframe_addr.

* linux/avr32/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/avr32/arch_regs.c (avr32_sp_ptr): New variable.
2017-03-10 18:40:05 +00:00
Eugene Syromyatnikov
811638e9c1 Implement -e trace=%sched option for tracing sched_* syscalls
Based on the patch by Md Haris Iqbal
(https://sourceforge.net/p/strace/mailman/message/35111320/)

linux/*/syscallent.h part is modified automatically by:

    git grep -Fl 'SEN(sched_' linux/ | xargs sed -i \
        's/0\(,[[:space:]]*SEN(sched_\)/TSC\1/'

* sysent.h (TRACE_SCHED): New definition.
* syscall.c: Alias TSC to TRACE_SCHED around syscallent.h inclusion.
* linux/32/syscallent.h: Add TSC flag for sched_* sycalls.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* qualify.c (lookup_class): Add TRACE_SCHED for "%sched".
* tests/ksysent.c: Define TSC to 0.
* tests/nsyscalls.c: Likewise.
* tests/sched.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add sched.test.
* strace.1 (.SS Filtering): Add information about %sched syscall class.
* NEWS: Mention this change.

Co-authored-by: Md Haris Iqbal <haris.phnx@gmail.com>
2017-03-05 01:11:13 +01:00
d4499fa508 avr32: wire up new syscalls
* linux/avr32/syscallent.h [328..330]: New entries.
2017-02-07 14:58:30 +00:00
Elvira Khabirova
41d647ce67 Implement success injection
This extends fault injection syntax with :retval= option.
When :retval=VALUE is specified, the syscall number is replaced by -1
and a bogus success VALUE is returned to the callee.

* defs.h (fault_opts): Remove err field, add rval field.
(MAX_ERRNO_VALUE, FAULT_OPTS_RVAL_DEFAULT, FAULT_OPTS_RVAL_DISABLE):
New macros.
* qualify.c (parse_fault_token): Handle retval= token.
(qualify_fault): Update fault_opts initialization after the move
from struct fault_opts.err to struct fault_opts.rval.
* syscall.c (arch_set_success): New prototype.
(inject_syscall_fault_entering): Check opts->rval instead of opts->err.
(update_syscall_fault_exiting): Implement retval injection.
* strace.1: Update the section on fault injection.
* NEWS: Mention retval= option.
* linux/aarch64/set_error.c (arch_set_success): New function.
* linux/alpha/set_error.c: Likewise.
* linux/arc/set_error.c: Likewise.
* linux/arm/set_error.c: Likewise.
* linux/avr32/set_error.c: Likewise.
* linux/bfin/set_error.c: Likewise.
* linux/crisv10/set_error.c: Likewise.
* linux/hppa/set_error.c: Likewise.
* linux/i386/set_error.c: Likewise.
* linux/ia64/set_error.c: Likewise.
* linux/m68k/set_error.c: Likewise.
* linux/metag/set_error.c: Likewise.
* linux/microblaze/set_error.c: Likewise.
* linux/mips/set_error.c: Likewise.
* linux/nios2/set_error.c: Likewise.
* linux/or1k/set_error.c: Likewise.
* linux/powerpc/set_error.c: Likewise.
* linux/riscv/set_error.c: Likewise.
* linux/s390/set_error.c: Likewise.
* linux/sh/set_error.c: Likewise.
* linux/sh64/set_error.c: Likewise.
* linux/sparc/set_error.c: Likewise.
* linux/sparc64/set_error.c: Likewise.
* linux/tile/set_error.c: Likewise.
* linux/x86_64/set_error.c: Likewise.
* linux/xtensa/set_error.c: Likewise.

Closes: https://github.com/strace/strace/issues/3
2017-01-28 09:47:00 +00:00
791e45ec4f Remove redundant commas at the end of structure initializers
Automatically remove redundant commas using the following
sed expression:

git grep -El ',[[:space:]]+}' |xargs sed -ri 's/,([[:space:]]+\})/\1/'

* linux/32/syscallent.h: Remove redundant commas at the end of structure
initializers.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/microblaze/userent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/kexec_file_load.c: Likewise.

Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2017-01-11 23:48:41 +00:00
7fa3d78319 Automatically replace kernel_(scno|ureg)_t with kernel_ulong_t
Remove temporary types created for transition from long
to kernel_ulong_t.

Automatically replace kernel_scno_t and kernel_ureg_t with
kernel_ulong_t using
$ git grep -El 'kernel_(scno|ureg)_t' |
  xargs sed -ri 's/kernel_(scno|ureg)_t/kernel_ulong_t/g'

* kernel_types.h (kernel_scno_t, kernel_ureg_t): Remove.
All users updated.
2016-12-26 10:43:34 +00:00
0547dc1ad5 Change scno type from long to unsigned long
Use an unsigned type for syscall numbers as they are not intended
for signed arithmetics.  Introduce kernel_scno_t as a typedef
to unsigned long, that could be changed later to kernel_ulong_t.

* kernel_types.h (kernel_scno_t): New type, typedef to unsigned long.
* defs.h (struct tcb): Change type of scno field from long
to kernel_scno_t.
(syscall_name): Change argument type from long to kernel_scno_t.
(scno_in_range, scno_is_valid): Change argument type from unsigned long
to kernel_scno_t.
* linux/aarch64/set_scno.c (arch_set_scno): Change scno argument type
from long to kernel_scno_t.
* linux/alpha/set_scno.c (arch_set_scno): Likewise.
* linux/arc/set_scno.c (arch_set_scno): Likewise.
* linux/arm/set_scno.c (arch_set_scno): Likewise.
* linux/avr32/set_scno.c (arch_set_scno): Likewise.
* linux/bfin/set_scno.c (arch_set_scno): Likewise.
* linux/crisv10/set_scno.c (arch_set_scno): Likewise.
* linux/hppa/set_scno.c (arch_set_scno): Likewise.
* linux/i386/set_scno.c (arch_set_scno): Likewise.
* linux/ia64/set_scno.c (arch_set_scno): Likewise.
* linux/m68k/set_scno.c (arch_set_scno): Likewise.
* linux/metag/set_scno.c (arch_set_scno): Likewise.
* linux/microblaze/set_scno.c (arch_set_scno): Likewise.
* linux/mips/set_scno.c (arch_set_scno): Likewise.
* linux/nios2/set_scno.c (arch_set_scno): Likewise.
* linux/or1k/set_scno.c (arch_set_scno): Likewise.
* linux/powerpc/set_scno.c (arch_set_scno): Likewise.
* linux/riscv/set_scno.c (arch_set_scno): Likewise.
* linux/s390/set_scno.c (arch_set_scno): Likewise.
* linux/sh/set_scno.c (arch_set_scno): Likewise.
* linux/sh64/set_scno.c (arch_set_scno): Likewise.
* linux/sparc/set_scno.c (arch_set_scno): Likewise.
* linux/tile/set_scno.c (arch_set_scno): Likewise.
* linux/x86_64/set_scno.c (arch_set_scno): Likewise.
* linux/xtensa/set_scno.c (arch_set_scno): Likewise.
* linux/aarch64/get_scno.c (arch_get_scno): Change scno variable type
from long to kernel_scno_t.
* linux/alpha/get_scno.c (arch_get_scno): Likewise.
* linux/arm/get_scno.c (arch_get_scno): Likewise.
* linux/sh/get_scno.c (arch_get_scno): Likewise.
* linux/x86_64/get_scno.c (arch_get_scno): Likewise.
* syscall.c (arch_set_scno): Likewise.
(shuffle_scno): Change return type from long to kernel_scno_t.
(syscall_name): Change argument type from long to kernel_scno_t.
2016-12-18 22:57:57 +00:00
f1d0729f17 Implement arch specific methods of changing syscall number and error code
This introduces arch_set_error and arch_set_scno functions for each
supported architecture, needed to implement syscall fault injection.

* linux/aarch64/set_error.c: New file.
* linux/aarch64/set_scno.c: Likewise.
* linux/alpha/set_error.c: Likewise.
* linux/alpha/set_scno.c: Likewise.
* linux/arc/set_error.c: Likewise.
* linux/arc/set_scno.c: Likewise.
* linux/arm/set_error.c: Likewise.
* linux/arm/set_scno.c: Likewise.
* linux/avr32/set_error.c: Likewise.
* linux/avr32/set_scno.c: Likewise.
* linux/bfin/set_error.c: Likewise.
* linux/bfin/set_scno.c: Likewise.
* linux/crisv10/set_error.c: Likewise.
* linux/crisv10/set_scno.c: Likewise.
* linux/crisv32/set_error.c: Likewise.
* linux/crisv32/set_scno.c: Likewise.
* linux/hppa/set_error.c: Likewise.
* linux/hppa/set_scno.c: Likewise.
* linux/i386/set_error.c: Likewise.
* linux/i386/set_scno.c: Likewise.
* linux/ia64/set_error.c: Likewise.
* linux/ia64/set_scno.c: Likewise.
* linux/m68k/set_error.c: Likewise.
* linux/m68k/set_scno.c: Likewise.
* linux/metag/set_error.c: Likewise.
* linux/metag/set_scno.c: Likewise.
* linux/microblaze/set_error.c: Likewise.
* linux/microblaze/set_scno.c: Likewise.
* linux/mips/set_error.c: Likewise.
* linux/mips/set_scno.c: Likewise.
* linux/nios2/set_error.c: Likewise.
* linux/nios2/set_scno.c: Likewise.
* linux/or1k/set_error.c: Likewise.
* linux/or1k/set_scno.c: Likewise.
* linux/powerpc/set_error.c: Likewise.
* linux/powerpc/set_scno.c: Likewise.
* linux/powerpc64/set_error.c: Likewise.
* linux/powerpc64/set_scno.c: Likewise.
* linux/riscv/set_error.c: Likewise.
* linux/riscv/set_scno.c: Likewise.
* linux/s390/set_error.c: Likewise.
* linux/s390/set_scno.c: Likewise.
* linux/s390x/set_error.c: Likewise.
* linux/s390x/set_scno.c: Likewise.
* linux/sh/set_error.c: Likewise.
* linux/sh/set_scno.c: Likewise.
* linux/sh64/set_error.c: Likewise.
* linux/sh64/set_scno.c: Likewise.
* linux/sparc/set_error.c: Likewise.
* linux/sparc/set_scno.c: Likewise.
* linux/sparc64/set_error.c: Likewise.
* linux/sparc64/set_scno.c: Likewise.
* linux/tile/set_error.c: Likewise.
* linux/tile/set_scno.c: Likewise.
* linux/x32/set_error.c: Likewise.
* linux/x32/set_scno.c: Likewise.
* linux/x86_64/set_error.c: Likewise.
* linux/x86_64/set_scno.c: Likewise.
* linux/xtensa/set_error.c: Likewise.
* linux/xtensa/set_scno.c: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
2016-11-16 02:33:13 +00:00
a92ba46c55 Mark io_setup and io_destroy as memory mapping related syscalls
As io_setup syscall allocates some memory using do_mmap_pgoff, and
io_destroy deallocates this memory using vm_munmap, set TRACE_MEMORY
flag for all sysentries of io_setup and io_destroy using the following
oneliner:
sed -ri '/io_setup|io_destroy/ s/0,/TM,/' linux/*/syscallent*.h

* linux/*/syscallent*.h (io_setup, io_destroy): Change sys_flags to TM.
2016-09-09 02:38:32 +00:00
5ff4be2bd2 avr32: wire up preadv2 and pwritev2 syscalls
* linux/avr32/syscallent.h [326]: Add preadv2 entry.
[327]: Add pwritev2 entry.
2016-09-05 13:04:29 +00:00
c4da489a74 Introduce a separate SEN entry for fstatat64 syscall
* linux/dummy.h (sys_fstatat64): Redirect to sys_newfstatat.
* linux/32/syscallent.h: Replace SEN(newfstatat) with SEN(fstatat64).
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* pathtrace.c (pathtrace_match): Handle SEN_fstatat64.
2016-08-23 15:06:34 +00:00
126464566d Remove parser of unimplemented timerfd syscall
timerfd syscall was introduced in v2.6.22-rc1, but in v2.6.25-rc1
it was replaced by timerfd_* syscall family.

* linux/avr32/syscallent.h (timerfd): Fix nargs.
* linux/dummy.h (sys_timerfd): Add stub alias.
* time.c (SYS_FUNC(timerfd)): Remove.
2016-04-20 17:15:05 +00:00
dbc68b7034 avr32: wire up copy_file_range syscall
* linux/avr32/syscallent.h [325]: Add copy_file_range entry.
2016-03-29 00:01:07 +00:00
3a630751eb avr32: wire up missing syscalls
* linux/avr32/syscallent.h [322..324]: Add userfaultfd, membarrier,
and mlock2 entries.
2016-02-13 00:57:00 +00:00
5b87572952 avr32: wire up accept4 syscall
* linux/avr32/syscallent.h [321]: Add accept4 entry.
2016-01-10 21:38:03 +00:00
aef5e14ba2 Set SYSCALL_NEVER_FAILS flag for getpid, getppid and gettid syscall
* linux/*/syscallent*.h (getpid, getppid, gettid): Set NF flag.
2015-12-29 01:15:20 +00:00
dd039b74ef Set SYSCALL_NEVER_FAILS flag for umask syscall
Linux kernel always ANDs umask argument with 0700 and therefore
this syscall never fails.

* linux/*/syscallent*.h (umask): Set NF flag.
2015-12-29 01:15:06 +00:00
ffb6c55d7d Set SYSCALL_NEVER_FAILS flag for personality syscall
Starting with commit
v2.6.29-6609-g11d06b2a1e5658f448a308aa3beb97bacd64a940, personality
syscall never fails to set the personality, but before commit
v2.6.35-rc1-372-g485d527 it still could return an error.
Starting with that commit, personality syscall never returns an error.

* linux/*/syscallent.h: Set SYSCALL_NEVER_FAILS flag in personality
syscall entries.
2015-12-25 00:45:43 +00:00
19a6d71915 avr32: update syscall entries
* linux/avr32/syscallent.h [0]: Rename from setup to restart_syscall.
[284 ... 320]: New entries.
2015-12-08 21:19:53 +00:00
476ec393c3 Fix mmap syscall entries
Change syscall names to match kernel __NR_* constants.

* linux/avr32/syscallent.h [90]: Rename "mmap" to "mmap2".
* linux/bfin/syscallent.h [90]: Rename "old_mmap" to "mmap".
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* tests/mmap.c (main): Remove old_mmap from expected output.
* tests/mmap.test: Remove old_mmap from the list of mmap syscalls.
2015-12-08 21:19:43 +00:00
dd360922d1 Fix exit syscall entries
Change syscall names to match kernel __NR_* constants.

* linux/avr32/syscallent.h [1]: Rename "_exit" to "exit".
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/x32/syscallent.h [60]: Rename "_exit" to "exit".
* linux/x86_64/syscallent.h: Likewise.
2015-12-08 21:19:35 +00:00
6a8095eaed avr32: fix umount2 syscall entry
* linux/avr32/syscallent.h: Rename umount to umount2.
2015-12-07 00:38:43 +00:00
Elvira Khabirova
211d6ef4b6 fcntl: create a separate parser for fcntl64 syscall
* fcntl.c(print_fcntl): New function, made from SYS_FUNC(fcntl).
(SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): Use it.
* linux/32/syscallent.h: Change parser of fcntl64 to SEN(fcntl64).
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
2015-12-04 23:12:14 +00:00
5105d4ac96 Cleanup print_pc
Apparently, there are only two types of instruction pointer printers
depending on the architecture: those that print a register that was
fetched earlier, and those that fetch a register themselves using upeek.
With this change, architectures of the first type have ARCH_PC_REG
defined in their arch_regs.c file, architectures of the first type
have ARCH_PC_PEEK_ADDR defined there, and the common code in syscall.c
uses these macros to print the instruction pointer.

* Makefile.am (EXTRA_DIST): Remove linux/*/print_pc.c.
* linux/*/print_pc.c: Remove.
* linux/aarch64/arch_regs.c(ARCH_PC_REG): Define macro.
* linux/arc/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/arm/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/avr32/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/i386/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/ia64/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/metag/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/mips/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/nios2/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/or1k/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/powerpc64/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/powerpc/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/s390/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/s390x/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/sparc64/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/sparc/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/tile/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/x32/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/x86_64/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/alpha/arch_regs.c(ARCH_PC_PEEK_ADDR): Define macro.
* linux/bfin/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/crisv10/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/crisv32/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/hppa/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/m68k/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/microblaze/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/sh64/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/sh/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/xtensa/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* syscall.c (print_pc): Stop including "print_pc.c".
Use ARCH_PC_REG or ARCH_PC_PEEK_ADDR.
2015-11-30 03:30:51 +00:00
16510517f1 cleanup: make get_scno.c files more readable
Make get_scno.c files more self-contained.  While they are still
being included by syscall.c, the latter no longer provides
a function framework for them.

* linux/aarch64/get_scno.c (arch_get_scno): Define.
* linux/alpha/get_scno.c: Likewise.
* linux/arc/get_scno.c: Likewise.
* linux/arm/get_scno.c: Likewise.
* linux/avr32/get_scno.c: Likewise.
* linux/bfin/get_scno.c: Likewise.
* linux/crisv10/get_scno.c: Likewise.
* linux/hppa/get_scno.c: Likewise.
* linux/i386/get_scno.c: Likewise.
* linux/ia64/get_scno.c: Likewise.
* linux/m68k/get_scno.c: Likewise.
* linux/metag/get_scno.c: Likewise.
* linux/microblaze/get_scno.c: Likewise.
* linux/mips/get_scno.c: Likewise.
* linux/nios2/get_scno.c: Likewise.
* linux/or1k/get_scno.c: Likewise.
* linux/powerpc/get_scno.c: Likewise.
* linux/powerpc64/get_scno.c: Likewise.
* linux/s390/get_scno.c: Likewise.
* linux/sh/get_scno.c: Likewise.
* linux/sh64/get_scno.c: Likewise.
* linux/sparc/get_scno.c: Likewise.
* linux/sparc64/get_scno.c: Likewise.
* linux/tile/get_scno.c: Likewise.
* linux/x86_64/get_scno.c: Likewise.
* linux/xtensa/get_scno.c: Likewise.
* syscall.c (arch_get_scno): New declaration.
Include "get_scno.c" in file scope.
(get_scno): Use arch_get_scno.

Requested-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-11-30 01:46:52 +00:00
64672a6526 cleanup: make get_syscall_args.c files more readable
Make get_syscall_args.c files more self-contained.  While they are
still being included by syscall.c, the latter no longer defines
get_syscall_args function.

* linux/aarch64/get_syscall_args.c: Include "arm/get_syscall_args.c"
with get_syscall_args temporarily defined to arm_get_syscall_args.
(get_syscall_args): Define.
* linux/alpha/get_syscall_args.c (get_syscall_args): Define.
* linux/arc/get_syscall_args.c: Likewise.
* linux/arm/get_syscall_args.c: Likewise.
* linux/avr32/get_syscall_args.c: Likewise.
* linux/bfin/get_syscall_args.c: Likewise.
* linux/crisv10/get_syscall_args.c: Likewise.
* linux/hppa/get_syscall_args.c: Likewise.
* linux/i386/get_syscall_args.c: Likewise.
* linux/ia64/get_syscall_args.c: Likewise.
* linux/m68k/get_syscall_args.c: Likewise.
* linux/metag/get_syscall_args.c: Likewise.
* linux/microblaze/get_syscall_args.c: Likewise.
* linux/mips/get_syscall_args.c: Likewise.
* linux/nios2/get_syscall_args.c: Likewise.
* linux/or1k/get_syscall_args.c: Likewise.
* linux/powerpc/get_syscall_args.c: Likewise.
* linux/s390/get_syscall_args.c: Likewise.
* linux/sh/get_syscall_args.c: Likewise.
* linux/sh64/get_syscall_args.c: Likewise.
* linux/sparc/get_syscall_args.c: Likewise.
* linux/tile/get_syscall_args.c: Likewise.
* linux/x86_64/get_syscall_args.c: Likewise.
* linux/xtensa/get_syscall_args.c: Likewise.
* syscall.c (get_syscall_args): Remove.
Include "get_syscall_args.c" in file scope.

Requested-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-11-30 00:57:14 +00:00
0c8c5c9f4e cleanup: make get_error.c files more readable
Make get_error.c files more self-sustained.  While they are still being
included by syscall.c, the latter no longer defines get_error function.

* linux/aarch64/get_error.c: Include "arm/get_error.c" with get_error
temporarily defined to arm_get_error.
(get_error): Define.
* linux/alpha/get_error.c (get_error): Define.
* linux/arc/get_error.c: Likewise.
* linux/arm/get_error.c: Likewise.
* linux/avr32/get_error.c: Likewise.
* linux/bfin/get_error.c: Likewise.
* linux/crisv10/get_error.c: Likewise.
* linux/hppa/get_error.c: Likewise.
* linux/i386/get_error.c: Likewise.
* linux/ia64/get_error.c: Likewise.
* linux/m68k/get_error.c: Likewise.
* linux/metag/get_error.c: Likewise.
* linux/microblaze/get_error.c: Likewise.
* linux/mips/get_error.c: Likewise.
* linux/nios2/get_error.c: Likewise.
* linux/or1k/get_error.c: Likewise.
* linux/powerpc/get_error.c: Likewise.
* linux/s390/get_error.c: Likewise.
* linux/sh/get_error.c: Likewise.
* linux/sh64/get_error.c: Likewise.
* linux/sparc/get_error.c: Likewise.
* linux/sparc64/get_error.c: Likewise.
* linux/tile/get_error.c: Likewise.
* linux/x86_64/get_error.c: Likewise.
* linux/xtensa/get_error.c: Likewise.
* syscall.c: Include "get_error.c" in file scope.
(get_error): Remove.  Move arch independent code ...
(get_syscall_result): ... here.  Update get_error invocation.

Requested-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-11-29 00:06:45 +00:00