Blame SOURCES/0017-Merge-.-resumed-printing.patch

4d44fe
From 8967985c6fedf1b0545f81d48c5c232718eb47d2 Mon Sep 17 00:00:00 2001
4d44fe
From: Eugene Syromyatnikov <evgsyr@gmail.com>
4d44fe
Date: Tue, 29 Jan 2019 13:54:23 +0100
4d44fe
Subject: [PATCH 17/27] Merge "<... resumed>" printing
4d44fe
4d44fe
Apparently, it was slightly different with no apparent reason.
4d44fe
Use a single routine to print this message now.
4d44fe
4d44fe
* defs.h (print_syscall_resume): New function declaration.
4d44fe
* strace.c (print_event_exit): Replace open-coding of "<... resumed>"
4d44fe
message printing with a print_syscall_resume() call.
4d44fe
* syscall.c (syscall_exiting_trace): Likewise.
4d44fe
(print_syscall_resume): New function.
4d44fe
* tests/threads-execve.c: Update expected output.
4d44fe
4d44fe
Additional changes:
4d44fe
	tests-m32/threads-execve.c (copy of tests/threads-execve.c)
4d44fe
	tests-mx32/threads-execve.c (copy of tests/threads-execve.c)
4d44fe
4d44fe
---
4d44fe
 defs.h                 |  2 ++
4d44fe
 strace.c               |  7 +------
4d44fe
 syscall.c              | 35 +++++++++++++++++++++--------------
4d44fe
 tests/threads-execve.c |  2 +-
4d44fe
 4 files changed, 25 insertions(+), 21 deletions(-)
4d44fe
4d44fe
Index: strace-4.24/defs.h
4d44fe
===================================================================
4d44fe
--- strace-4.24.orig/defs.h	2019-03-10 05:34:58.570075352 +0100
4d44fe
+++ strace-4.24/defs.h	2019-03-10 05:39:18.611471380 +0100
4d44fe
@@ -408,6 +408,8 @@
4d44fe
 extern void set_overhead(int);
4d44fe
 extern void print_pc(struct tcb *);
4d44fe
 
4d44fe
+extern void print_syscall_resume(struct tcb *tcp);
4d44fe
+
4d44fe
 extern int syscall_entering_decode(struct tcb *);
4d44fe
 extern int syscall_entering_trace(struct tcb *, unsigned int *);
4d44fe
 extern void syscall_entering_finish(struct tcb *, int);
4d44fe
Index: strace-4.24/strace.c
4d44fe
===================================================================
4d44fe
--- strace-4.24.orig/strace.c	2019-03-10 05:34:58.570075352 +0100
4d44fe
+++ strace-4.24/strace.c	2019-03-10 05:39:18.612471370 +0100
4d44fe
@@ -2191,12 +2191,7 @@
4d44fe
 		set_current_tcp(tcp);
4d44fe
 	}
4d44fe
 
4d44fe
-	if ((followfork < 2 && printing_tcp != tcp)
4d44fe
-	    || (tcp->flags & TCB_REPRINT)) {
4d44fe
-		tcp->flags &= ~TCB_REPRINT;
4d44fe
-		printleader(tcp);
4d44fe
-		tprintf("<... %s resumed>", tcp->s_ent->sys_name);
4d44fe
-	}
4d44fe
+	print_syscall_resume(tcp);
4d44fe
 
4d44fe
 	if (!(tcp->sys_func_rval & RVAL_DECODED)) {
4d44fe
 		/*
4d44fe
Index: strace-4.24/syscall.c
4d44fe
===================================================================
4d44fe
--- strace-4.24.orig/syscall.c	2019-03-10 05:34:58.570075352 +0100
4d44fe
+++ strace-4.24/syscall.c	2019-03-10 05:39:18.613471360 +0100
4d44fe
@@ -722,19 +722,9 @@
4d44fe
 	return get_syscall_result(tcp);
4d44fe
 }
4d44fe
 
4d44fe
-int
4d44fe
-syscall_exiting_trace(struct tcb *tcp, struct timespec *ts, int res)
4d44fe
+void
4d44fe
+print_syscall_resume(struct tcb *tcp)
4d44fe
 {
4d44fe
-	if (syscall_tampered(tcp) || inject_delay_exit(tcp))
4d44fe
-		tamper_with_syscall_exiting(tcp);
4d44fe
-
4d44fe
-	if (cflag) {
4d44fe
-		count_syscall(tcp, ts);
4d44fe
-		if (cflag == CFLAG_ONLY_STATS) {
4d44fe
-			return 0;
4d44fe
-		}
4d44fe
-	}
4d44fe
-
4d44fe
 	/* If not in -ff mode, and printing_tcp != tcp,
4d44fe
 	 * then the log currently does not end with output
4d44fe
 	 * of _our syscall entry_, but with something else.
4d44fe
@@ -744,11 +734,28 @@
4d44fe
 	 * "strace -ff -oLOG test/threaded_execve" corner case.
4d44fe
 	 * It's the only case when -ff mode needs reprinting.
4d44fe
 	 */
4d44fe
-	if ((followfork < 2 && printing_tcp != tcp) || (tcp->flags & TCB_REPRINT)) {
4d44fe
+	if ((followfork < 2 && printing_tcp != tcp)
4d44fe
+	    || (tcp->flags & TCB_REPRINT)) {
4d44fe
 		tcp->flags &= ~TCB_REPRINT;
4d44fe
 		printleader(tcp);
4d44fe
-		tprintf("<... %s resumed> ", tcp->s_ent->sys_name);
4d44fe
+		tprintf("<... %s resumed>", tcp->s_ent->sys_name);
4d44fe
 	}
4d44fe
+}
4d44fe
+
4d44fe
+int
4d44fe
+syscall_exiting_trace(struct tcb *tcp, struct timespec *ts, int res)
4d44fe
+{
4d44fe
+	if (syscall_tampered(tcp) || inject_delay_exit(tcp))
4d44fe
+		tamper_with_syscall_exiting(tcp);
4d44fe
+
4d44fe
+	if (cflag) {
4d44fe
+		count_syscall(tcp, ts);
4d44fe
+		if (cflag == CFLAG_ONLY_STATS) {
4d44fe
+			return 0;
4d44fe
+		}
4d44fe
+	}
4d44fe
+
4d44fe
+	print_syscall_resume(tcp);
4d44fe
 	printing_tcp = tcp;
4d44fe
 
4d44fe
 	tcp->s_prev_ent = NULL;
4d44fe
Index: strace-4.24/tests/threads-execve.c
4d44fe
===================================================================
4d44fe
--- strace-4.24.orig/tests/threads-execve.c	2019-03-10 05:34:58.570075352 +0100
4d44fe
+++ strace-4.24/tests/threads-execve.c	2019-03-10 05:39:18.613471360 +0100
4d44fe
@@ -141,7 +141,7 @@
4d44fe
 	}
4d44fe
 
4d44fe
 	printf("%-5d +++ superseded by execve in pid %u +++\n"
4d44fe
-	       "%-5d <... execve resumed> ) = 0\n",
4d44fe
+	       "%-5d <... execve resumed>) = 0\n",
4d44fe
 	       leader, tid,
4d44fe
 	       leader);
4d44fe
 
4d44fe
Index: strace-4.24/tests-m32/threads-execve.c
4d44fe
===================================================================
4d44fe
--- strace-4.24.orig/tests-m32/threads-execve.c	2017-05-22 19:33:51.000000000 +0200
4d44fe
+++ strace-4.24/tests-m32/threads-execve.c	2019-03-10 05:39:41.348243702 +0100
4d44fe
@@ -5,27 +5,7 @@
4d44fe
  * Copyright (c) 2016-2017 The strace developers.
4d44fe
  * All rights reserved.
4d44fe
  *
4d44fe
- * Redistribution and use in source and binary forms, with or without
4d44fe
- * modification, are permitted provided that the following conditions
4d44fe
- * are met:
4d44fe
- * 1. Redistributions of source code must retain the above copyright
4d44fe
- *    notice, this list of conditions and the following disclaimer.
4d44fe
- * 2. Redistributions in binary form must reproduce the above copyright
4d44fe
- *    notice, this list of conditions and the following disclaimer in the
4d44fe
- *    documentation and/or other materials provided with the distribution.
4d44fe
- * 3. The name of the author may not be used to endorse or promote products
4d44fe
- *    derived from this software without specific prior written permission.
4d44fe
- *
4d44fe
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
4d44fe
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
4d44fe
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
4d44fe
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
4d44fe
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
4d44fe
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4d44fe
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4d44fe
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4d44fe
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
4d44fe
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4d44fe
+ * SPDX-License-Identifier: GPL-2.0-or-later
4d44fe
  */
4d44fe
 
4d44fe
 #include "tests.h"
4d44fe
@@ -161,7 +141,7 @@
4d44fe
 	}
4d44fe
 
4d44fe
 	printf("%-5d +++ superseded by execve in pid %u +++\n"
4d44fe
-	       "%-5d <... execve resumed> ) = 0\n",
4d44fe
+	       "%-5d <... execve resumed>) = 0\n",
4d44fe
 	       leader, tid,
4d44fe
 	       leader);
4d44fe
 
4d44fe
Index: strace-4.24/tests-mx32/threads-execve.c
4d44fe
===================================================================
4d44fe
--- strace-4.24.orig/tests-mx32/threads-execve.c	2017-05-22 19:33:51.000000000 +0200
4d44fe
+++ strace-4.24/tests-mx32/threads-execve.c	2019-03-10 05:39:43.817218978 +0100
4d44fe
@@ -5,27 +5,7 @@
4d44fe
  * Copyright (c) 2016-2017 The strace developers.
4d44fe
  * All rights reserved.
4d44fe
  *
4d44fe
- * Redistribution and use in source and binary forms, with or without
4d44fe
- * modification, are permitted provided that the following conditions
4d44fe
- * are met:
4d44fe
- * 1. Redistributions of source code must retain the above copyright
4d44fe
- *    notice, this list of conditions and the following disclaimer.
4d44fe
- * 2. Redistributions in binary form must reproduce the above copyright
4d44fe
- *    notice, this list of conditions and the following disclaimer in the
4d44fe
- *    documentation and/or other materials provided with the distribution.
4d44fe
- * 3. The name of the author may not be used to endorse or promote products
4d44fe
- *    derived from this software without specific prior written permission.
4d44fe
- *
4d44fe
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
4d44fe
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
4d44fe
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
4d44fe
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
4d44fe
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
4d44fe
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4d44fe
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4d44fe
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4d44fe
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
4d44fe
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4d44fe
+ * SPDX-License-Identifier: GPL-2.0-or-later
4d44fe
  */
4d44fe
 
4d44fe
 #include "tests.h"
4d44fe
@@ -161,7 +141,7 @@
4d44fe
 	}
4d44fe
 
4d44fe
 	printf("%-5d +++ superseded by execve in pid %u +++\n"
4d44fe
-	       "%-5d <... execve resumed> ) = 0\n",
4d44fe
+	       "%-5d <... execve resumed>) = 0\n",
4d44fe
 	       leader, tid,
4d44fe
 	       leader);
4d44fe