diff mbox series

[11/13] linux-user: Show timespec on strace for futex()

Message ID 20220826141853.419564-12-deller@gmx.de (mailing list archive)
State New, archived
Headers show
Series linux-user: Add more syscalls, enhance tracing & logging enhancements | expand

Commit Message

Helge Deller Aug. 26, 2022, 2:18 p.m. UTC
Signed-off-by: Helge Deller <deller@gmx.de>
---
 linux-user/strace.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--
2.37.1

Comments

Richard Henderson Aug. 29, 2022, 4:52 a.m. UTC | #1
On 8/26/22 07:18, Helge Deller wrote:
> Signed-off-by: Helge Deller <deller@gmx.de>
> ---
>   linux-user/strace.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/strace.c b/linux-user/strace.c
> index bac47748bc..a90e719681 100644
> --- a/linux-user/strace.c
> +++ b/linux-user/strace.c
> @@ -3713,11 +3713,19 @@ print_futex(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)
>   {
> +#ifdef FUTEX_CMD_MASK
> +    abi_long op = arg1 & FUTEX_CMD_MASK;
> +#else
> +    abi_long op = arg1;
> +#endif

FUTEX_CMD_MASK is defined in syscall_def.h, so never undefined.

> +    if (op == FUTEX_WAIT || op == FUTEX_WAIT_BITSET)
> +        print_timespec(arg3, 0);
> +    else
> +        print_pointer(arg3, 0); /* struct timespec */

The else isn't quite correct -- the ops not listed, which actually use this parameter, 
treat it as uint32_t val2.  Anyway, make this a switch, because I've implemented the other 
missing futex_ops, and several more treat use timespec.


r~
diff mbox series

Patch

diff --git a/linux-user/strace.c b/linux-user/strace.c
index bac47748bc..a90e719681 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -3713,11 +3713,19 @@  print_futex(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)
 {
+#ifdef FUTEX_CMD_MASK
+    abi_long op = arg1 & FUTEX_CMD_MASK;
+#else
+    abi_long op = arg1;
+#endif
     print_syscall_prologue(name);
     print_pointer(arg0, 0);
     print_futex_op(arg1, 0);
     print_raw_param(",%d", arg2, 0);
-    print_pointer(arg3, 0); /* struct timespec */
+    if (op == FUTEX_WAIT || op == FUTEX_WAIT_BITSET)
+        print_timespec(arg3, 0);
+    else
+        print_pointer(arg3, 0); /* struct timespec */
     print_pointer(arg4, 0);
     print_raw_param("%d", arg4, 1);
     print_syscall_epilogue(name);