]> granicus.if.org Git - strace/commitdiff
Merge "<... resumed>" printing
authorEugene Syromyatnikov <evgsyr@gmail.com>
Tue, 29 Jan 2019 12:54:23 +0000 (13:54 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 9 Feb 2019 22:44:40 +0000 (22:44 +0000)
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.

defs.h
strace.c
syscall.c
tests/threads-execve.c

diff --git a/defs.h b/defs.h
index f8db6124cf9128f443c8962b666743aa5e947d15..1f231d3460dd35837f7a99f11469e2e83c1a3eb8 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -427,6 +427,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);
index cdaafa87f6815ad92d6439ebf5aa8fb72cb49ce4..6413297ff3d2c7b7cd3f7f3b2d4d5e76831e3635 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -2181,12 +2181,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)) {
                /*
index 51fcc721968cd90d8070f8f64b02e7cdc305a328..d770e861d0e1db9fc4e975b92662f6da0ba40d7d 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -688,19 +688,9 @@ syscall_exiting_decode(struct tcb *tcp, struct timespec *pts)
        return get_syscall_result(tcp);
 }
 
-int
-syscall_exiting_trace(struct tcb *tcp, struct timespec *ts, int res)
+void
+print_syscall_resume(struct tcb *tcp)
 {
-       if (syscall_tampered(tcp) || inject_delay_exit(tcp))
-               tamper_with_syscall_exiting(tcp);
-
-       if (cflag) {
-               count_syscall(tcp, ts);
-               if (cflag == CFLAG_ONLY_STATS) {
-                       return 0;
-               }
-       }
-
        /* 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.
@@ -710,11 +700,28 @@ syscall_exiting_trace(struct tcb *tcp, struct timespec *ts, int res)
         * "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)) {
+       if ((followfork < 2 && printing_tcp != tcp)
+           || (tcp->flags & TCB_REPRINT)) {
                tcp->flags &= ~TCB_REPRINT;
                printleader(tcp);
-               tprintf("<... %s resumed> ", tcp->s_ent->sys_name);
+               tprintf("<... %s resumed>", tcp->s_ent->sys_name);
+       }
+}
+
+int
+syscall_exiting_trace(struct tcb *tcp, struct timespec *ts, int res)
+{
+       if (syscall_tampered(tcp) || inject_delay_exit(tcp))
+               tamper_with_syscall_exiting(tcp);
+
+       if (cflag) {
+               count_syscall(tcp, ts);
+               if (cflag == CFLAG_ONLY_STATS) {
+                       return 0;
+               }
        }
+
+       print_syscall_resume(tcp);
        printing_tcp = tcp;
 
        tcp->s_prev_ent = NULL;
index 8921201f1fbf077e5d11041acd66926cd5d6be4d..ec81722b882665eb7eebc0b86c2dac27eb9909bb 100644 (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);