diff options
author | Arnaldo Carvalho de Melo <acme@kernel.org> | 2014-07-29 10:21:58 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-31 09:58:21 -0300 |
commit | 972f393bc8870e236edbd2ea0150a8da85b709e2 (patch) | |
tree | 6578c82fca4534588702d0fe146b166749245983 /tools/perf/util/util.h | |
parent | 5f1c4225f6bcb20cc004b271dc72b96d0da29e9e (diff) | |
download | lwn-972f393bc8870e236edbd2ea0150a8da85b709e2.tar.gz lwn-972f393bc8870e236edbd2ea0150a8da85b709e2.zip |
perf symbols: Make sure --symfs usage includes the path separator
Minchan reported that perf failed to load vmlinux if --symfs argument
doesn't end with '/' character.
Fix it by making sure that the '/' path separator is used when composing
pathnames with a --symfs provided directory name.
Reported-by: Minchan Kim <minchan@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-8n4s6b6zvsez5ktanw006125@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/util.h')
-rw-r--r-- | tools/perf/util/util.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 66864364ccb4..38af77550c75 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h @@ -68,6 +68,7 @@ #include <sys/socket.h> #include <sys/ioctl.h> #include <inttypes.h> +#include <linux/kernel.h> #include <linux/magic.h> #include <linux/types.h> #include <sys/ttydefaults.h> @@ -317,6 +318,21 @@ unsigned long parse_tag_value(const char *str, struct parse_tag *tags); #define SRCLINE_UNKNOWN ((char *) "??:0") +static inline int path__join(char *bf, size_t size, + const char *path1, const char *path2) +{ + return scnprintf(bf, size, "%s%s%s", path1, path1[0] ? "/" : "", path2); +} + +static inline int path__join3(char *bf, size_t size, + const char *path1, const char *path2, + const char *path3) +{ + return scnprintf(bf, size, "%s%s%s%s%s", + path1, path1[0] ? "/" : "", + path2, path2[0] ? "/" : "", path3); +} + struct dso; char *get_srcline(struct dso *dso, unsigned long addr); |