[PATCH v1 7/8] perf tools: Looks symbol file first when check debuginfo

From: Namhyung Kim

Date: Mon Sep 28 2026 - 01:53:01 EST


There's a high chance that the file containing the symbol table also has
debug information. Let's check that first before other locations.

Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/util/dso.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index c36192e7ea557b47..9c8b963906a7e88c 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -2133,6 +2133,18 @@ void dso__find_dbginfo_type(struct dso *dso)
return;
dso__set_debuginfo_searched(dso);

+ /* Maybe debug info is in the same file with the symbol table */
+ path = dso__get_filename(dso, "", &decomp, dso__symtab_type(dso));
+ if (path) {
+ found = filename__has_section(path, ".debug_info");
+ dso__put_filename(dso, path, decomp);
+ if (found) {
+ dso__set_dbginfo_type(dso, dso__symtab_type(dso));
+ return;
+ }
+ }
+
+ /* Otherwise check distro debug locations */
for (type = dbginfo_types; *type != DSO_BINARY_TYPE__NOT_FOUND; type++) {
path = dso__get_filename(dso, "", &decomp, *type);
if (path == NULL)
--
2.55.0