[PATCH 04/10] perf symbols: Add dso__find_symbol_nocache()

From: Adrian Hunter
Date: Fri Jan 20 2023 - 07:35:35 EST


Symbols should not be cached when there are more symbols still to add.
Add dso__find_symbol_nocache() to facilitate that.

Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
---
tools/perf/util/symbol.c | 5 +++++
tools/perf/util/symbol.h | 1 +
2 files changed, 6 insertions(+)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index a3a165ae933a..a024f06f75d8 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -556,6 +556,11 @@ struct symbol *dso__find_symbol(struct dso *dso, u64 addr)
return dso->last_find_result.symbol;
}

+struct symbol *dso__find_symbol_nocache(struct dso *dso, u64 addr)
+{
+ return symbols__find(&dso->symbols, addr);
+}
+
struct symbol *dso__first_symbol(struct dso *dso)
{
return symbols__first(&dso->symbols);
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index f735108c4d4e..2fdeb22bd02f 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -148,6 +148,7 @@ void dso__delete_symbol(struct dso *dso,
struct symbol *sym);

struct symbol *dso__find_symbol(struct dso *dso, u64 addr);
+struct symbol *dso__find_symbol_nocache(struct dso *dso, u64 addr);
struct symbol *dso__find_symbol_by_name(struct dso *dso, const char *name);

struct symbol *symbol__next_by_name(struct symbol *sym);
--
2.34.1