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

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