linux-user: Trace sendto/recvfrom
cover linux-user: Trace sendto/recvfrom
Strace format added while debugging
https://gitlab.com/qemu-project/qemu/-/issues/2485
Philippe Mathieu-Daudé (3):
linux-user: Display sockaddr buffer as pointer
linux-user: Add strace for sendto()
linux-user: Add strace for recvfrom()
linux-user/strace.c | 38 ++++++++++++++++++++++++++++++++++++-- linux-user/strace.list | 4 ++-- 2 files changed, 38 insertions(+), 4 deletions(-)
Signature · 1 line
2.45.2
PATCH 1/3 linux-user: Display sockaddr buffer as pointer
Rather than 'raw param', display as pointer to get "NULL" instead of "0x00000000". Remove spurious space.
--- linux-user/strace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
linux-user/strace.c +2 -2
@@ -434,9 +434,9 @@ print_sockaddr(abi_ulong addr, abi_long addrlen, int last) }unlock_user (sa, addr,0 ); }else { -print_raw_param ("0x" TARGET_ABI_FMT_lx, addr,0 ); +print_pointer (addr,0 ); } -qemu_log (", " TARGET_ABI_FMT_ld"%s" , addrlen,get_comma (last)); +qemu_log ("," TARGET_ABI_FMT_ld"%s" , addrlen,get_comma (last)); } static void
Signature · 1 line
2.45.2
Re: [PATCH 1/3] linux-user: Display sockaddr buffer as pointer
Quoted 7 lines · Philippe Mathieu-Daudé
Rather than 'raw param', display as pointer to get "NULL" instead of "
0x00000000". Remove spurious space.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- linux-user/strace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
r~
PATCH 2/3 linux-user: Add strace for sendto()
In reply to Philippe Mathieu-Daudé--- linux-user/strace.c | 15 +++++++++++++++ linux-user/strace.list | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-)
linux-user/strace.c +15 -0
@@ -3122,6 +3122,21 @@ print_bind(CPUArchState *cpu_env, const struct syscallname *name, }#endif +#ifdef TARGET_NR_sendto +static void +print_sendto (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) +{ +print_syscall_prologue (name); +print_sockfd (arg0,0 ); +print_buf (arg1, arg2,0 ); +print_flags (msg_flags, arg3,0 ); +print_sockaddr (arg4, arg5,1 ); +print_syscall_epilogue (name); +} +#endif +#if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \ defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64) static void
linux-user/strace.list +1 -1
@@ -1285,7 +1285,7 @@ { TARGET_NR_sendmsg, "sendmsg" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_sendto -{ TARGET_NR_sendto, "sendto" , NULL, NULL, NULL }, +{ TARGET_NR_sendto, "sendto" , NULL, print_sendto, NULL }, #endif #ifdef TARGET_NR_setdomainname { TARGET_NR_setdomainname, "setdomainname" , NULL, NULL, NULL },
Signature · 1 line
2.45.2
Re: [PATCH 2/3] linux-user: Add strace for sendto()
linux-user/strace.c print_bind(CPUArchState *cpu_env, const struct syscallname *name, · line 3133
Quoted 9 lines · Philippe Mathieu-Daudé
linux-user/strace.c +9
-0+#ifdef TARGET_NR_sendto +static void +print_sendto (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) +{ +print_syscall_prologue (name); +print_sockfd (arg0,0 ); +print_buf (arg1, arg2,0 );
You still need to log arg2.
r~
Re: [PATCH 2/3] linux-user: Add strace for sendto()
Quoted 12 lines · Richard Henderson
linux-user/strace.c print_bind(CPUArchState *cpu_env, const struct syscallname *name, · line 3133
Quoted 9 lines · Philippe Mathieu-Daudé
linux-user/strace.c +9
-0+#ifdef TARGET_NR_sendto +static void +print_sendto (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) +{ + print_syscall_prologue(name); + print_sockfd(arg0, 0); + print_buf(arg1, arg2, 0);You still need to log arg2.
Oops.
PATCH 3/3 linux-user: Add strace for recvfrom()
In reply to Philippe Mathieu-Daudé---
RFC: Not sure about get_user_ualx() use here
--- linux-user/strace.c | 19 +++++++++++++++++++ linux-user/strace.list | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-)
linux-user/strace.c +19 -0
@@ -3122,6 +3122,25 @@ print_bind(CPUArchState *cpu_env, const struct syscallname *name, }#endif +#ifdef TARGET_NR_recvfrom +static void +print_recvfrom (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) +{ +abi_ulong addrlen; + +get_user_ualx (addrlen, arg5,0 ); + +print_syscall_prologue (name); +print_sockfd (arg0,0 ); +print_buf (arg1, arg2,0 ); +print_flags (msg_flags, arg3,0 ); +print_sockaddr (arg4, addrlen,1 ); +print_syscall_epilogue (name); +} +#endif +#ifdef TARGET_NR_sendto static void print_sendto(CPUArchState *cpu_env, const struct syscallname *name,
linux-user/strace.list +1 -1
@@ -1135,7 +1135,7 @@ { TARGET_NR_recv, "recv" , "%s(%d,%p,%u,%d)", NULL, NULL }, #endif #ifdef TARGET_NR_recvfrom -{ TARGET_NR_recvfrom, "recvfrom" , NULL, NULL, NULL }, +{ TARGET_NR_recvfrom, "recvfrom" , NULL, print_recvfrom, NULL }, #endif #ifdef TARGET_NR_recvmmsg { TARGET_NR_recvmmsg, "recvmmsg" , NULL, NULL, NULL },
Signature · 1 line
2.45.2
Re: [PATCH 3/3] linux-user: Add strace for recvfrom()
Quoted 4 lines · Philippe Mathieu-Daudé
linux-user/strace.c +4
-0+#ifdef TARGET_NR_recvfrom +static void +print_recvfrom(CPUArchState *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2,
linux-user/strace.c print_bind(CPUArchState *cpu_env, const struct syscallname *name, · line 3138
Quoted 10 lines
linux-user/strace.c +10
-0+ abi_long arg3, abi_long arg4, abi_long arg5) +{ + abi_ulong addrlen; + +get_user_ualx (addrlen, arg5,0 ); + +print_syscall_prologue (name); +print_sockfd (arg0,0 ); +print_buf (arg1, arg2,0 ); +print_flags (msg_flags, arg3,0 );
Log arg2.
r~