devlib
devlib copied to clipboard
ftrace: Preserve kprobe events during trace-cmd reset
FtraceCollector.reset() executes 'trace-cmd reset ..' command which clears all kprobes. This breaks tracing existing kprobe events (if any). Thus, save kprobe events before trace-cmd reset and restore them after the reset operation.
For the context, I want to trace an ordinary function in kernel (e.g., "echo 'p do_sys_open' > /sys/kernel/tracing/kprobe_events"). However, FtraceCollector.reset() destroys kprobes, too. Preserving existing kprobes allows me to use FtraceCollector class as is.
Signed-off-by: Metin Kaya [email protected]
Filed a question to check if we can introduce a new flag in trace-cmd to exclude resetting existing kprobe events.