提交 58d91a00 编写于 作者: N Namhyung Kim 提交者: Arnaldo Carvalho de Melo

perf tools: Do not try to call addr2line on non-binary files

No need to call addr2line since they don't have such information.
Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
Reviewed-by: NJiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1378876173-13363-6-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 f048d548
...@@ -259,9 +259,6 @@ static int hist_entry__srcline_snprintf(struct hist_entry *self, char *bf, ...@@ -259,9 +259,6 @@ static int hist_entry__srcline_snprintf(struct hist_entry *self, char *bf,
if (!self->ms.map) if (!self->ms.map)
goto out_ip; goto out_ip;
if (!strncmp(self->ms.map->dso->long_name, "/tmp/perf-", 10))
goto out_ip;
path = get_srcline(self->ms.map->dso->long_name, self->ip); path = get_srcline(self->ms.map->dso->long_name, self->ip);
self->srcline = path; self->srcline = path;
......
...@@ -57,11 +57,17 @@ char *get_srcline(const char *dso_name, unsigned long addr) ...@@ -57,11 +57,17 @@ char *get_srcline(const char *dso_name, unsigned long addr)
{ {
char *file; char *file;
unsigned line; unsigned line;
char *srcline; char *srcline = SRCLINE_UNKNOWN;
size_t size; size_t size;
if (dso_name[0] == '[')
goto out;
if (!strncmp(dso_name, "/tmp/perf-", 10))
goto out;
if (!addr2line(dso_name, addr, &file, &line)) if (!addr2line(dso_name, addr, &file, &line))
return SRCLINE_UNKNOWN; goto out;
/* just calculate actual length */ /* just calculate actual length */
size = snprintf(NULL, 0, "%s:%u", file, line) + 1; size = snprintf(NULL, 0, "%s:%u", file, line) + 1;
...@@ -73,6 +79,7 @@ char *get_srcline(const char *dso_name, unsigned long addr) ...@@ -73,6 +79,7 @@ char *get_srcline(const char *dso_name, unsigned long addr)
srcline = SRCLINE_UNKNOWN; srcline = SRCLINE_UNKNOWN;
free(file); free(file);
out:
return srcline; return srcline;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册