[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/28] linux-user: Provide print_raw_param64() for 64-bit values
From: |
Laurent Vivier |
Subject: |
[PULL 08/28] linux-user: Provide print_raw_param64() for 64-bit values |
Date: |
Fri, 10 Mar 2023 23:09:07 +0100 |
From: Helge Deller <deller@gmx.de>
Add a new function print_raw_param64() to print 64-bit values in the
same way as print_raw_param(). This prevents that qemu_log() is used to
work around the problem that print_raw_param() can only print 32-bit
values when compiled for 32-bit targets.
Additionally convert the existing 64-bit users in print_timespec64(),
print_rlimit64() and print_preadwrite64() over to this new function and
drop some unneccessary spaces.
Suggested-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <Y9lNbFNyRSUhhrHa@p100>
[lvivier: remove print_preadwrite64 and print_rlimit64 part]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/strace.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 340010661c4f..5218e3fc33ac 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -81,6 +81,7 @@ UNUSED static void print_syscall_epilogue(const struct
syscallname *);
UNUSED static void print_string(abi_long, int);
UNUSED static void print_buf(abi_long addr, abi_long len, int last);
UNUSED static void print_raw_param(const char *, abi_long, int);
+UNUSED static void print_raw_param64(const char *, long long, int last);
UNUSED static void print_timeval(abi_ulong, int);
UNUSED static void print_timespec(abi_ulong, int);
UNUSED static void print_timespec64(abi_ulong, int);
@@ -1642,6 +1643,19 @@ print_raw_param(const char *fmt, abi_long param, int
last)
qemu_log(format, param);
}
+/*
+ * Same as print_raw_param() but prints out raw 64-bit parameter.
+ */
+static void
+print_raw_param64(const char *fmt, long long param, int last)
+{
+ char format[64];
+
+ (void)snprintf(format, sizeof(format), "%s%s", fmt, get_comma(last));
+ qemu_log(format, param);
+}
+
+
static void
print_pointer(abi_long p, int last)
{
@@ -1718,10 +1732,8 @@ print_timespec64(abi_ulong ts_addr, int last)
print_pointer(ts_addr, last);
return;
}
- qemu_log("{tv_sec = %lld"
- ",tv_nsec = %lld}%s",
- (long long)tswap64(ts->tv_sec), (long
long)tswap64(ts->tv_nsec),
- get_comma(last));
+ print_raw_param64("{tv_sec=%" PRId64, tswap64(ts->tv_sec), 0);
+ print_raw_param64("tv_nsec=%" PRId64 "}", tswap64(ts->tv_nsec), last);
unlock_user(ts, ts_addr, 0);
} else {
qemu_log("NULL%s", get_comma(last));
--
2.39.2
- [PULL 25/28] linux-user/sparc: Handle unimplemented flush trap, (continued)
- [PULL 25/28] linux-user/sparc: Handle unimplemented flush trap, Laurent Vivier, 2023/03/08
- [PULL 24/28] linux-user/sparc: Handle coprocessor disabled trap, Laurent Vivier, 2023/03/08
- [PULL 26/28] linux-user/sparc: Handle floating-point exceptions, Laurent Vivier, 2023/03/08
- [PULL 27/28] linux-user/sparc: Handle tag overflow traps, Laurent Vivier, 2023/03/08
- [PULL 19/28] linux-user/sparc: Handle software breakpoint trap, Laurent Vivier, 2023/03/08
- [PULL 16/28] linux-user/sparc: Use TT_TRAP for flush windows, Laurent Vivier, 2023/03/08
- [PULL 20/28] linux-user/sparc: Handle division by zero traps, Laurent Vivier, 2023/03/08
- Re: [PULL 00/28] Linux user for 8.0 patches, Peter Maydell, 2023/03/10
- [PULL 00/28] Linux user for 8.0 patches, Laurent Vivier, 2023/03/10
- [PULL 01/28] linux-user: Fix access to /proc/self/exe, Laurent Vivier, 2023/03/10
- [PULL 08/28] linux-user: Provide print_raw_param64() for 64-bit values,
Laurent Vivier <=
- [PULL 07/28] linux-user: Fix brk() to release pages, Laurent Vivier, 2023/03/10
- [PULL 05/28] linux-user: add support for xtensa FDPIC, Laurent Vivier, 2023/03/10
- [PULL 12/28] linux-user: Add translation for argument of msync(), Laurent Vivier, 2023/03/10
- [PULL 03/28] linux-user: add target to host netlink conversions, Laurent Vivier, 2023/03/10
- [PULL 04/28] linux-user: Fix unaligned memory access in prlimit64 syscall, Laurent Vivier, 2023/03/10
- [PULL 14/28] linux-user/sparc: Tidy syscall trap, Laurent Vivier, 2023/03/10
- [PULL 13/28] linux-user: Emulate CLONE_PIDFD flag in clone(), Laurent Vivier, 2023/03/10
- [PULL 20/28] linux-user/sparc: Handle division by zero traps, Laurent Vivier, 2023/03/10
- [PULL 06/28] linux-user: fill out task state in /proc/self/stat, Laurent Vivier, 2023/03/10
- [PULL 02/28] linux-user: fix timerfd read endianness conversion, Laurent Vivier, 2023/03/10