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

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