[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230531115014.161454-2-asavkov@redhat.com>
Date: Wed, 31 May 2023 13:50:13 +0200
From: Artem Savkov <asavkov@...hat.com>
To: linux-perf-users@...r.kernel.org,
Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
linux-kernel@...r.kernel.org, Artem Savkov <asavkov@...hat.com>
Subject: [PATCH 1/2] perf util: move symbol__new_unresolved() to util/symbol.c
Make symbol__new_unresolved() available through util/symbol.h
so it can be later used from builtin-c2c.
Signed-off-by: Artem Savkov <asavkov@...hat.com>
---
tools/perf/ui/browsers/hists.c | 22 ----------------------
tools/perf/util/symbol.c | 22 ++++++++++++++++++++++
tools/perf/util/symbol.h | 1 +
3 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 69c81759a64f9..10d2243d27504 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2471,28 +2471,6 @@ do_annotate(struct hist_browser *browser, struct popup_action *act)
return 0;
}
-static struct symbol *symbol__new_unresolved(u64 addr, struct map *map)
-{
- struct annotated_source *src;
- struct symbol *sym;
- char name[64];
-
- snprintf(name, sizeof(name), "%.*" PRIx64, BITS_PER_LONG / 4, addr);
-
- sym = symbol__new(addr, ANNOTATION_DUMMY_LEN, 0, 0, name);
- if (sym) {
- src = symbol__hists(sym, 1);
- if (!src) {
- symbol__delete(sym);
- return NULL;
- }
-
- dso__insert_symbol(map__dso(map), sym);
- }
-
- return sym;
-}
-
static int
add_annotate_opt(struct hist_browser *browser __maybe_unused,
struct popup_action *act, char **optstr,
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 6b9c55784b56a..297a903f72777 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -294,6 +294,28 @@ void maps__fixup_end(struct maps *maps)
up_write(maps__lock(maps));
}
+struct symbol *symbol__new_unresolved(u64 addr, struct map *map)
+{
+ struct annotated_source *src;
+ struct symbol *sym;
+ char name[64];
+
+ snprintf(name, sizeof(name), "%.*" PRIx64, BITS_PER_LONG / 4, addr);
+
+ sym = symbol__new(addr, ANNOTATION_DUMMY_LEN, 0, 0, name);
+ if (sym) {
+ src = symbol__hists(sym, 1);
+ if (!src) {
+ symbol__delete(sym);
+ return NULL;
+ }
+
+ dso__insert_symbol(map__dso(map), sym);
+ }
+
+ return sym;
+}
+
struct symbol *symbol__new(u64 start, u64 len, u8 binding, u8 type, const char *name)
{
size_t namelen = strlen(name) + 1;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 7558735543c25..4d47748716627 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -176,6 +176,7 @@ void symbol__exit(void);
void symbol__elf_init(void);
int symbol__annotation_init(void);
+struct symbol *symbol__new_unresolved(u64 addr, struct map *map);
struct symbol *symbol__new(u64 start, u64 len, u8 binding, u8 type, const char *name);
size_t __symbol__fprintf_symname_offs(const struct symbol *sym,
const struct addr_location *al,
--
2.40.1
Powered by blists - more mailing lists