* ptrace.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* configure.ac (AC_CHECK_HEADERS): Remove linux/ptrace.h and sys/ptrace.h.
* defs.h: Do not include <sys/ptrace.h> and <asm/ptrace.h>.
Remove definitions of PTRACE_* macros.
* process.c: Remove <linux/ptrace.h> workarounds, include "ptrace.h".
* signal.c: Likewise.
* syscall.c: Likewise.
* util.c: Likewise.
* strace.c: Include "ptrace.h".
* wait.c: Likewise.
process.c \
process_vm.c \
ptp.c \
+ ptrace.h \
quota.c \
readahead.c \
readlink.c \
linux/input.h
linux/mmtimer.h
linux/perf_event.h
- linux/ptrace.h
linux/seccomp.h
linux/utsname.h
mqueue.h
sys/filio.h
sys/ioctl.h
sys/poll.h
- sys/ptrace.h
sys/reg.h
sys/vfs.h
sys/xattr.h
AC_CHECK_DECLS([sys_errlist])
AC_CHECK_DECLS(m4_normalize([
- PTRACE_EVENT_CLONE,
- PTRACE_EVENT_EXEC,
- PTRACE_EVENT_EXIT,
- PTRACE_EVENT_FORK,
- PTRACE_EVENT_VFORK,
- PTRACE_EVENT_VFORK_DONE,
- PTRACE_GETEVENTMSG,
- PTRACE_GETSIGINFO,
- PTRACE_O_TRACECLONE,
- PTRACE_O_TRACEEXEC,
- PTRACE_O_TRACEEXIT,
- PTRACE_O_TRACEFORK,
- PTRACE_O_TRACESYSGOOD,
- PTRACE_O_TRACEVFORK,
PTRACE_PEEKUSER,
- PTRACE_POKEUSER,
- PTRACE_SETOPTIONS
+ PTRACE_POKEUSER
]),,, [#include <sys/ptrace.h>])
AC_CHECK_DECLS(m4_normalize([
*/
#define USE_CUSTOM_PRINTF 0
-#ifdef NEED_PTRACE_PROTOTYPE_WORKAROUND
-# define ptrace xptrace
-# include <sys/ptrace.h>
-# undef ptrace
-extern long ptrace(int, int, char *, long);
-#else
-# include <sys/ptrace.h>
-#endif
-
-#if defined(POWERPC)
-# include <asm/ptrace.h>
-#endif
-
-#if defined(TILE)
-# include <asm/ptrace.h> /* struct pt_regs */
-#endif
-
#ifndef ERESTARTSYS
# define ERESTARTSYS 512
#endif
# define ERESTART_RESTARTBLOCK 516
#endif
-#if !HAVE_DECL_PTRACE_SETOPTIONS
-# define PTRACE_SETOPTIONS 0x4200
-#endif
-#if !HAVE_DECL_PTRACE_GETEVENTMSG
-# define PTRACE_GETEVENTMSG 0x4201
-#endif
-#if !HAVE_DECL_PTRACE_GETSIGINFO
-# define PTRACE_GETSIGINFO 0x4202
-#endif
-
-#if !HAVE_DECL_PTRACE_O_TRACESYSGOOD
-# define PTRACE_O_TRACESYSGOOD 0x00000001
-#endif
-#if !HAVE_DECL_PTRACE_O_TRACEFORK
-# define PTRACE_O_TRACEFORK 0x00000002
-#endif
-#if !HAVE_DECL_PTRACE_O_TRACEVFORK
-# define PTRACE_O_TRACEVFORK 0x00000004
-#endif
-#if !HAVE_DECL_PTRACE_O_TRACECLONE
-# define PTRACE_O_TRACECLONE 0x00000008
-#endif
-#if !HAVE_DECL_PTRACE_O_TRACEEXEC
-# define PTRACE_O_TRACEEXEC 0x00000010
-#endif
-#if !HAVE_DECL_PTRACE_O_TRACEEXIT
-# define PTRACE_O_TRACEEXIT 0x00000040
-#endif
-
-#if !HAVE_DECL_PTRACE_EVENT_FORK
-# define PTRACE_EVENT_FORK 1
-#endif
-#if !HAVE_DECL_PTRACE_EVENT_VFORK
-# define PTRACE_EVENT_VFORK 2
-#endif
-#if !HAVE_DECL_PTRACE_EVENT_CLONE
-# define PTRACE_EVENT_CLONE 3
-#endif
-#if !HAVE_DECL_PTRACE_EVENT_EXEC
-# define PTRACE_EVENT_EXEC 4
-#endif
-#if !HAVE_DECL_PTRACE_EVENT_VFORK_DONE
-# define PTRACE_EVENT_VFORK_DONE 5
-#endif
-#if !HAVE_DECL_PTRACE_EVENT_EXIT
-# define PTRACE_EVENT_EXIT 6
-#endif
-
-#if !HAVE_DECL_PTRACE_PEEKUSER
-# define PTRACE_PEEKUSER PTRACE_PEEKUSR
-#endif
-#if !HAVE_DECL_PTRACE_POKEUSER
-# define PTRACE_POKEUSER PTRACE_POKEUSR
-#endif
-
-#undef PTRACE_SEIZE
-#define PTRACE_SEIZE 0x4206
-#undef PTRACE_INTERRUPT
-#define PTRACE_INTERRUPT 0x4207
-#undef PTRACE_LISTEN
-#define PTRACE_LISTEN 0x4208
-#undef PTRACE_EVENT_STOP
-#define PTRACE_EVENT_STOP 128
-
#ifdef ALPHA
# define REG_R0 0
# define REG_A0 16
# include <sys/reg.h>
#endif
-#ifdef HAVE_LINUX_PTRACE_H
-# undef PTRACE_SYSCALL
-# ifdef HAVE_STRUCT_IA64_FPREG
-# define ia64_fpreg XXX_ia64_fpreg
-# endif
-# ifdef HAVE_STRUCT_PT_ALL_USER_REGS
-# define pt_all_user_regs XXX_pt_all_user_regs
-# endif
-# ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
-# define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
-# endif
-# include <linux/ptrace.h>
-# undef ptrace_peeksiginfo_args
-# undef ia64_fpreg
-# undef pt_all_user_regs
-#endif
+#include "ptrace.h"
#if defined(SPARC64)
# define r_pc r_tpc
else
tprintf("%s, ", x->str);
} else
-#ifdef PTRACE_GETREGSET
if (tcp->u_arg[0] == PTRACE_GETREGSET
|| tcp->u_arg[0] == PTRACE_SETREGSET
) {
printxval(nt_descriptor_types, tcp->u_arg[2], "NT_???");
tprints(", ");
} else
-#endif
tprintf("%#lx, ", addr);
case PTRACE_DETACH:
printsignal(tcp->u_arg[3]);
break;
-#ifdef PTRACE_SETOPTIONS
case PTRACE_SETOPTIONS:
printflags(ptrace_setoptions_flags, tcp->u_arg[3], "PTRACE_O_???");
break;
-#endif
-#ifdef PTRACE_SETSIGINFO
case PTRACE_SETSIGINFO: {
printsiginfo_at(tcp, tcp->u_arg[3]);
break;
}
-#endif
-#ifdef PTRACE_GETSIGINFO
- case PTRACE_GETSIGINFO:
- /* Don't print anything, do it at syscall return. */
- break;
-#endif
-#ifdef PTRACE_GETREGSET
- case PTRACE_GETREGSET:
- break;
case PTRACE_SETREGSET:
tprint_iov(tcp, /*len:*/ 1, tcp->u_arg[3], /*as string:*/ 0);
break;
-#endif
+ case PTRACE_GETSIGINFO:
+ case PTRACE_GETREGSET:
+ /* Don't print anything, do it at syscall return. */
+ break;
default:
tprintf("%#lx", tcp->u_arg[3]);
break;
printnum(tcp, tcp->u_arg[3], "%#lx");
break;
#endif
-#ifdef PTRACE_GETSIGINFO
case PTRACE_GETSIGINFO: {
printsiginfo_at(tcp, tcp->u_arg[3]);
break;
}
-#endif
-#ifdef PTRACE_GETREGSET
case PTRACE_GETREGSET:
tprint_iov(tcp, /*len:*/ 1, tcp->u_arg[3], /*as string:*/ 0);
break;
-#endif
}
}
return 0;
--- /dev/null
+#ifdef NEED_PTRACE_PROTOTYPE_WORKAROUND
+# define ptrace xptrace
+# include <sys/ptrace.h>
+# undef ptrace
+extern long ptrace(int, int, char *, long);
+#else
+# include <sys/ptrace.h>
+#endif
+
+#ifdef HAVE_STRUCT_IA64_FPREG
+# define ia64_fpreg XXX_ia64_fpreg
+#endif
+#ifdef HAVE_STRUCT_PT_ALL_USER_REGS
+# define pt_all_user_regs XXX_pt_all_user_regs
+#endif
+#ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
+# define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
+#endif
+
+#include <linux/ptrace.h>
+
+#ifdef HAVE_STRUCT_IA64_FPREG
+# undef ia64_fpreg
+#endif
+#ifdef HAVE_STRUCT_PT_ALL_USER_REGS
+# undef pt_all_user_regs
+#endif
+#ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
+# undef ptrace_peeksiginfo_args
+#endif
+
+#ifndef PTRACE_EVENT_FORK
+# define PTRACE_EVENT_FORK 1
+#endif
+#ifndef PTRACE_EVENT_VFORK
+# define PTRACE_EVENT_VFORK 2
+#endif
+#ifndef PTRACE_EVENT_CLONE
+# define PTRACE_EVENT_CLONE 3
+#endif
+#ifndef PTRACE_EVENT_EXEC
+# define PTRACE_EVENT_EXEC 4
+#endif
+#ifndef PTRACE_EVENT_VFORK_DONE
+# define PTRACE_EVENT_VFORK_DONE 5
+#endif
+#ifndef PTRACE_EVENT_EXIT
+# define PTRACE_EVENT_EXIT 6
+#endif
+#ifndef PTRACE_EVENT_SECCOMP
+# define PTRACE_EVENT_SECCOMP 7
+#endif
+#ifndef PTRACE_EVENT_STOP
+# define PTRACE_EVENT_STOP 128
+#endif
+
+#ifndef PTRACE_O_TRACESYSGOOD
+# define PTRACE_O_TRACESYSGOOD 1
+#endif
+#ifndef PTRACE_O_TRACEFORK
+# define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK)
+#endif
+#ifndef PTRACE_O_TRACEVFORK
+# define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK)
+#endif
+#ifndef PTRACE_O_TRACECLONE
+# define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE)
+#endif
+#ifndef PTRACE_O_TRACEEXEC
+# define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
+#endif
+#ifndef PTRACE_O_TRACEVFORKDONE
+# define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
+#endif
+#ifndef PTRACE_O_TRACEEXIT
+# define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
+#endif
+#ifndef PTRACE_O_TRACESECCOMP
+# define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
+#endif
+#ifndef PTRACE_O_EXITKILL
+# define PTRACE_O_EXITKILL (1 << 20)
+#endif
+
+#ifndef PTRACE_SETOPTIONS
+# define PTRACE_SETOPTIONS 0x4200
+#endif
+#ifndef PTRACE_GETEVENTMSG
+# define PTRACE_GETEVENTMSG 0x4201
+#endif
+#ifndef PTRACE_GETSIGINFO
+# define PTRACE_GETSIGINFO 0x4202
+#endif
+#ifndef PTRACE_SETSIGINFO
+# define PTRACE_SETSIGINFO 0x4203
+#endif
+#ifndef PTRACE_GETREGSET
+# define PTRACE_GETREGSET 0x4204
+#endif
+#ifndef PTRACE_SETREGSET
+# define PTRACE_SETREGSET 0x4205
+#endif
+#ifndef PTRACE_SEIZE
+# define PTRACE_SEIZE 0x4206
+#endif
+#ifndef PTRACE_INTERRUPT
+# define PTRACE_INTERRUPT 0x4207
+#endif
+#ifndef PTRACE_LISTEN
+# define PTRACE_LISTEN 0x4208
+#endif
+#ifndef PTRACE_PEEKSIGINFO
+# define PTRACE_PEEKSIGINFO 0x4209
+#endif
+#ifndef PTRACE_GETSIGMASK
+# define PTRACE_GETSIGMASK 0x420a
+#endif
+#ifndef PTRACE_SETSIGMASK
+# define PTRACE_SETSIGMASK 0x420b
+#endif
+
+#if !HAVE_DECL_PTRACE_PEEKUSER
+# define PTRACE_PEEKUSER PTRACE_PEEKUSR
+#endif
+#if !HAVE_DECL_PTRACE_POKEUSER
+# define PTRACE_POKEUSER PTRACE_POKEUSR
+#endif
*/
#include "defs.h"
-#include <sys/user.h>
#include <fcntl.h>
+#include <sys/user.h>
#ifdef HAVE_SYS_REG_H
# include <sys/reg.h>
#endif
-#ifdef HAVE_LINUX_PTRACE_H
-# undef PTRACE_SYSCALL
-# ifdef HAVE_STRUCT_IA64_FPREG
-# define ia64_fpreg XXX_ia64_fpreg
-# endif
-# ifdef HAVE_STRUCT_PT_ALL_USER_REGS
-# define pt_all_user_regs XXX_pt_all_user_regs
-# endif
-# ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
-# define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
-# endif
-# include <linux/ptrace.h>
-# undef ptrace_peeksiginfo_args
-# undef ia64_fpreg
-# undef pt_all_user_regs
-#endif
+#include "ptrace.h"
#ifdef IA64
# include <asm/ptrace_offsets.h>
#if defined(IA64)
# include <asm/ptrace_offsets.h>
#endif
+
+#include "ptrace.h"
+
/* In some libc, these aren't declared. Do it ourself: */
extern char **environ;
extern int optind;
# include <sys/reg.h>
#endif
-#ifdef HAVE_LINUX_PTRACE_H
-# undef PTRACE_SYSCALL
-# ifdef HAVE_STRUCT_IA64_FPREG
-# define ia64_fpreg XXX_ia64_fpreg
-# endif
-# ifdef HAVE_STRUCT_PT_ALL_USER_REGS
-# define pt_all_user_regs XXX_pt_all_user_regs
-# endif
-# ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
-# define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
-# endif
-# include <linux/ptrace.h>
-# undef ptrace_peeksiginfo_args
-# undef ia64_fpreg
-# undef pt_all_user_regs
-#endif
+#include "ptrace.h"
#if defined(SPARC64)
# undef PTRACE_GETREGS
# include <elf.h>
#endif
-#if defined(AARCH64)
-# include <asm/ptrace.h>
-#endif
-
-#if defined(XTENSA)
-# include <asm/ptrace.h>
-#endif
-
#ifndef NSIG
# warning: NSIG is not defined, using 32
# define NSIG 32
# include <sys/reg.h>
#endif
-#ifdef HAVE_LINUX_PTRACE_H
-# undef PTRACE_SYSCALL
-# ifdef HAVE_STRUCT_IA64_FPREG
-# define ia64_fpreg XXX_ia64_fpreg
-# endif
-# ifdef HAVE_STRUCT_PT_ALL_USER_REGS
-# define pt_all_user_regs XXX_pt_all_user_regs
-# endif
-# ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
-# define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
-# endif
-# include <linux/ptrace.h>
-# undef ptrace_peeksiginfo_args
-# undef ia64_fpreg
-# undef pt_all_user_regs
-#endif
+#include "ptrace.h"
int
string_to_uint(const char *str)
# define W_CONTINUED 0xffff
#endif
+#include "ptrace.h"
#include "xlat/ptrace_events.h"
static int