perf tools: Use symfs when opening debuginfo by path
Namhyung Kim
maintainerPATCH 1/1 perf tools: Use symfs when opening debuginfo by path
I found that it failed to load a binary using --symfs option. Say I have a binary in /home/user/prog/xxx and a perf data file with it. If I move them to a different machine and use --symfs, it tries to find the binary in some locations under symfs using dso__read_binary_type_filename(), but not the last one.
${symfs}/usr/lib/debug/home/user/prog/xxx.debug
${symfs}/usr/lib/debug/home/user/prog/xxx
${symfs}/home/user/prog/.debug/xxx
/home/user/prog/xxxIt should check ${symfs}/home/usr/prog/xxx. Let's fix it.
--- tools/perf/util/debuginfo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/util/debuginfo.c +5 -1
@@ -125,8 +125,12 @@ struct debuginfo *debuginfo__new(const char *path)dso__put (dso); out: +if (dinfo) +return dinfo; +/* if failed to open all distro debuginfo, open given binary */ -return dinfo ? :__debuginfo__new (path); +symbol__join_symfs (buf, path); +return __debuginfo__new (buf); }void debuginfo__delete (struct debuginfo *dbg)
Signature · 1 line
2.48.1.502.g6dc24dfdaf-goog
Quoted 12 lines · Namhyung Kim
I found that it failed to load a binary using --symfs option. Say I have a binary in
/home/user/prog/xxxand a perf data file with it. If I move them to a different machine and use --symfs, it tries to find the binary in some locations under symfs usingdso__read_binary_type_filename(), but not the last one.${symfs}/usr/lib/debug/home/user/prog/xxx.debug ${symfs}/usr/lib/debug/home/user/prog/xxx ${symfs}/home/user/prog/.debug/xxx /home/user/prog/xxx
Quoted 4 lines
It should check ${symfs}/home/usr/prog/xxx. Let's fix it.
Cc Masami Hiramatsu <[email protected]>Signed-off-by Namhyung Kim <[email protected]>
Thanks,
Ian
Quoted 25 lines
--- tools/perf/util/debuginfo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tools/perf/util/debuginfo.c +5
-2@@ -125,8 +125,12 @@ struct debuginfo *debuginfo__new(const char *path)dso__put (dso); out: +if (dinfo) +return dinfo; +/* if failed to open all distro debuginfo, open given binary */ -return dinfo ? :__debuginfo__new (path); +symbol__join_symfs (buf, path); +return __debuginfo__new (buf); }void debuginfo__delete (struct debuginfo *dbg) --2.48.1.502.g6dc24dfdaf-goog
Quoted 11 lines · On Wed, 12 Feb 2025 14:14:45 -0800 Namhyung Kim <[email protected]> wrote:
I found that it failed to load a binary using --symfs option. Say I have a binary in
/home/user/prog/xxxand a perf data file with it. If I move them to a different machine and use --symfs, it tries to find the binary in some locations under symfs usingdso__read_binary_type_filename(), but not the last one.${symfs}/usr/lib/debug/home/user/prog/xxx.debug ${symfs}/usr/lib/debug/home/user/prog/xxx ${symfs}/home/user/prog/.debug/xxx /home/user/prog/xxx
Quoted 4 lines
It should check ${symfs}/home/usr/prog/xxx. Let's fix it.
Cc Masami Hiramatsu <[email protected]>Signed-off-by Namhyung Kim <[email protected]>
Good catch! This looks good to me.
Thanks!
Quoted 25 lines
--- tools/perf/util/debuginfo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tools/perf/util/debuginfo.c +5
-1@@ -125,8 +125,12 @@ struct debuginfo *debuginfo__new(const char *path)dso__put (dso); out: +if (dinfo) +return dinfo; +/* if failed to open all distro debuginfo, open given binary */ -return dinfo ? :__debuginfo__new (path); +symbol__join_symfs (buf, path); +return __debuginfo__new (buf); }void debuginfo__delete (struct debuginfo *dbg)Signature · 1 line
2.48.1.502.g6dc24dfdaf-goog
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
Quoted 6 lines · Namhyung Kim
I found that it failed to load a binary using --symfs option. Say I have a binary in
/home/user/prog/xxxand a perf data file with it. If I move them to a different machine and use --symfs, it tries to find the binary in some locations under symfs usingdso__read_binary_type_filename(), but not the last one.
Quoted 6 lines
${symfs}/usr/lib/debug/home/user/prog/xxx.debug ${symfs}/usr/lib/debug/home/user/prog/xxx ${symfs}/home/user/prog/.debug/xxx /home/user/prog/xxx[...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung