From f05ea48c0af41aefec608bc9c4c6ad9ab1ba25ba Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sun, 24 Dec 2017 16:07:18 +0000 Subject: [PATCH] syscall: move get_regs call from syscall_exiting_decode to get_syscall_result This make the code less confusing and opens the way for future changes related to get_regs. * syscall.c (syscall_exiting_decode): Move get_regs invocation ... (get_syscall_result) [ptrace_getregset_or_getregs]: ... here. --- syscall.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/syscall.c b/syscall.c index 7f914661..65d43e1b 100644 --- a/syscall.c +++ b/syscall.c @@ -755,7 +755,7 @@ syscall_exiting_decode(struct tcb *tcp, struct timeval *ptv) update_personality(tcp, tcp->currpers); #endif - return get_regs(tcp->pid) < 0 ? -1 : get_syscall_result(tcp); + return get_syscall_result(tcp); } int @@ -1236,7 +1236,10 @@ static int get_syscall_result_regs(struct tcb *); static int get_syscall_result(struct tcb *tcp) { -#ifndef ptrace_getregset_or_getregs +#ifdef ptrace_getregset_or_getregs + if (get_regs(tcp->pid) < 0) + return -1; +#else if (get_syscall_result_regs(tcp)) return -1; #endif