Skip to content

Commit 036cf16

Browse files
committed
linux-user: Improve strace output of pread64() and pwrite64()
Make the strace look nicer for those two syscalls. Signed-off-by: Helge Deller <[email protected]> Reviewed-by: Richard Henderson <[email protected]>
1 parent dca4c83 commit 036cf16

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

linux-user/strace.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3999,6 +3999,25 @@ print_tgkill(CPUArchState *cpu_env, const struct syscallname *name,
39993999
}
40004000
#endif
40014001

4002+
#if defined(TARGET_NR_pread64) || defined(TARGET_NR_pwrite64)
4003+
static void
4004+
print_pread64(CPUArchState *cpu_env, const struct syscallname *name,
4005+
abi_long arg0, abi_long arg1, abi_long arg2,
4006+
abi_long arg3, abi_long arg4, abi_long arg5)
4007+
{
4008+
if (regpairs_aligned(cpu_env, TARGET_NR_pread64)) {
4009+
arg3 = arg4;
4010+
arg4 = arg5;
4011+
}
4012+
print_syscall_prologue(name);
4013+
print_raw_param("%d", arg0, 0);
4014+
print_pointer(arg1, 0);
4015+
print_raw_param("%d", arg2, 0);
4016+
print_raw_param("%" PRIu64, target_offset64(arg3, arg4), 1);
4017+
print_syscall_epilogue(name);
4018+
}
4019+
#endif
4020+
40024021
#ifdef TARGET_NR_statx
40034022
static void
40044023
print_statx(CPUArchState *cpu_env, const struct syscallname *name,

linux-user/strace.list

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@
10681068
{ TARGET_NR_prctl, "prctl" , NULL, NULL, NULL },
10691069
#endif
10701070
#ifdef TARGET_NR_pread64
1071-
{ TARGET_NR_pread64, "pread64" , NULL, NULL, NULL },
1071+
{ TARGET_NR_pread64, "pread64" , NULL, print_pread64, NULL },
10721072
#endif
10731073
#ifdef TARGET_NR_preadv
10741074
{ TARGET_NR_preadv, "preadv" , NULL, NULL, NULL },
@@ -1099,7 +1099,7 @@
10991099
{ TARGET_NR_putpmsg, "putpmsg" , NULL, NULL, NULL },
11001100
#endif
11011101
#ifdef TARGET_NR_pwrite64
1102-
{ TARGET_NR_pwrite64, "pwrite64" , NULL, NULL, NULL },
1102+
{ TARGET_NR_pwrite64, "pwrite64" , NULL, print_pread64, NULL },
11031103
#endif
11041104
#ifdef TARGET_NR_pwritev
11051105
{ TARGET_NR_pwritev, "pwritev" , NULL, NULL, NULL },

0 commit comments

Comments
 (0)