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

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