lkml.org 
[lkml]   [2014]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/8] perf, tools: Enable printing the srcline in the history
On Fri, Sep 26, 2014 at 04:37:11PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>

SNIP

> - if (chain->ms.sym)
> - ret += fprintf(fp, " %s\n", chain->ms.sym->name);
> - else
> - ret += fprintf(fp, " %p\n",
> - (void *)(long)chain->ip);
> + ret += fprintf(fp, " %s\n", callchain_list__sym_name(chain,
> + bf, sizeof(bf), false));
> }
>
> return ret;
> diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
> index 265457c..b7ee210 100644
> --- a/tools/perf/util/callchain.c
> +++ b/tools/perf/util/callchain.c
> @@ -655,3 +655,32 @@ int fill_callchain_info(struct addr_location *al, struct callchain_cursor_node *
> out:
> return 1;
> }
> +
> +char *callchain_list__sym_name(struct callchain_list *cl,
> + char *bf, size_t bfsize, bool show_dso)
> +{
> + int printed;
> +
> + if (cl->ms.sym) {
> + if (callchain_param.key == CCKEY_ADDRESS &&
> + cl->ms.map && !cl->srcline)
> + cl->srcline = get_srcline(cl->ms.map->dso,
> + map__rip_2objdump(cl->ms.map,
> + cl->ip));
> + if (cl->srcline)
> + printed = scnprintf(bf, bfsize, "%s %s",
> + cl->ms.sym->name, cl->srcline);
> + else
> + printed = scnprintf(bf, bfsize, "%s",
> + cl->ms.sym->name);
> + } else
> + printed = scnprintf(bf, bfsize, "%#" PRIx64, cl->ip);
> +
> + if (show_dso)
> + scnprintf(bf + printed, bfsize - printed, " %s",
> + cl->ms.map ?
> + cl->ms.map->dso->short_name :
> + "unknown");
> +
> + return bf;

could you please get the callchain_list__sym_name factoring code
separated of the new changes you introduce?

thanks,
jirka


\
 
 \ /
  Last update: 2014-10-20 20:01    [W:0.133 / U:2.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site