diff --git a/defs.h b/defs.h index c421e763..9345a045 100644 --- a/defs.h +++ b/defs.h @@ -437,6 +437,8 @@ extern bool get_instruction_pointer(struct tcb *, kernel_ulong_t *); extern bool get_stack_pointer(struct tcb *, kernel_ulong_t *); extern void print_instruction_pointer(struct tcb *); +extern void print_syscall_resume(struct tcb *tcp); + extern int syscall_entering_decode(struct tcb *); extern int syscall_entering_trace(struct tcb *, unsigned int *); extern void syscall_entering_finish(struct tcb *, int); diff --git a/strace.c b/strace.c index 931d2f77..84d51958 100644 --- a/strace.c +++ b/strace.c @@ -2191,12 +2191,7 @@ print_event_exit(struct tcb *tcp) set_current_tcp(tcp); } - if ((followfork < 2 && printing_tcp != tcp) - || (tcp->flags & TCB_REPRINT)) { - tcp->flags &= ~TCB_REPRINT; - printleader(tcp); - tprintf("<... %s resumed>", tcp->s_ent->sys_name); - } + print_syscall_resume(tcp); if (!(tcp->sys_func_rval & RVAL_DECODED)) { /* diff --git a/syscall.c b/syscall.c index 51fcc721..d770e861 100644 --- a/syscall.c +++ b/syscall.c @@ -688,6 +688,26 @@ syscall_exiting_decode(struct tcb *tcp, struct timespec *pts) return get_syscall_result(tcp); } +void +print_syscall_resume(struct tcb *tcp) +{ + /* If not in -ff mode, and printing_tcp != tcp, + * then the log currently does not end with output + * of _our syscall entry_, but with something else. + * We need to say which syscall's return is this. + * + * Forced reprinting via TCB_REPRINT is used only by + * "strace -ff -oLOG test/threaded_execve" corner case. + * It's the only case when -ff mode needs reprinting. + */ + if ((followfork < 2 && printing_tcp != tcp) + || (tcp->flags & TCB_REPRINT)) { + tcp->flags &= ~TCB_REPRINT; + printleader(tcp); + tprintf("<... %s resumed>", tcp->s_ent->sys_name); + } +} + int syscall_exiting_trace(struct tcb *tcp, struct timespec *ts, int res) { @@ -701,20 +721,7 @@ syscall_exiting_trace(struct tcb *tcp, struct timespec *ts, int res) } } - /* If not in -ff mode, and printing_tcp != tcp, - * then the log currently does not end with output - * of _our syscall entry_, but with something else. - * We need to say which syscall's return is this. - * - * Forced reprinting via TCB_REPRINT is used only by - * "strace -ff -oLOG test/threaded_execve" corner case. - * It's the only case when -ff mode needs reprinting. - */ - if ((followfork < 2 && printing_tcp != tcp) || (tcp->flags & TCB_REPRINT)) { - tcp->flags &= ~TCB_REPRINT; - printleader(tcp); - tprintf("<... %s resumed> ", tcp->s_ent->sys_name); - } + print_syscall_resume(tcp); printing_tcp = tcp; tcp->s_prev_ent = NULL; diff --git a/tests/threads-execve.c b/tests/threads-execve.c index 8921201f..ec81722b 100644 --- a/tests/threads-execve.c +++ b/tests/threads-execve.c @@ -141,7 +141,7 @@ thread(void *arg) } printf("%-5d +++ superseded by execve in pid %u +++\n" - "%-5d <... execve resumed> ) = 0\n", + "%-5d <... execve resumed>) = 0\n", leader, tid, leader);