[PATCH v1 3/8] perf tools: Check system path when check debuginfo
From: Namhyung Kim
Date: Mon Sep 28 2026 - 01:52:20 EST
The debuginfo__new() has a fallback to try the given path, but it seems
that it can check SYSTEM_PATH_DSO type in the dso__find_dbginfo_type()
instead.
One corner case would be when dso__new() fails in debuginfo__new() but
it should be rare and memory is exhausted. I think it's fine to fail
for that case.
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/util/debuginfo.c | 12 +++---------
tools/perf/util/dso.c | 1 +
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/tools/perf/util/debuginfo.c b/tools/perf/util/debuginfo.c
index d6bd0fcc22648f0e..2669d5f5ee6121d4 100644
--- a/tools/perf/util/debuginfo.c
+++ b/tools/perf/util/debuginfo.c
@@ -101,7 +101,7 @@ struct debuginfo *debuginfo__new(const char *path)
/* Try to open distro debuginfo files */
dso = dso__new(path);
if (!dso)
- goto out;
+ return NULL;
/*
* Set the build id for DSO_BINARY_TYPE__BUILDID_DEBUGINFO. Don't block
@@ -114,18 +114,12 @@ struct debuginfo *debuginfo__new(const char *path)
dso__find_dbginfo_type(dso);
if (dso__read_binary_type_filename(dso, dso__dbginfo_type(dso), &nil,
buf, PATH_MAX) < 0)
- goto out;
+ return NULL;
dinfo = __debuginfo__new(buf);
dso__put(dso);
-out:
- if (dinfo)
- return dinfo;
-
- /* if failed to open all distro debuginfo, open given binary */
- symbol__join_symfs(buf, path);
- return __debuginfo__new(buf);
+ return dinfo;
}
void debuginfo__delete(struct debuginfo *dbg)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 10c4cd35b6d9464b..512f2bb61e8f2a2f 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -2117,6 +2117,7 @@ void dso__find_dbginfo_type(struct dso *dso)
DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO,
DSO_BINARY_TYPE__BUILDID_DEBUGINFO,
DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO,
+ DSO_BINARY_TYPE__SYSTEM_PATH_DSO,
DSO_BINARY_TYPE__NOT_FOUND,
};
const enum dso_binary_type *type;
--
2.55.0