aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r--tools/perf/util/symbol.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index b580fa82911a..fc6e12fe4b44 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -263,16 +263,26 @@ static size_t symbol__fprintf(struct symbol *sym, FILE *fp)
263 sym->name); 263 sym->name);
264} 264}
265 265
266size_t symbol__fprintf_symname(const struct symbol *sym, FILE *fp) 266size_t symbol__fprintf_symname_offs(const struct symbol *sym,
267 const struct addr_location *al, FILE *fp)
267{ 268{
268 const char *symname; 269 unsigned long offset;
270 size_t length;
269 271
270 if (sym && sym->name) 272 if (sym && sym->name) {
271 symname = sym->name; 273 length = fprintf(fp, "%s", sym->name);
272 else 274 if (al) {
273 symname = "[unknown]"; 275 offset = al->addr - sym->start;
276 length += fprintf(fp, "+0x%lx", offset);
277 }
278 return length;
279 } else
280 return fprintf(fp, "[unknown]");
281}
274 282
275 return fprintf(fp, "%s", symname); 283size_t symbol__fprintf_symname(const struct symbol *sym, FILE *fp)
284{
285 return symbol__fprintf_symname_offs(sym, NULL, fp);
276} 286}
277 287
278void dso__set_long_name(struct dso *dso, char *name) 288void dso__set_long_name(struct dso *dso, char *name)