From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756665AbdELMTR (ORCPT ); Fri, 12 May 2017 08:19:17 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33900 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751323AbdELMTP (ORCPT ); Fri, 12 May 2017 08:19:15 -0400 Date: Fri, 12 May 2017 21:19:03 +0900 From: Namhyung Kim To: Milian Wolff Cc: Linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , David Ahern , Peter Zijlstra , Yao Jin , kernel-team@lge.com Subject: Re: [PATCH] perf report: don't crash on invalid maps in `-g srcline` mode Message-ID: <20170512121903.GA3839@danjae.aot.lge.com> References: <20170509205046.21473-1-milian.wolff@kdab.com> <20170510060423.GB2667@sejong> <1866798.U7tsNezOxe@agathebauer> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1866798.U7tsNezOxe@agathebauer> User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 12, 2017 at 12:23:06PM +0200, Milian Wolff wrote: > On Mittwoch, 10. Mai 2017 08:04:23 CEST Namhyung Kim wrote: > > On Tue, May 09, 2017 at 10:50:46PM +0200, Milian Wolff wrote: > > > > > > diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c > > > index 9ab68682c6d0..295f0846fd84 100644 > > > --- a/tools/perf/util/callchain.c > > > +++ b/tools/perf/util/callchain.c > > > @@ -642,13 +642,22 @@ static enum match_result match_chain_strings(const > > > char *left,> > > > static enum match_result match_chain_srcline(struct callchain_cursor_node > > > *node,> > > > struct callchain_list *cnode) > > > > > > { > > > > > > - char *left = get_srcline(cnode->ms.map->dso, > > > - map__rip_2objdump(cnode->ms.map, cnode->ip), > > > - cnode->ms.sym, true, false); > > > - char *right = get_srcline(node->map->dso, > > > - map__rip_2objdump(node->map, node->ip), > > > - node->sym, true, false); > > > - enum match_result ret = match_chain_strings(left, right); > > > + char *left = NULL; > > > + char *right = NULL; > > > + enum match_result ret = MATCH_ERROR; > > > + > > > + if (!node->map || !cnode->ms.map) > > > + return ret; > > > > This makes it fall back to function/address matching below if one of > > srcline is not available. But it'll just show many "??:0" entries > > IMHO. Maybe we can use same logic in util/sort.c:cmp_null instead.. > > Yes, that could be done but I think it's not directly related to the patch/fix > at hand. Would it be OK if I change this behavior in a separate patch? I'm OK with that. Thanks, Namhyung