[PATCH 0/3] -Y, --decode-pids option for printing command names for PIDs
Masatake YAMATO
yamato at redhat.com
Wed Aug 18 11:00:39 UTC 2021
In some applications like qemu-kvm, threads change their
command names to indicate their roles in the application.
Users can access the command name via /proc/$pid/comm.
The command name can be a great hit to understand the application
behavior.
This pull request introduces -Y option that enables printing command
names where PIDs appear.
For example (without -Y option):
# src/strace -e poll,ioctl -f -p "$(pidof qemu-system-x86_64)"
[pid 254329] ioctl(18, KVM_RUN <unfinished ...>
[pid 254332] ioctl(21, KVM_RUN <unfinished ...>
[pid 254331] ioctl(20, KVM_RUN <unfinished ...>
[pid 254330] ioctl(19, KVM_RUN <unfinished ...>
[pid 254309] poll([{fd=9, events=POLLOUT}], 1, 0) = 1 ...
[pid 254309] poll([{fd=9, events=POLLOUT}], 1, 0) = 1 ...
(with -Y option):
# src/strace -e poll,ioctl -Y -f -p "$(pidof qemu-system-x86_64)"
[pid 254329<CPU 0/KVM>] ioctl(18, KVM_RUN <unfinished ...>
[pid 254332<CPU 3/KVM>] ioctl(21, KVM_RUN <unfinished ...>
[pid 254331<CPU 2/KVM>] ioctl(20, KVM_RUN <unfinished ...>
[pid 254330<CPU 1/KVM>] ioctl(19, KVM_RUN <unfinished ...>
[pid 254309<qemu-system-x86>] poll([{fd=9, events=POLLOUT}], 1, 0) = 1 ...
[pid 254309<qemu-system-x86>] poll([{fd=9, events=POLLOUT}], 1, 0) = 1 ...
This change considers only PIDs in the prefixes of trace lines.
Printing command names for PIDs in arguments and return values is
future work.
Masatake YAMATO (3):
Load /proc/$pid/comm into tcb
Implement -Y option for printing command names for PIDs
tests: add a test for -Y option
NEWS | 1 +
doc/strace.1.in | 5 ++
src/defs.h | 5 ++
src/filter_seccomp.c | 3 +-
src/linux/32/syscallent.h | 6 +--
src/linux/64/syscallent.h | 6 +--
src/linux/alpha/syscallent.h | 6 +--
src/linux/arm/syscallent.h | 6 +--
src/linux/avr32/syscallent.h | 6 +--
src/linux/bfin/syscallent.h | 6 +--
src/linux/hppa/syscallent.h | 6 +--
src/linux/i386/syscallent.h | 6 +--
src/linux/ia64/syscallent.h | 6 +--
src/linux/m68k/syscallent.h | 6 +--
src/linux/microblaze/syscallent.h | 6 +--
src/linux/mips/syscallent-n32.h | 6 +--
src/linux/mips/syscallent-n64.h | 6 +--
src/linux/mips/syscallent-o32.h | 6 +--
src/linux/powerpc/syscallent.h | 6 +--
src/linux/powerpc64/syscallent.h | 6 +--
src/linux/s390/syscallent.h | 6 +--
src/linux/s390x/syscallent.h | 6 +--
src/linux/sh/syscallent.h | 6 +--
src/linux/sh64/syscallent.h | 6 +--
src/linux/sparc/syscallent.h | 6 +--
src/linux/sparc64/syscallent.h | 6 +--
src/linux/x32/syscallent.h | 6 +--
src/linux/x86_64/syscallent.h | 6 +--
src/linux/xtensa/syscallent.h | 6 +--
src/strace.c | 62 ++++++++++++++++++++--
src/syscall.c | 8 +++
src/sysent.h | 1 +
src/sysent_shorthand_defs.h | 2 +
src/sysent_shorthand_undefs.h | 1 +
tests/.gitignore | 1 +
tests/Makefile.am | 1 +
tests/gen_tests.in | 1 +
tests/strace-Y-0123456789.c | 88 +++++++++++++++++++++++++++++++
38 files changed, 248 insertions(+), 81 deletions(-)
create mode 100644 tests/strace-Y-0123456789.c
--
2.31.1
More information about the Strace-devel
mailing list