212 lines
8.1 KiB
Diff
212 lines
8.1 KiB
Diff
From 8967985c6fedf1b0545f81d48c5c232718eb47d2 Mon Sep 17 00:00:00 2001
|
|
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
|
Date: Tue, 29 Jan 2019 13:54:23 +0100
|
|
Subject: [PATCH 17/27] 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.
|
|
|
|
Additional changes:
|
|
tests-m32/threads-execve.c (copy of tests/threads-execve.c)
|
|
tests-mx32/threads-execve.c (copy of tests/threads-execve.c)
|
|
|
|
---
|
|
defs.h | 2 ++
|
|
strace.c | 7 +------
|
|
syscall.c | 35 +++++++++++++++++++++--------------
|
|
tests/threads-execve.c | 2 +-
|
|
4 files changed, 25 insertions(+), 21 deletions(-)
|
|
|
|
Index: strace-4.24/defs.h
|
|
===================================================================
|
|
--- strace-4.24.orig/defs.h 2019-03-10 05:34:58.570075352 +0100
|
|
+++ strace-4.24/defs.h 2019-03-10 05:39:18.611471380 +0100
|
|
@@ -408,6 +408,8 @@
|
|
extern void set_overhead(int);
|
|
extern void print_pc(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: strace-4.24/strace.c
|
|
===================================================================
|
|
--- strace-4.24.orig/strace.c 2019-03-10 05:34:58.570075352 +0100
|
|
+++ strace-4.24/strace.c 2019-03-10 05:39:18.612471370 +0100
|
|
@@ -2191,12 +2191,7 @@
|
|
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: strace-4.24/syscall.c
|
|
===================================================================
|
|
--- strace-4.24.orig/syscall.c 2019-03-10 05:34:58.570075352 +0100
|
|
+++ strace-4.24/syscall.c 2019-03-10 05:39:18.613471360 +0100
|
|
@@ -722,19 +722,9 @@
|
|
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.
|
|
@@ -744,11 +734,28 @@
|
|
* "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: strace-4.24/tests/threads-execve.c
|
|
===================================================================
|
|
--- strace-4.24.orig/tests/threads-execve.c 2019-03-10 05:34:58.570075352 +0100
|
|
+++ strace-4.24/tests/threads-execve.c 2019-03-10 05:39:18.613471360 +0100
|
|
@@ -141,7 +141,7 @@
|
|
}
|
|
|
|
printf("%-5d +++ superseded by execve in pid %u +++\n"
|
|
- "%-5d <... execve resumed> ) = 0\n",
|
|
+ "%-5d <... execve resumed>) = 0\n",
|
|
leader, tid,
|
|
leader);
|
|
|
|
Index: strace-4.24/tests-m32/threads-execve.c
|
|
===================================================================
|
|
--- strace-4.24.orig/tests-m32/threads-execve.c 2017-05-22 19:33:51.000000000 +0200
|
|
+++ strace-4.24/tests-m32/threads-execve.c 2019-03-10 05:39:41.348243702 +0100
|
|
@@ -5,27 +5,7 @@
|
|
* Copyright (c) 2016-2017 The strace developers.
|
|
* All rights reserved.
|
|
*
|
|
- * Redistribution and use in source and binary forms, with or without
|
|
- * modification, are permitted provided that the following conditions
|
|
- * are met:
|
|
- * 1. Redistributions of source code must retain the above copyright
|
|
- * notice, this list of conditions and the following disclaimer.
|
|
- * 2. Redistributions in binary form must reproduce the above copyright
|
|
- * notice, this list of conditions and the following disclaimer in the
|
|
- * documentation and/or other materials provided with the distribution.
|
|
- * 3. The name of the author may not be used to endorse or promote products
|
|
- * derived from this software without specific prior written permission.
|
|
- *
|
|
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
+ * SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#include "tests.h"
|
|
@@ -161,7 +141,7 @@
|
|
}
|
|
|
|
printf("%-5d +++ superseded by execve in pid %u +++\n"
|
|
- "%-5d <... execve resumed> ) = 0\n",
|
|
+ "%-5d <... execve resumed>) = 0\n",
|
|
leader, tid,
|
|
leader);
|
|
|
|
Index: strace-4.24/tests-mx32/threads-execve.c
|
|
===================================================================
|
|
--- strace-4.24.orig/tests-mx32/threads-execve.c 2017-05-22 19:33:51.000000000 +0200
|
|
+++ strace-4.24/tests-mx32/threads-execve.c 2019-03-10 05:39:43.817218978 +0100
|
|
@@ -5,27 +5,7 @@
|
|
* Copyright (c) 2016-2017 The strace developers.
|
|
* All rights reserved.
|
|
*
|
|
- * Redistribution and use in source and binary forms, with or without
|
|
- * modification, are permitted provided that the following conditions
|
|
- * are met:
|
|
- * 1. Redistributions of source code must retain the above copyright
|
|
- * notice, this list of conditions and the following disclaimer.
|
|
- * 2. Redistributions in binary form must reproduce the above copyright
|
|
- * notice, this list of conditions and the following disclaimer in the
|
|
- * documentation and/or other materials provided with the distribution.
|
|
- * 3. The name of the author may not be used to endorse or promote products
|
|
- * derived from this software without specific prior written permission.
|
|
- *
|
|
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
+ * SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#include "tests.h"
|
|
@@ -161,7 +141,7 @@
|
|
}
|
|
|
|
printf("%-5d +++ superseded by execve in pid %u +++\n"
|
|
- "%-5d <... execve resumed> ) = 0\n",
|
|
+ "%-5d <... execve resumed>) = 0\n",
|
|
leader, tid,
|
|
leader);
|
|
|