diff mbox series

[8/8] linux-user: Log tid for strace

Message ID 20220829021006.67305-9-richard.henderson@linaro.org
State New
Headers show
Series linux-user: Futex improvements | expand

Commit Message

Richard Henderson Aug. 29, 2022, 2:10 a.m. UTC
Printing the same pid for all threads isn't helpful.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/strace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Vivier Sept. 27, 2022, 10:34 a.m. UTC | #1
Le 29/08/2022 à 04:10, Richard Henderson a écrit :
> Printing the same pid for all threads isn't helpful.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   linux-user/strace.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux-user/strace.c b/linux-user/strace.c
> index c47d91bb3d..ca9d44fa7c 100644
> --- a/linux-user/strace.c
> +++ b/linux-user/strace.c
> @@ -3782,7 +3782,7 @@ print_syscall(CPUArchState *cpu_env, int num,
>       if (!f) {
>           return;
>       }
> -    fprintf(f, "%d ", getpid());
> +    fprintf(f, "%d ", gettid());
>   
>       for (i = 0; i < nsyscalls; i++) {
>           if (scnames[i].nr == num) {

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Laurent Vivier Sept. 28, 2022, 8:33 p.m. UTC | #2
Le 29/08/2022 à 04:10, Richard Henderson a écrit :
> Printing the same pid for all threads isn't helpful.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   linux-user/strace.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux-user/strace.c b/linux-user/strace.c
> index c47d91bb3d..ca9d44fa7c 100644
> --- a/linux-user/strace.c
> +++ b/linux-user/strace.c
> @@ -3782,7 +3782,7 @@ print_syscall(CPUArchState *cpu_env, int num,
>       if (!f) {
>           return;
>       }
> -    fprintf(f, "%d ", getpid());
> +    fprintf(f, "%d ", gettid());
>   
>       for (i = 0; i < nsyscalls; i++) {
>           if (scnames[i].nr == num) {

I've removed this patch from the PR because of a problem reported by Stefan:

cc -m64 -mcx16 -Ilibqemu-hexagon-linux-user.fa.p -I. -I..
-Itarget/hexagon -I../target/hexagon -I../common-user/host/x86_64
-I../linux-user/include/host/x86_64 -I../linux-user/include
-Ilinux-user -I../linux-user -I../linux-user/hexagon -Iqapi -Itrace
-Iui/shader -I/usr/include/capstone -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fdiagnostics-color=auto
-Wall -Winvalid-pch -Werror -std=gnu11 -O2 -g -isystem
/builds/qemu-project/qemu/linux-headers -isystem linux-headers -iquote
. -iquote /builds/qemu-project/qemu -iquote
/builds/qemu-project/qemu/include -iquote
/builds/qemu-project/qemu/tcg/i386 -pthread -U_FORTIFY_SOURCE
-D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef
-Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common
-fwrapv -Wold-style-declaration -Wold-style-definition -Wtype-limits
-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers
-Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined
-Wimplicit-fallthrough=2 -Wno-missing-include-dirs
-Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -fPIE
-isystem../linux-headers -isystemlinux-headers -DNEED_CPU_H
'-DCONFIG_TARGET="hexagon-linux-user-config-target.h"'
'-DCONFIG_DEVICES="hexagon-linux-user-config-devices.h"' -MD -MQ
libqemu-hexagon-linux-user.fa.p/linux-user_strace.c.o -MF
libqemu-hexagon-linux-user.fa.p/linux-user_strace.c.o.d -o
libqemu-hexagon-linux-user.fa.p/linux-user_strace.c.o -c
../linux-user/strace.c
../linux-user/strace.c: In function 'print_syscall':
../linux-user/strace.c:3931:23: error: implicit declaration of
function 'gettid'; did you mean 'getgid'?
[-Werror=implicit-function-declaration]
fprintf(f, "%d ", gettid());
^~~~~~
getgid
../linux-user/strace.c:3931:23: error: nested extern declaration of
'gettid' [-Werror=nested-externs]

https://gitlab.com/qemu-project/qemu/-/jobs/3100018258

Thanks,
Laurent
diff mbox series

Patch

diff --git a/linux-user/strace.c b/linux-user/strace.c
index c47d91bb3d..ca9d44fa7c 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -3782,7 +3782,7 @@  print_syscall(CPUArchState *cpu_env, int num,
     if (!f) {
         return;
     }
-    fprintf(f, "%d ", getpid());
+    fprintf(f, "%d ", gettid());
 
     for (i = 0; i < nsyscalls; i++) {
         if (scnames[i].nr == num) {