lkml.org 
[lkml]   [2017]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf, tools: Support srccode output
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

\
 
 \ /
  Last update: 2017-05-07 23:55    [W:0.035 / U:0.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site