libtracecmd: tracecmd_filter_add filters unrelated events

Petr Malat <[email protected]> Tue, 27 May 2025 09:22:01 -0500
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <CANMuvJnWm0RpUCw+hMeqzGCig8hydUGYBZWKaNM44zGOM8jFqg@mail.gmail.com>
Hi,
when I attach a filter "subsys/event:field==val" using
tracecmd_filter_add(), it filters out all other events as well and
not just the event, for which the filter is relevant. I want to ask if
this is intentional or a bug. I expected the function to mirror filter
feature of ftrace, where setting a filter in events/subsys/event/filter
has no effect on other events than subsys/event.

Per event filtering is done using tracecmd_follow_event(), so the
current behavior of tracecmd_filter_add() is redundant to it and
prevents creating per event filters without using custom callbacks.

If this behavior is not intentional, I can prepare a patch to not filter
out events where none of the fillers is applicable to.
BR,
  Petr