diff options
author | Andi Kleen <ak@linux.intel.com> | 2014-11-13 03:05:24 +0100 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-11-24 22:03:46 +0100 |
commit | 23f0981bbd89fcc1496d0490ec39ca7c91599e32 (patch) | |
tree | 4ab315a987915d7f46a54c8d00b5bb1824e843fb /tools/perf/util/srcline.c | |
parent | perf tools: Collapse first level callchain entry if it has sibling (diff) | |
download | linux-23f0981bbd89fcc1496d0490ec39ca7c91599e32.tar.xz linux-23f0981bbd89fcc1496d0490ec39ca7c91599e32.zip |
perf callchain: Enable printing the srcline in the history
For lbr-as-callgraph we need to see the line number in the history,
because many LBR entries can be in a single function, and just
showing the same function name many times is not useful.
When the history code is configured to sort by address, also try to
resolve the address to a file:srcline and display this in the browser.
If that doesn't work still display the address.
This can be also useful without LBRs for understanding which call in a large
function (or in which inlined function) called something else.
Contains fixes from Namhyung Kim
v2: Refactor code into common function
v3: Fix GTK build
v4: Rebase
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1415844328-4884-7-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/srcline.c')
-rw-r--r-- | tools/perf/util/srcline.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index 77c180637138..ac877f96fed7 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -258,7 +258,7 @@ char *get_srcline(struct dso *dso, unsigned long addr) const char *dso_name; if (!dso->has_srcline) - return SRCLINE_UNKNOWN; + goto out; if (dso->symsrc_filename) dso_name = dso->symsrc_filename; @@ -289,7 +289,9 @@ out: dso->has_srcline = 0; dso__free_a2l(dso); } - return SRCLINE_UNKNOWN; + if (asprintf(&srcline, "%s[%lx]", dso->short_name, addr) < 0) + return SRCLINE_UNKNOWN; + return srcline; } void free_srcline(char *srcline) |