Skip to content

Commit

Permalink
linux-user: Improve strace output of pread64() and pwrite64()
Browse files Browse the repository at this point in the history
Make the strace look nicer for those two syscalls.

Signed-off-by: Helge Deller <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
  • Loading branch information
hdeller committed Jul 8, 2023
1 parent dca4c83 commit 036cf16
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions linux-user/strace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3999,6 +3999,25 @@ print_tgkill(CPUArchState *cpu_env, const struct syscallname *name,
}
#endif

#if defined(TARGET_NR_pread64) || defined(TARGET_NR_pwrite64)
static void
print_pread64(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);
print_raw_param("%" PRIu64, target_offset64(arg3, arg4), 1);
print_syscall_epilogue(name);
}
#endif

#ifdef TARGET_NR_statx
static void
print_statx(CPUArchState *cpu_env, const struct syscallname *name,
Expand Down
4 changes: 2 additions & 2 deletions linux-user/strace.list
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,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_pread64, NULL },
#endif
#ifdef TARGET_NR_preadv
{ TARGET_NR_preadv, "preadv" , NULL, NULL, NULL },
Expand Down Expand Up @@ -1099,7 +1099,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_pread64, NULL },
#endif
#ifdef TARGET_NR_pwritev
{ TARGET_NR_pwritev, "pwritev" , NULL, NULL, NULL },
Expand Down

0 comments on commit 036cf16

Please sign in to comment.