Blame SOURCES/ltrace-0.7.91-s390-fetch-syscall.patch

0c51c6
@@ -, +, @@ 
0c51c6
   exe->mount("source", "target", "filesystemtype", 0, nil <unfinished ...>
0c51c6
   mount@SYS("", "target", "filesystemtype", 0, nil)                 = -2
0c51c6
   <... mount resumed>                                               = -1
0c51c6
---
0c51c6
 sysdeps/linux-gnu/s390/fetch.c |   17 ++++++++++++-----
0c51c6
 1 files changed, 12 insertions(+), 5 deletions(-)
0c51c6
--- a/sysdeps/linux-gnu/s390/fetch.c	
0c51c6
+++ a/sysdeps/linux-gnu/s390/fetch.c	
0c51c6
@@ -23,6 +23,7 @@ 
0c51c6
 #include <sys/ucontext.h>
0c51c6
 #include <assert.h>
0c51c6
 #include <errno.h>
0c51c6
+#include <stdbool.h>
0c51c6
 #include <stdio.h>
0c51c6
 #include <stdlib.h>
0c51c6
 #include <string.h>
0c51c6
@@ -61,7 +62,8 @@ s390x(struct fetch_context *ctx)
0c51c6
 }
0c51c6
 
0c51c6
 static int
0c51c6
-fetch_register_banks(struct process *proc, struct fetch_context *ctx)
0c51c6
+fetch_register_banks(struct process *proc, struct fetch_context *ctx,
0c51c6
+		     bool syscall_enter)
0c51c6
 {
0c51c6
 	ptrace_area parea;
0c51c6
 	parea.len = sizeof(ctx->regs);
0c51c6
@@ -72,15 +74,20 @@ fetch_register_banks(struct process *proc, struct fetch_context *ctx)
0c51c6
 			strerror(errno));
0c51c6
 		return -1;
0c51c6
 	}
0c51c6
+
0c51c6
+	if (syscall_enter)
0c51c6
+		ctx->regs.gprs[2] = ctx->regs.orig_gpr2;
0c51c6
+
0c51c6
 	return 0;
0c51c6
 }
0c51c6
 
0c51c6
 static int
0c51c6
-fetch_context_init(struct process *proc, struct fetch_context *context)
0c51c6
+fetch_context_init(struct process *proc, struct fetch_context *context,
0c51c6
+		   bool syscall_enter)
0c51c6
 {
0c51c6
 	context->greg = 2;
0c51c6
 	context->freg = 0;
0c51c6
-	return fetch_register_banks(proc, context);
0c51c6
+	return fetch_register_banks(proc, context, syscall_enter);
0c51c6
 }
0c51c6
 
0c51c6
 struct fetch_context *
0c51c6
@@ -89,7 +96,7 @@ arch_fetch_arg_init(enum tof type, struct process *proc,
0c51c6
 {
0c51c6
 	struct fetch_context *context = malloc(sizeof(*context));
0c51c6
 	if (context == NULL
0c51c6
-	    || fetch_context_init(proc, context) < 0) {
0c51c6
+	    || fetch_context_init(proc, context, type == LT_TOF_SYSCALL) < 0) {
0c51c6
 		fprintf(stderr, "arch_fetch_arg_init: %s\n",
0c51c6
 			strerror(errno));
0c51c6
 		free(context);
0c51c6
@@ -277,7 +284,7 @@ arch_fetch_retval(struct fetch_context *ctx, enum tof type,
0c51c6
 		return 0;
0c51c6
 	}
0c51c6
 
0c51c6
-	if (fetch_context_init(proc, ctx) < 0)
0c51c6
+	if (fetch_context_init(proc, ctx, false) < 0)
0c51c6
 		return -1;
0c51c6
 	return arch_fetch_arg_next(ctx, type, proc, info, valuep);
0c51c6
 }
0c51c6
--