#include "xlat/nt_descriptor_types.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
-
-#if defined(SPARC64)
-# define r_pc r_tpc
-# undef PTRACE_GETREGS
-# define PTRACE_GETREGS PTRACE_GETREGS64
-# undef PTRACE_SETREGS
-# define PTRACE_SETREGS PTRACE_SETREGS64
-#endif
-
+#include "regs.h"
+#include "ptrace.h"
#include "xlat/ptrace_cmds.h"
#include "xlat/ptrace_setoptions_flags.h"
-#if defined(IA64)
-# include <asm/ptrace_offsets.h>
-# include <asm/rse.h>
-#endif
-
#define uoff(member) offsetof(struct user, member)
#define XLAT_UOFF(member) { uoff(member), "offsetof(struct user, " #member ")" }
XLAT_END
};
-int
-sys_ptrace(struct tcb *tcp)
+SYS_FUNC(ptrace)
{
const struct xlat *x;
unsigned long addr;
break;
}
if (!x->str)
- tprintf("%#lx, ", addr);
+ printaddr(addr);
else if (x->val > addr && x != struct_user_offsets) {
x--;
- tprintf("%s + %ld, ", x->str, addr - x->val);
+ tprintf("%s + %ld", x->str, addr - x->val);
}
else
- tprintf("%s, ", x->str);
+ tprints(x->str);
} else
-#ifdef PTRACE_GETREGSET
if (tcp->u_arg[0] == PTRACE_GETREGSET
- || tcp->u_arg[0] == PTRACE_SETREGSET
- ) {
+ || tcp->u_arg[0] == PTRACE_SETREGSET)
printxval(nt_descriptor_types, tcp->u_arg[2], "NT_???");
- tprints(", ");
- } else
-#endif
- tprintf("%#lx, ", addr);
-
+ else
+ printaddr(addr);
+ tprints(", ");
switch (tcp->u_arg[0]) {
#ifndef IA64
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]);
+ printaddr(tcp->u_arg[3]);
break;
}
} else {
#ifdef IA64
return RVAL_HEX;
#else
- printnum(tcp, tcp->u_arg[3], "%#lx");
+ printnum_long(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;