diff --git a/include/ptrace.h b/include/ptrace.h index 61c3b6a7e..3bcc95163 100644 --- a/include/ptrace.h +++ b/include/ptrace.h @@ -27,6 +27,11 @@ struct ptrace_peeksiginfo_args { #define PTRACE_PEEKSIGINFO_SHARED (1 << 0) #endif +#ifndef PTRACE_GETREGSET +# define PTRACE_GETREGSET 0x4204 +# define PTRACE_SETREGSET 0x4205 +#endif + #define PTRACE_GETSIGMASK 0x420a #define PTRACE_SETSIGMASK 0x420b diff --git a/parasite-syscall.c b/parasite-syscall.c index b3644394a..e67b1c3e6 100644 --- a/parasite-syscall.c +++ b/parasite-syscall.c @@ -30,6 +30,7 @@ #include #include +#include #include "asm/parasite-syscall.h" #include "asm/dump.h" @@ -67,12 +68,20 @@ static struct vma_area *get_vma_by_ip(struct list_head *vma_area_list, unsigned static inline int ptrace_get_regs(int pid, user_regs_struct_t *regs) { - return ptrace(PTRACE_GETREGS, pid, NULL, regs); + struct iovec iov; + + iov.iov_base = regs; + iov.iov_len = sizeof(user_regs_struct_t); + return ptrace(PTRACE_GETREGSET, pid, NT_PRSTATUS, &iov); } static inline int ptrace_set_regs(int pid, user_regs_struct_t *regs) { - return ptrace(PTRACE_SETREGS, pid, NULL, regs); + struct iovec iov; + + iov.iov_base = regs; + iov.iov_len = sizeof(user_regs_struct_t); + return ptrace(PTRACE_SETREGSET, pid, NT_PRSTATUS, &iov); } static int get_thread_ctx(int pid, struct thread_ctx *ctx)