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.kamen...@linaro.org>
Cc: Peter Zijlstra <a.p.zijls...@chello.nl>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Ingo Molnar <mi...@redhat.com>
Cc: Arnaldo Carvalho de Melo <a...@kernel.org>
Cc: Jiri Olsa <jo...@kernel.org>
Cc: Namhyung Kim <namhy...@kernel.org>
Cc: Adrian Hunter <adrian.hun...@intel.com>
Cc: Waiman Long <waiman.l...@hp.com>
Cc: David Ahern <dsah...@gmail.com>
Acked-and-tested-by: David Ahern <dsah...@gmail.com>
---
 tools/perf/util/dso.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 45be944..ca8d8d5 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -45,13 +45,13 @@ int dso__read_binary_type_filename(const struct dso *dso,
        case DSO_BINARY_TYPE__DEBUGLINK: {
                char *debuglink;
 
-               strncpy(filename, dso->long_name, size);
-               debuglink = filename + dso->long_name_len;
+               len = __symbol__join_symfs(filename, size, dso->long_name);
+               debuglink = filename + len;
                while (debuglink != filename && *debuglink != '/')
                        debuglink--;
                if (*debuglink == '/')
                        debuglink++;
-               ret = filename__read_debuglink(dso->long_name, debuglink,
+               ret = filename__read_debuglink(filename, debuglink,
                                               size - (debuglink - filename));
                }
                break;
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to