Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1704989

[PATCH v2 13/14] perf util: do not consider empty files as valid srclines

From Milian Wolff <milian.wolff@kdab.com>
Newsgroups linux.kernel
Subject [PATCH v2 13/14] perf util: do not consider empty files as valid srclines
Date 2017-08-06 23:30 +0200
Message-ID <ubBhx-7tc-37@gated-at.bofh.it> (permalink)
References <ubBhw-7tc-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Yao Jin <yao.jin@linux.intel.com>
Signed-off-by: Milian Wolff <milian.wolff@kdab.com>
---
 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 0c5ee741c515..7bf38b78a1ba 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -168,6 +168,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)
@@ -297,6 +300,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, sym))
 					return 0;
-- 
2.13.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/14] generate full callchain cursor entries for inlined frames Milian Wolff <milian.wolff@kdab.com> - 2017-08-06 23:30 +0200
  [PATCH v2 12/14] perf report: use srcline from callchain for hist entries Milian Wolff <milian.wolff@kdab.com> - 2017-08-06 23:30 +0200
  [PATCH v2 07/14] perf report: compare symbol name for inlined frames when matching Milian Wolff <milian.wolff@kdab.com> - 2017-08-06 23:30 +0200
  [PATCH v2 05/14] perf report: mark inlined frames in output by " (inlined)" suffix Milian Wolff <milian.wolff@kdab.com> - 2017-08-06 23:30 +0200
  [PATCH v2 13/14] perf util: do not consider empty files as valid srclines Milian Wolff <milian.wolff@kdab.com> - 2017-08-06 23:30 +0200
    Re: [PATCH v2 13/14] perf util: do not consider empty files as valid  srclines Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-08-07 17:30 +0200
  [PATCH v2 03/14] perf report: create real callchain entries for inlined frames Milian Wolff <milian.wolff@kdab.com> - 2017-08-06 23:30 +0200

csiph-web