aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLin Ming <ming.m.lin@intel.com>2011-03-03 10:23:57 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-03-09 11:44:10 -0500
commit7ee235efe5f86f239ce73915fd2e15f4d14259c6 (patch)
tree25d412900cde7670239bdfdf0fee90103122bf61 /tools
parenta639dc64e52183a361c260e562e73b0800b89072 (diff)
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/524 Tested-by: Han 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: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/header.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index f6a929e74981..0866bcdb5e8e 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -270,11 +270,15 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
270 const char *name, bool is_kallsyms) 270 const char *name, bool is_kallsyms)
271{ 271{
272 const size_t size = PATH_MAX; 272 const size_t size = PATH_MAX;
273 char *realname = realpath(name, NULL), 273 char *realname, *filename = malloc(size),
274 *filename = malloc(size),
275 *linkname = malloc(size), *targetname; 274 *linkname = malloc(size), *targetname;
276 int len, err = -1; 275 int len, err = -1;
277 276
277 if (is_kallsyms)
278 realname = (char *)name;
279 else
280 realname = realpath(name, NULL);
281
278 if (realname == NULL || filename == NULL || linkname == NULL) 282 if (realname == NULL || filename == NULL || linkname == NULL)
279 goto out_free; 283 goto out_free;
280 284
@@ -306,7 +310,8 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
306 if (symlink(targetname, linkname) == 0) 310 if (symlink(targetname, linkname) == 0)
307 err = 0; 311 err = 0;
308out_free: 312out_free:
309 free(realname); 313 if (!is_kallsyms)
314 free(realname);
310 free(filename); 315 free(filename);
311 free(linkname); 316 free(linkname);
312 return err; 317 return err;