diff options
-rw-r--r-- | tools/perf/util/string.c | 11 | ||||
-rw-r--r-- | tools/perf/util/string.h | 1 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 3 |
3 files changed, 14 insertions, 1 deletions
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c index c93eca9a7be3..04743d3e9039 100644 --- a/tools/perf/util/string.c +++ b/tools/perf/util/string.c @@ -1,3 +1,4 @@ +#include <string.h> #include "string.h" static int hex(char ch) @@ -32,3 +33,13 @@ int hex2u64(const char *ptr, u64 *long_val) return p - ptr; } + +char *strxfrchar(char *s, char from, char to) +{ + char *p = s; + + while ((p = strchr(p, from)) != NULL) + *p++ = to; + + return s; +} diff --git a/tools/perf/util/string.h b/tools/perf/util/string.h index 15c827475e7d..2c84bf65ba0f 100644 --- a/tools/perf/util/string.h +++ b/tools/perf/util/string.h @@ -4,6 +4,7 @@ #include "types.h" int hex2u64(const char *ptr, u64 *val); +char *strxfrchar(char *s, char from, char to); #define _STR(x) #x #define STR(x) _STR(x) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 4dfdefd5ec7e..e3eebdd682d9 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -189,7 +189,7 @@ struct symbol *dso__find_symbol(struct dso *self, u64 ip) size_t dso__fprintf(struct dso *self, FILE *fp) { - size_t ret = fprintf(fp, "dso: %s\n", self->long_name); + size_t ret = fprintf(fp, "dso: %s\n", self->short_name); struct rb_node *nd; for (nd = rb_first(&self->syms); nd; nd = rb_next(nd)) { @@ -977,6 +977,7 @@ static int dsos__load_modules_sym_dir(char *dirname, snprintf(dso_name, sizeof(dso_name), "[%.*s]", (int)(dot - dent->d_name), dent->d_name); + strxfrchar(dso_name, '-', '_'); map = kernel_maps__find_by_dso_name(dso_name); if (map == NULL) continue; |