bcc
bcc copied to clipboard
tools/memleak: support user-space tracing without a PID
Sometimes it is useful to attach user probes before starting a process (e.g. see https://github.com/iovisor/bcc/issues/3834), however memleak currently requires a PID in order to enable user-space probing.
This change adds a new option --kernel-trace
to explicitly enable
kernel tracing, and allow user-space tracing without providing a PID.
In order to do this, a stack's PID need to be stored in the BPF map, in order to be able to later resolve symbols correctly.
This change adds a new option --kernel-trace to explicitly enable kernel tracing, and allow user-space tracing without providing a PID.
This is a behavior change as kernel tracing now needs explicit option. We cannot do this.
What is your expected command line for user space tracing?
The way I've been running this is something like memleak --obj /path/to/binary
and once the probes are attached I actually run /path/to/binary
.
In order to avoid breaking previous use cases I guess I could add a --user-trace
option rather than --kernel-trace
, and then have user-space tracing enabled when either a PID is available, or --user-trace
is passed. This way existing use cases should still work. Thoughts?
I think adding a --user-trace
option is better. This way, we can maintain the backward compatibility.