Merge "<... resumed>" printing

Apparently, it was slightly different with no apparent reason. Use
a single routine to print this message now.

* defs.h (print_syscall_resume): New function declaration.
* strace.c (print_event_exit): Replace open-coding of "<... resumed>"
message printing with a print_syscall_resume() call.
* syscall.c (syscall_exiting_trace): Likewise.
(print_syscall_resume): New function.
* tests/threads-execve.c: Update expected output.
This commit is contained in:
Eugene Syromyatnikov 2019-01-29 13:54:23 +01:00
parent 756ccfa00b
commit fc6c6578dc
4 changed files with 25 additions and 21 deletions

2
defs.h
View File

@ -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);

View File

@ -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)) {
/*

View File

@ -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;

View File

@ -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);