On Thu, Oct 20, 2016 at 06:02:24PM -0500, Kim Phillips wrote: SNIP
> (gdb) bt > #0 c2c_browser__update_nr_entries (hb=<optimized out>, hb=<optimized out>) > at builtin-c2c.c:2142 > #1 perf_c2c__hists_browse (hists=0x8b2d90 <c2c+240>) at builtin-c2c.c:2287 > #2 perf_c2c_display (session=0x205b1a0) at builtin-c2c.c:2316 > #3 perf_c2c__report (argv=<optimized out>, argc=<optimized out>) at > builtin-c2c.c:2621 > #4 cmd_c2c (argc=<optimized out>, argv=<optimized out>, prefix=<optimized > out>) at builtin-c2c.c:2748 > #5 0x000000000048df61 in run_builtin (p=p@entry=0x8be168 <commands+72>, > argc=argc@entry=2, argv=argv@entry=0x7fffffffddb0) > at perf.c:358 > #6 0x00000000004249b6 in handle_internal_command (argv=0x7fffffffddb0, > argc=2) at perf.c:420 > #7 run_argv (argv=0x7fffffffdb40, argcp=0x7fffffffdb4c) at perf.c:466 > #8 main (argc=2, argv=0x7fffffffddb0) at perf.c:610 > (gdb) > > All the above work fine when run under sudo. ugh, stupid mistake.. attached patch fixes that for me thanks, jirka --- Kim reported crash when there's no data stored. In this case the TUI code crashes in c2c_browser__update_nr_entries, because we dont check the initial rb_tree node for NULL. Adding the missing check. Reported-by: Kim Phillips <kim.phill...@arm.com> Signed-off-by: Jiri Olsa <jo...@kernel.org> --- tools/perf/builtin-c2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index dc4f0636dfa1..c6d0dda594d9 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -2135,14 +2135,14 @@ static void c2c_browser__update_nr_entries(struct hist_browser *hb) u64 nr_entries = 0; struct rb_node *nd = rb_first(&hb->hists->entries); - do { + while (nd) { struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node); if (!he->filtered) nr_entries++; nd = rb_next(nd); - } while (nd); + } hb->nr_non_filtered_entries = nr_entries; } -- 2.7.4