Skip to content

Commit

Permalink
linux-user/strace: show TID instead of PID
Browse files Browse the repository at this point in the history
This aligns with strace, and is very useful when tracing multi-threaded
programs. The result is the same in single-threaded programs.

gettid() requires the _GNU_SOURCE feature test macro, so it might be
unavailable in rare cases. I don't expect it to be a problem though,
because it's implemented by both glibc and musl.

Signed-off-by: J. Neuschäfer <[email protected]>
  • Loading branch information
neuschaefer authored and GitHub Actions Bot committed Oct 23, 2024
1 parent 6f625ce commit aff3bbb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion linux-user/strace.c
Original file line number Diff line number Diff line change
Expand Up @@ -4337,7 +4337,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) {
Expand Down

0 comments on commit aff3bbb

Please sign in to comment.