Re: [PATCH v2 2/8] perf tools: Introduce perf_hpp__setup_hists_formats()

From: Namhyung Kim
Date: Mon Mar 07 2016 - 08:59:16 EST


On Fri, Mar 04, 2016 at 06:58:22PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Mar 04, 2016 at 11:59:36PM +0900, Namhyung Kim escreveu:
> > The perf_hpp__setup_hists_formats() is to build hists-specific output
> > formats (and sort keys). Currently it's only used in order to build the
> > output format in a hierarchy with same sort keys, but it could be used
> > with different sort keys in non-hierarchy mode later.
>
> After applying this one:
>
> [root@jouet ~]# perf top --hierarchy # press 'q' to exit and get this:
> perf: Segmentation fault
> -------- backtrace --------
> perf[0x54b60b]
> /lib64/libc.so.6(+0x34b20)[0x7fb7e06e9b20]
> perf[0x4e9780]
> perf(perf_evsel__delete+0x20)[0x498450]
> perf(perf_evlist__delete+0x182)[0x48fbe2]
> perf(cmd_top+0xc93)[0x440893]
> perf[0x481c01]
> perf(main+0x67a)[0x423dea]
> /lib64/libc.so.6(__libc_start_main+0xf0)[0x7fb7e06d5580]
> perf(_start+0x29)[0x423f09]
> [0x0]
> [root@jouet ~]#
>
> rebuild it with DEBUG=1, run it on gdb, press 'q' to exit 'perf top':
>
> (gdb) run top --stdio --hierarchy
> Program received signal SIGSEGV, Segmentation fault.
> 0x000000000051632b in hists_evsel__exit (evsel=0x19b95b0) at util/hist.c:2143
> 2143 perf_hpp_list__for_each_format_safe(&node->hpp, fmt, pos) {
> Missing separate debuginfos, use: dnf debuginfo-install bzip2-libs-1.0.6-19.fc23.x86_64 glibc-2.22-10.fc23.x86_64 libunwind-1.1-10.fc23.x86_64 nss-softokn-freebl-3.22.0-1.0.fc23.x86_64 numactl-libs-2.0.10-3.fc23.x86_64 perl-libs-5.22.1-350.fc23.x86_64 python-libs-2.7.10-8.fc23.x86_64 slang-2.3.0-4.fc23.x86_64
> (gdb) bt
> #0 0x000000000051632b in hists_evsel__exit (evsel=0x19b95b0) at util/hist.c:2143
> #1 0x00000000004b5a2c in perf_evsel__exit (evsel=0x19b95b0) at util/evsel.c:1094
> #2 0x00000000004b5a6a in perf_evsel__delete (evsel=0x19b95b0) at util/evsel.c:1099
> #3 0x00000000004adf5d in perf_evlist__purge (evlist=0x19b8b90) at util/evlist.c:115
> #4 0x00000000004ae090 in perf_evlist__delete (evlist=0x19b8b90) at util/evlist.c:135
> #5 0x0000000000446547 in cmd_top (argc=0, argv=0x7fffffffe310, prefix=0x0) at builtin-top.c:1346
> #6 0x000000000049e614 in run_builtin (p=0x90f5e0 <commands+288>, argc=3, argv=0x7fffffffe310) at perf.c:390
> #7 0x000000000049e87c in handle_internal_command (argc=3, argv=0x7fffffffe310) at perf.c:451
> #8 0x000000000049e9c1 in run_argv (argcp=0x7fffffffe16c, argv=0x7fffffffe160) at perf.c:497
> #9 0x000000000049ed67 in main (argc=3, argv=0x7fffffffe310) at perf.c:624
> (gdb)

Nah, it was silly of me to use list_for_each_entry() for deletion..
Will send a fix soon.

Thanks,
Namhyung