diff options
author | Masatake YAMATO <yamato@redhat.com> | 2021-09-09 22:43:36 +0900 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2021-11-14 08:00:00 +0000 |
commit | cb1650559273daa41fef08ab91da35860d1cf26f (patch) | |
tree | 07a2114bb9721d065bf505cd7dc8caf9ea879c4b /src/defs.h | |
parent | 8cebeebcb587d557f1a870c4c544d308fb675362 (diff) | |
download | strace-cb1650559273daa41fef08ab91da35860d1cf26f.tar.gz |
Extend -Y option to decode PIDs in arguments and return values
This change extends -Y/--decode-pids=comm option. In addition to the
information printed before this change, command names would be printed
also for PIDs appeared in syscall arguments and return values.
For example:
getppid() = 3781395<strace>
getpid() = 3781398<a.out>
pidfd_open(1<systemd>, 0) = 3<pid:1<systemd>>
NOTE: The code printing the pid in printclockname() is not changed in
this commit. CLOCKID_TO_FD macro used in printclockname() was removed
from the kernel, so printclockname() may change drastically in the
near future.
* src/defs.h (maybe_printpid_comm): New function declaration.
* src/strace.c (maybe_printpid_comm): New function printing
command name for the given PID.
* src/pidns.c (printpid_translation): Call `maybe_printpid_comm'.
* tests/strace--decode-pids-comm.c (do_default_action): Update expected
output.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Co-authored-by: Dmitry V. Levin <ldv@strace.io>
Diffstat (limited to 'src/defs.h')
-rw-r--r-- | src/defs.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/defs.h b/src/defs.h index 49636b967..936609ae2 100644 --- a/src/defs.h +++ b/src/defs.h @@ -1492,6 +1492,8 @@ extern void kvm_vcpu_info_free(struct tcb *); # endif extern void maybe_load_task_comm(struct tcb *tcp); +/* Print the contents of /proc/$pid/comm. */ +extern void maybe_printpid_comm(int pid); static inline int printstrn(struct tcb *tcp, kernel_ulong_t addr, kernel_ulong_t len) |