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

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