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

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