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

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