Commit 7ee235ef authored by Lin Ming's avatar Lin Ming Committed by Arnaldo Carvalho de Melo

perf symbols: Avoid resolving [kernel.kallsyms] to real path for buildid cache

kallsyms has a virtual file name [kernel.kallsyms].  Currently, it can't
be added to buildid cache successfully because the code
(build_id_cache__add_s) tries to resolve [kernel.kallsyms] to a real
absolute pathname and that fails.

Fixes it by not resolving it and just use the name [kernel.kallsyms].
So dir ~/.debug/[kernel.kallsyms] is created.

Original bug report at:
https://lkml.org/lkml/2011/3/1/524Tested-by: default avatarHan Pingtian <phan@redhat.com>
Cc: Han Pingtian <phan@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1299165837-27817-1-git-send-email-ming.m.lin@intel.com>
Signed-off-by: default avatarLin Ming <ming.m.lin@intel.com>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent a639dc64
...@@ -270,11 +270,15 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, ...@@ -270,11 +270,15 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
const char *name, bool is_kallsyms) const char *name, bool is_kallsyms)
{ {
const size_t size = PATH_MAX; const size_t size = PATH_MAX;
char *realname = realpath(name, NULL), char *realname, *filename = malloc(size),
*filename = malloc(size),
*linkname = malloc(size), *targetname; *linkname = malloc(size), *targetname;
int len, err = -1; int len, err = -1;
if (is_kallsyms)
realname = (char *)name;
else
realname = realpath(name, NULL);
if (realname == NULL || filename == NULL || linkname == NULL) if (realname == NULL || filename == NULL || linkname == NULL)
goto out_free; goto out_free;
...@@ -306,7 +310,8 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, ...@@ -306,7 +310,8 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
if (symlink(targetname, linkname) == 0) if (symlink(targetname, linkname) == 0)
err = 0; err = 0;
out_free: out_free:
free(realname); if (!is_kallsyms)
free(realname);
free(filename); free(filename);
free(linkname); free(linkname);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment