[PATCH v1 1/8] perf tools: Add dso->dbginfo_type field

From: Namhyung Kim

Date: Mon Sep 28 2026 - 01:51:24 EST


It saves where the debug info is available for the given DSO. It's
sometimes different than where binary data or symbol table is located.
So let's add a new field to save the info.

Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/util/dso.c | 1 +
tools/perf/util/dso.h | 16 ++++++++++++++++
2 files changed, 17 insertions(+)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 11db461f2032bc41..90a6f661278a9c81 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -1721,6 +1721,7 @@ struct dso *dso__new_id(const char *name, const struct dso_id *id)
dso->data.status = DSO_DATA_STATUS_UNKNOWN;
dso->symtab_type = DSO_BINARY_TYPE__NOT_FOUND;
dso->binary_type = DSO_BINARY_TYPE__NOT_FOUND;
+ dso->dbginfo_type = DSO_BINARY_TYPE__NOT_FOUND;
dso->is_64_bit = (sizeof(void *) == 8);
dso->loaded = 0;
dso->rel = 0;
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index e7d5f4bbf89497c0..34d187d1fc00efdc 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -328,8 +328,14 @@ DECLARE_RC_STRUCT(dso) {
enum dso_load_errno load_errno;
u16 long_name_len;
u16 short_name_len;
+ /*
+ * DSO file data can be spread into multiple places. Distros usually
+ * place debug info to a separate file. Symbol tables may exist in
+ * the binary or the debug file. Let's separate them.
+ */
enum dso_binary_type symtab_type:8;
enum dso_binary_type binary_type:8;
+ enum dso_binary_type dbginfo_type:8;
enum dso_space_type kernel:2;
enum dso_swap_type needs_swap:2;
bool is_kmod:1;
@@ -997,6 +1003,16 @@ static inline bool dso__is_kallsyms(const struct dso *dso)
return is_guest_kallsyms_pid_name(name);
}

+static inline enum dso_binary_type dso__dbginfo_type(const struct dso *dso)
+{
+ return RC_CHK_ACCESS(dso)->dbginfo_type;
+}
+
+static inline void dso__set_dbginfo_type(struct dso *dso, enum dso_binary_type bt)
+{
+ RC_CHK_ACCESS(dso)->dbginfo_type = bt;
+}
+
bool dso__is_object_file(const struct dso *dso);

void dso__free_a2l(struct dso *dso);
--
2.55.0