diff options
Diffstat (limited to 'tools/perf/util/callchain.c')
-rw-r--r-- | tools/perf/util/callchain.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index 00229809a904..38da69c8c1ff 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c | |||
@@ -808,3 +808,22 @@ int fill_callchain_info(struct addr_location *al, struct callchain_cursor_node * | |||
808 | out: | 808 | out: |
809 | return 1; | 809 | return 1; |
810 | } | 810 | } |
811 | |||
812 | char *callchain_list__sym_name(struct callchain_list *cl, | ||
813 | char *bf, size_t bfsize, bool show_dso) | ||
814 | { | ||
815 | int printed; | ||
816 | |||
817 | if (cl->ms.sym) { | ||
818 | printed = scnprintf(bf, bfsize, "%s", cl->ms.sym->name); | ||
819 | } else | ||
820 | printed = scnprintf(bf, bfsize, "%#" PRIx64, cl->ip); | ||
821 | |||
822 | if (show_dso) | ||
823 | scnprintf(bf + printed, bfsize - printed, " %s", | ||
824 | cl->ms.map ? | ||
825 | cl->ms.map->dso->short_name : | ||
826 | "unknown"); | ||
827 | |||
828 | return bf; | ||
829 | } | ||