lkml.org 
[lkml]   [2015]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 7/9] perf report: Add support for srcfile sort key
> 
> AFAIK get_srcline() can return a string literal SRCLINE_UNKNOWN. It
> should not be freed or altered..

Good point. Here's a patch.

---

perf, tools: Check for SRCLINE_UNKNOWN case in srcline

Handle the SRCLINE_UNKNOWN case correctly when processing srcfile.

Pointed out by Namhyung.

Signed-off-by: Andi Kleen <ak@linux.intel.com>

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index c0c32b0..7e38716 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -330,6 +330,8 @@ static char *get_srcfile(struct hist_entry *e)

sf = get_srcline(map->dso, map__rip_2objdump(map, e->ip),
e->ms.sym, true);
+ if (!strcmp(sf, SRCLINE_UNKNOWN))
+ return no_srcfile;
p = strchr(sf, ':');
if (p && *sf) {
*p = 0;

\
 
 \ /
  Last update: 2015-08-11 16:01    [W:0.178 / U:0.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site