From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753116AbdEGVyt (ORCPT ); Sun, 7 May 2017 17:54:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53374 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752088AbdEGVys (ORCPT ); Sun, 7 May 2017 17:54:48 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A90DE81254 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jolsa@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A90DE81254 Date: Sun, 7 May 2017 16:45:38 +0200 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH] perf, tools: Support srccode output Message-ID: <20170507144538.GA12933@krava> References: <20170505230029.23826-1-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170505230029.23826-1-andi@firstfloor.org> User-Agent: Mutt/1.8.0 (2017-02-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sun, 07 May 2017 14:45:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 05, 2017 at 04:00:29PM -0700, Andi Kleen wrote: SNIP > > +int map__fprintf_srccode(struct map *map, u64 addr, > + const char *prefix, FILE *fp) > +{ > + char *srcline; > + int ret = 0; > + > + if (map && map->dso) { > + srcline_full_filename = true; > + srcline = get_srcline(map->dso, > + map__rip_2objdump(map, addr), NULL, > + true, true); > + if (srcline != SRCLINE_UNKNOWN) { > + char srcfile[1024]; > + int line, len; > + char *srccode; > + if (sscanf(srcline, "%1023[^:]:%d", srcfile, &line) so get_srcline formats srcline and you parse it out back in here, I think it'd be better to factor __get_srcline and get the file and line directly thanks, jirka