Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf symbols: debuglink should take symfs option into account

Currently code that tries to read corresponding debug symbol file from
.gnu_debuglink section (DSO_BINARY_TYPE__DEBUGLINK) does not take in
account symfs option, so filename__read_debuglink function cannot open
ELF file, if symfs option is used.

Fix is to add proper handling of symfs as it is done in other places:
use __symbol__join_symfs function to get real file name of target ELF
file.

Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
Tested-by: David Ahern <dsahern@gmail.com>
Acked-by: David Ahern <dsahern@gmail.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Anton Blanchard <anton@samba.org>
Cc: Avi Kivity <avi@cloudius-systems.com>
Cc: Dave Martin <Dave.Martin@arm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Waiman Long <Waiman.Long@hp.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/1422340442-4673-3-git-send-email-victor.kamensky@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Victor Kamensky and committed by
Arnaldo Carvalho de Melo
dc6254cf 4886f2ca

+3 -3
+3 -3
tools/perf/util/dso.c
··· 45 45 case DSO_BINARY_TYPE__DEBUGLINK: { 46 46 char *debuglink; 47 47 48 - strncpy(filename, dso->long_name, size); 49 - debuglink = filename + dso->long_name_len; 48 + len = __symbol__join_symfs(filename, size, dso->long_name); 49 + debuglink = filename + len; 50 50 while (debuglink != filename && *debuglink != '/') 51 51 debuglink--; 52 52 if (*debuglink == '/') 53 53 debuglink++; 54 - ret = filename__read_debuglink(dso->long_name, debuglink, 54 + ret = filename__read_debuglink(filename, debuglink, 55 55 size - (debuglink - filename)); 56 56 } 57 57 break;