Re: [PATCH v3 10/10] perf list: Add json output option
From: Arnaldo Carvalho de Melo
Date: Wed Nov 16 2022 - 07:42:07 EST
Em Wed, Nov 16, 2022 at 08:51:29AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Nov 16, 2022 at 08:35:28AM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Please always run 'perf test' before and after your patches and before
> > > sending it upstream.
>
> > Running as !root on a different machine I get some other interesting
> > info:
>
> > ⬢[acme@toolbox perf]$ perf list syscalls:sys_enter_open*
> > double free or corruption (fasttop)
> > Aborted (core dumped)
> > ⬢[acme@toolbox perf]$
> >
> > That is:
> >
> > free(ps.pmu_glob);
> >
> >
> > at the end of cmd_list().
>
> This plus the change to default_ps in the subsequent patch cures the
> double free, now working on the segfault.
The segfault is "cured" with:
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index 3183c0351cda6cee..5eb9ed4a5cd0ad71 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -104,7 +104,7 @@ static void default_print_event(void *ps, const char *pmu_name, const char *topi
if (deprecated && !print_state->deprecated)
return;
- if (print_state->pmu_glob && !strglobmatch(pmu_name, print_state->pmu_glob))
+ if (print_state->pmu_glob && pmu_name && !strglobmatch(pmu_name, print_state->pmu_glob))
return;
if (print_state->event_glob &&
----------------------------
But then:
[root@five ~]# perf list syscalls:sys_enter_open* |& grep syscalls:
syscalls:sys_enter_open [Tracepoint event]
syscalls:sys_enter_open_by_handle_at [Tracepoint event]
syscalls:sys_enter_open_tree [Tracepoint event]
syscalls:sys_enter_openat [Tracepoint event]
syscalls:sys_enter_openat2 [Tracepoint event]
[root@five ~]#
This stops working, looking into it.
- Arnaldo