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

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