All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] linux-user: Improve strace output of pread64() and pwrite64()
@ 2023-01-27 20:58 Helge Deller
  2023-01-27 22:56 ` Richard Henderson
  2023-01-30  9:26 ` Laurent Vivier
  0 siblings, 2 replies; 7+ messages in thread
From: Helge Deller @ 2023-01-27 20:58 UTC (permalink / raw)
  To: Helge Deller; +Cc: Laurent Vivier, qemu-devel

Make the strace look nicer for those two syscalls.

Signed-off-by: Helge Deller <deller@gmx.de>
---
v2: Use regpairs_aligned() and target_offset64(), noticed by Laurent Vivier

diff --git a/linux-user/strace.c b/linux-user/strace.c
index 82dc1a1e20..379536f5c9 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -3824,6 +3824,25 @@ print_rlimit64(abi_ulong rlim_addr, int last)
     }
 }

+#if defined(TARGET_NR_pread64) || defined(TARGET_NR_pwrite64)
+static void
+print_preadwrite64(CPUArchState *cpu_env, const struct syscallname *name,
+           abi_long arg0, abi_long arg1, abi_long arg2,
+           abi_long arg3, abi_long arg4, abi_long arg5)
+{
+    if (regpairs_aligned(cpu_env, TARGET_NR_pread64)) {
+        arg3 = arg4;
+        arg4 = arg5;
+    }
+    print_syscall_prologue(name);
+    print_raw_param("%d", arg0, 0);
+    print_pointer(arg1, 0);
+    print_raw_param("%d", arg2, 0);
+    qemu_log("%lld", (long long)target_offset64(arg3, arg4));
+    print_syscall_epilogue(name);
+}
+#endif
+
 static void
 print_prlimit64(CPUArchState *cpu_env, const struct syscallname *name,
            abi_long arg0, abi_long arg1, abi_long arg2,
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 909298099e..4ae60e5e87 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1061,7 +1061,7 @@
 { TARGET_NR_prctl, "prctl" , NULL, NULL, NULL },
 #endif
 #ifdef TARGET_NR_pread64
-{ TARGET_NR_pread64, "pread64" , NULL, NULL, NULL },
+{ TARGET_NR_pread64, "pread64" , NULL, print_preadwrite64, NULL },
 #endif
 #ifdef TARGET_NR_preadv
 { TARGET_NR_preadv, "preadv" , NULL, NULL, NULL },
@@ -1092,7 +1092,7 @@
 { TARGET_NR_putpmsg, "putpmsg" , NULL, NULL, NULL },
 #endif
 #ifdef TARGET_NR_pwrite64
-{ TARGET_NR_pwrite64, "pwrite64" , NULL, NULL, NULL },
+{ TARGET_NR_pwrite64, "pwrite64" , NULL, print_preadwrite64, NULL },
 #endif
 #ifdef TARGET_NR_pwritev
 { TARGET_NR_pwritev, "pwritev" , NULL, NULL, NULL },


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-01-31 15:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-27 20:58 [PATCH v2] linux-user: Improve strace output of pread64() and pwrite64() Helge Deller
2023-01-27 22:56 ` Richard Henderson
2023-01-30  9:26 ` Laurent Vivier
2023-01-30 22:11   ` Helge Deller
2023-01-31 11:04     ` Laurent Vivier
2023-01-31 13:08       ` Helge Deller
2023-01-31 15:05         ` Laurent Vivier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.