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

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