Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752697AbdHNRvR (ORCPT ); Mon, 14 Aug 2017 13:51:17 -0400 Received: from terminus.zytor.com ([65.50.211.136]:38533 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751565AbdHNRvP (ORCPT ); Mon, 14 Aug 2017 13:51:15 -0400 Date: Mon, 14 Aug 2017 10:48:52 -0700 From: tip-bot for Milian Wolff Message-ID: Cc: yao.jin@linux.intel.com, namhyung@kernel.org, acme@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org, tglx@linutronix.de, a.p.zijlstra@chello.nl, dsahern@gmail.com, milian.wolff@kdab.com Reply-To: yao.jin@linux.intel.com, namhyung@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org, a.p.zijlstra@chello.nl, tglx@linutronix.de, dsahern@gmail.com, milian.wolff@kdab.com In-Reply-To: <20170806212446.24925-14-milian.wolff@kdab.com> References: <20170806212446.24925-14-milian.wolff@kdab.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf srcline: Do not consider empty files as valid srclines Git-Commit-ID: d964b1cdbd94f359f1f65f81440be84ceb45978e X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1905 Lines: 49 Commit-ID: d964b1cdbd94f359f1f65f81440be84ceb45978e Gitweb: http://git.kernel.org/tip/d964b1cdbd94f359f1f65f81440be84ceb45978e Author: Milian Wolff AuthorDate: Sun, 6 Aug 2017 23:24:45 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 11 Aug 2017 16:06:31 -0300 perf srcline: Do not consider empty files as valid srclines Sometimes we get a non-null, but empty, string for the filename from bfd. This then results in srclines of the form ":0", which is different from the canonical SRCLINE_UNKNOWN in the form "??:0". Set the file to NULL if it is empty to fix this. Signed-off-by: Milian Wolff Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Yao Jin Link: http://lkml.kernel.org/r/20170806212446.24925-14-milian.wolff@kdab.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/srcline.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index ebc88a7..ed8e8d2 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -155,6 +155,9 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data) a2l->found = bfd_find_nearest_line(abfd, section, a2l->syms, pc - vma, &a2l->filename, &a2l->funcname, &a2l->line); + + if (a2l->filename && !strlen(a2l->filename)) + a2l->filename = NULL; } static struct a2l_data *addr2line_init(const char *path) @@ -248,6 +251,9 @@ static int addr2line(const char *dso_name, u64 addr, &a2l->funcname, &a2l->line) && cnt++ < MAX_INLINE_NEST) { + if (a2l->filename && !strlen(a2l->filename)) + a2l->filename = NULL; + if (node != NULL) { if (inline_list__append_dso_a2l(dso, node)) return 0;