linux-user: Improve strace output of personality() and sysinfo()
PATCH 1/1 linux-user: Improve strace output of personality() and sysinfo()
Make the strace look nicer for those two syscalls.
--- linux-user/strace.list | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
linux-user/strace.list +2 -2
@@ -1043,7 +1043,7 @@ { TARGET_NR_perfctr, "perfctr" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_personality -{ TARGET_NR_personality, "personality" , NULL, NULL, NULL }, +{ TARGET_NR_personality, "personality" , "%s(%p)", NULL, print_syscall_ret_addr }, #endif #ifdef TARGET_NR_pipe { TARGET_NR_pipe, "pipe" , NULL, NULL, NULL },
@@ -1502,7 +1502,7 @@ { TARGET_NR_sysfs, "sysfs" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_sysinfo -{ TARGET_NR_sysinfo, "sysinfo" , NULL, NULL, NULL }, +{ TARGET_NR_sysinfo, "sysinfo" , "%s(%p)", NULL, NULL }, #endif #ifdef TARGET_NR_sys_kexec_load { TARGET_NR_sys_kexec_load, "sys_kexec_load" , NULL, NULL, NULL },
--
2.38.1
Quoted 12 lines · Helge Deller
Make the strace look nicer for those two syscalls.
Signed-off-by Helge Deller <[email protected]>--- linux-user/strace.list | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)linux-user/strace.list +0
-0
linux-user/strace.list line 1046
Quoted 5 lines
linux-user/strace.list +1
-1@@ -1043,7 +1043,7 @@ { TARGET_NR_perfctr, "perfctr" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_personality -{ TARGET_NR_personality, "personality" , NULL, NULL, NULL }, +{ TARGET_NR_personality, "personality" , "%s(%p)", NULL, print_syscall_ret_addr },
Shouldn't this be:
{ TARGET_NR_personality, "personality" , "%s(%u)", NULL, NULL },
?
Quoted 16 lines
linux-user/strace.list +1
-2#endif #ifdef TARGET_NR_pipe { TARGET_NR_pipe, "pipe" , NULL, NULL, NULL },@@ -1502,7 +1502,7 @@ { TARGET_NR_sysfs, "sysfs" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_sysinfo -{ TARGET_NR_sysinfo, "sysinfo" , NULL, NULL, NULL }, +{ TARGET_NR_sysinfo, "sysinfo" , "%s(%p)", NULL, NULL }, #endif #ifdef TARGET_NR_sys_kexec_load { TARGET_NR_sys_kexec_load, "sys_kexec_load" , NULL, NULL, NULL }, --2.38.1
Quoted 21 lines · Philippe Mathieu-Daudé
Quoted 12 lines · Helge Deller
Make the strace look nicer for those two syscalls.
Signed-off-by Helge Deller <[email protected]>---
linux-user/strace.list | 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)linux-user/strace.list +0
-0linux-user/strace.list line 1046
Quoted 5 lines
linux-user/strace.list +1
-1@@ -1043,7 +1043,7 @@ { TARGET_NR_perfctr, "perfctr" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_personality -{ TARGET_NR_personality, "personality" , NULL, NULL, NULL }, +{ TARGET_NR_personality, "personality" , "%s(%p)", NULL, print_syscall_ret_addr },Shouldn't this be:
Quoted 1 line
{
TARGET_NR_personality, "personality" , "%s(%u)", NULL, NULL },
Basically yes, but...
it's a bitmap, so printing it as hex value (similiar to a pointer) is easier to read/analyze.
Helge
Quoted 20 lines
?
Quoted 16 lines
linux-user/strace.list +1
-2#endif #ifdef TARGET_NR_pipe { TARGET_NR_pipe, "pipe" , NULL, NULL, NULL },@@ -1502,7 +1502,7 @@ { TARGET_NR_sysfs, "sysfs" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_sysinfo -{ TARGET_NR_sysinfo, "sysinfo" , NULL, NULL, NULL }, +{ TARGET_NR_sysinfo, "sysinfo" , "%s(%p)", NULL, NULL }, #endif #ifdef TARGET_NR_sys_kexec_load { TARGET_NR_sys_kexec_load, "sys_kexec_load" , NULL, NULL, NULL }, --2.38.1
Quoted 23 lines · Helge Deller
Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 12 lines · Helge Deller
Make the strace look nicer for those two syscalls.
Signed-off-by Helge Deller <[email protected]>---
linux-user/strace.list | 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)linux-user/strace.list +0
-0linux-user/strace.list line 1047
Quoted 6 lines
linux-user/strace.list +1
-1@@ -1043,7 +1043,7 @@ { TARGET_NR_perfctr, "perfctr" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_personality -{ TARGET_NR_personality, "personality" , NULL, NULL, NULL }, +{ TARGET_NR_personality, "personality" , "%s(%p)", NULL, print_syscall_ret_addr },Shouldn't this be:
Quoted 5 lines
Quoted 1 line
{
TARGET_NR_personality, "personality" , "%s(%u)", NULL, NULL },Basically yes, but...
it's a bitmap, so printing it as hex value (similiar to a pointer) is easier to read/analyze.
Oh, good point. Then "%s(0x"TARGET_ABI_FMT_lx")" is self-explicit.
Also for clarity:
#define print_syscall_ret_persona print_syscall_ret_addr
So what do you think of:
{ TARGET_NR_personality, "personality" , "%s(0x"TARGET_ABI_FMT_lx")",
NULL, print_syscall_ret_persona },
?
Quoted 23 lines · Philippe Mathieu-Daudé
Quoted 22 lines · Helge Deller
Quoted 21 lines · Philippe Mathieu-Daudé
Quoted 12 lines · Helge Deller
Make the strace look nicer for those two syscalls.
Signed-off-by Helge Deller <[email protected]>---
linux-user/strace.list | 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)linux-user/strace.list +0
-0linux-user/strace.list line 1046
Quoted 5 lines
linux-user/strace.list +1
-1@@ -1043,7 +1043,7 @@ { TARGET_NR_perfctr, "perfctr" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_personality -{ TARGET_NR_personality, "personality" , NULL, NULL, NULL }, +{ TARGET_NR_personality, "personality" , "%s(%p)", NULL, print_syscall_ret_addr },Shouldn't this be:
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
{
TARGET_NR_personality, "personality" , "%s(%u)", NULL, NULL },Basically yes, but...
it's a bitmap, so printing it as hex value (similiar to a pointer) is easier to read/analyze.Oh, good point. Then "%s(0x"TARGET_ABI_FMT_lx")" is self-explicit.
Hmm ... I don't see that as any benefit for the user and the output is the same.
Quoted 8 lines
Also for clarity:
#define
print_syscall_ret_personaprint_syscall_ret_addrSo what do you think of:
{
TARGET_NR_personality, "personality" , "%s(0x"TARGET_ABI_FMT_lx")",
NULL,print_syscall_ret_persona},
This change does make sense if someone fully implements the strace of personality() including showing the flags as string. Until then it's IMHO just one more function which uses space and gains nothing.
Helge
Le 23/12/2022 à 13:27, Helge Deller a écrit :
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 25 lines · Helge Deller
Quoted 24 lines · Philippe Mathieu-Daudé
Quoted 22 lines · Helge Deller
Quoted 12 lines
Make the strace look nicer for those two syscalls.
Signed-off-by Helge Deller <[email protected]>---
linux-user/strace.list | 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)linux-user/strace.list +0
-0linux-user/strace.list line 1046
Quoted 5 lines
linux-user/strace.list +1
-1@@ -1043,7 +1043,7 @@ { TARGET_NR_perfctr, "perfctr" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_personality -{ TARGET_NR_personality, "personality" , NULL, NULL, NULL }, +{ TARGET_NR_personality, "personality" , "%s(%p)", NULL, print_syscall_ret_addr },Shouldn't this be:
{
TARGET_NR_personality, "personality" , "%s(%u)", NULL, NULL },
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Basically yes, but...
it's a bitmap, so printing it as hex value (similiar to a pointer) is easier to read/analyze.Oh, good point. Then "%s(0x"TARGET_ABI_FMT_lx")" is self-explicit.
Hmm ... I don't see that as any benefit for the user and the output is the same.
I agree with Philippe for this part, it's not a pointer, don't use %p.
Thanks,
Laurent
PATCH v2 1/1 linux-user: Improve strace output of personality() and sysinfo()
Make the strace look nicer for those two syscalls.
--
v2: use TARGET_ABI_FMT_lx instead of %p in personality output
as suggested by Philippe Mathieu-Daudé and Laurent Vivier
linux-user/strace.list +3 -2
@@ -1043,7 +1043,8 @@ { TARGET_NR_perfctr, "perfctr" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_personality -{ TARGET_NR_personality, "personality" , NULL, NULL, NULL }, +{ TARGET_NR_personality, "personality" , "%s(0x"TARGET_ABI_FMT_lx")", NULL, + print_syscall_ret_addr }, #endif #ifdef TARGET_NR_pipe { TARGET_NR_pipe, "pipe" , NULL, NULL, NULL },
@@ -1502,7 +1503,7 @@ { TARGET_NR_sysfs, "sysfs" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_sysinfo -{ TARGET_NR_sysinfo, "sysinfo" , NULL, NULL, NULL }, +{ TARGET_NR_sysinfo, "sysinfo" , "%s(%p)", NULL, NULL }, #endif #ifdef TARGET_NR_sys_kexec_load { TARGET_NR_sys_kexec_load, "sys_kexec_load" , NULL, NULL, NULL },
Quoted 3 lines · Helge Deller
Make the strace look nicer for those two syscalls.
Signed-off-by Helge Deller<[email protected]>
r~
Le 27/01/2023 à 21:18, Helge Deller a écrit :
Quoted 25 lines
Make the strace look nicer for those two syscalls.
Signed-off-by Helge Deller <[email protected]>--
v2: useTARGET_ABI_FMT_lxinstead of %p in personality output
as suggested by Philippe Mathieu-Daudé and Laurent Vivierlinux-user/strace.list +2
-1@@ -1043,7 +1043,8 @@ { TARGET_NR_perfctr, "perfctr" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_personality -{ TARGET_NR_personality, "personality" , NULL, NULL, NULL }, +{ TARGET_NR_personality, "personality" , "%s(0x"TARGET_ABI_FMT_lx")", NULL, + print_syscall_ret_addr }, #endif #ifdef TARGET_NR_pipe { TARGET_NR_pipe, "pipe" , NULL, NULL, NULL },
linux-user/strace.list line 1509
Quoted 8 lines
linux-user/strace.list +1
-1@@ -1502,7 +1503,7 @@ { TARGET_NR_sysfs, "sysfs" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_sysinfo -{ TARGET_NR_sysinfo, "sysinfo" , NULL, NULL, NULL }, +{ TARGET_NR_sysinfo, "sysinfo" , "%s(%p)", NULL, NULL }, #endif #ifdef TARGET_NR_sys_kexec_load { TARGET_NR_sys_kexec_load, "sys_kexec_load" , NULL, NULL, NULL },
Laurent Vivier
AppliedLe 27/01/2023 à 21:18, Helge Deller a écrit :
Quoted 25 lines
Make the strace look nicer for those two syscalls.
Signed-off-by Helge Deller <[email protected]>--
v2: useTARGET_ABI_FMT_lxinstead of %p in personality output
as suggested by Philippe Mathieu-Daudé and Laurent Vivierlinux-user/strace.list +2
-1@@ -1043,7 +1043,8 @@ { TARGET_NR_perfctr, "perfctr" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_personality -{ TARGET_NR_personality, "personality" , NULL, NULL, NULL }, +{ TARGET_NR_personality, "personality" , "%s(0x"TARGET_ABI_FMT_lx")", NULL, + print_syscall_ret_addr }, #endif #ifdef TARGET_NR_pipe { TARGET_NR_pipe, "pipe" , NULL, NULL, NULL },
linux-user/strace.list line 1509
Quoted 8 lines
linux-user/strace.list +1
-1@@ -1502,7 +1503,7 @@ { TARGET_NR_sysfs, "sysfs" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_sysinfo -{ TARGET_NR_sysinfo, "sysinfo" , NULL, NULL, NULL }, +{ TARGET_NR_sysinfo, "sysinfo" , "%s(%p)", NULL, NULL }, #endif #ifdef TARGET_NR_sys_kexec_load { TARGET_NR_sys_kexec_load, "sys_kexec_load" , NULL, NULL, NULL },
Applied to my linux-user-for-8.0 branch.
Thanks,
Laurent