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

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