Messages in this thread | | | From | Namhyung Kim <> | Date | Tue, 14 Feb 2023 10:03:19 -0800 | Subject | Re: [PATCH 1/7] perf bpf filter: Introduce basic BPF filter expression |
| |
On Tue, Feb 14, 2023 at 8:10 AM Ian Rogers <irogers@google.com> wrote: > > On Mon, Feb 13, 2023 at 9:05 PM Namhyung Kim <namhyung@kernel.org> wrote: [SNIP] > > diff --git a/tools/perf/util/bpf-filter.y b/tools/perf/util/bpf-filter.y > > new file mode 100644 > > index 000000000000..0bf36ec30abf > > --- /dev/null > > +++ b/tools/perf/util/bpf-filter.y > > @@ -0,0 +1,52 @@ > > +%parse-param {struct list_head *expr_head} > > + > > +%{ > > + > > +#include <stdio.h> > > +#include <string.h> > > +#include <linux/compiler.h> > > +#include <linux/list.h> > > +#include "bpf-filter.h" > > + > > +static void perf_bpf_filter_error(struct list_head *expr __maybe_unused, > > + char const *msg) > > +{ > > + printf("perf_bpf_filter: %s\n", msg); > > +} > > + > > +%} > > + > > +%union > > +{ > > + unsigned long num; > > + unsigned long sample; > > + enum perf_bpf_filter_op op; > > + struct perf_bpf_filter_expr *expr; > > +} > > + > > +%token BFT_SAMPLE BFT_OP BFT_ERROR BFT_NUM > > +%type <expr> filter_term > > To avoid memory leaks for parse errors, I think you want here: > %destructor { free($$); } <expr>
Sure, thanks for the suggestion.
Namhyung
| |