perf maps: Introduce maps__find_symbol_by_name()

Out of map_groups__find_symbol_by_name(), so that we can turn this later
one first into a call to maps__find_symbol_by_name(MAP__FUNCTION) +
MAP__VARIABLE, and then to just one call, we'll merge MAP__FUNCTION with
MAP__VARIABLE maps, to simplify the code.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-pvkar0jacqn92g148u9sqttt@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 272ed29a
...@@ -553,13 +553,9 @@ struct symbol *map_groups__find_symbol(struct map_groups *mg, ...@@ -553,13 +553,9 @@ struct symbol *map_groups__find_symbol(struct map_groups *mg,
return NULL; return NULL;
} }
struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg, struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name,
enum map_type type, struct map **mapp, symbol_filter_t filter)
const char *name,
struct map **mapp,
symbol_filter_t filter)
{ {
struct maps *maps = &mg->maps[type];
struct symbol *sym; struct symbol *sym;
struct rb_node *nd; struct rb_node *nd;
...@@ -583,6 +579,17 @@ struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg, ...@@ -583,6 +579,17 @@ struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg,
return sym; return sym;
} }
struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg,
enum map_type type,
const char *name,
struct map **mapp,
symbol_filter_t filter)
{
struct symbol *sym = maps__find_symbol_by_name(&mg->maps[type], name, mapp, filter);
return sym;
}
int map_groups__find_ams(struct addr_map_symbol *ams, symbol_filter_t filter) int map_groups__find_ams(struct addr_map_symbol *ams, symbol_filter_t filter)
{ {
if (ams->addr < ams->map->start || ams->addr >= ams->map->end) { if (ams->addr < ams->map->start || ams->addr >= ams->map->end) {
......
...@@ -190,6 +190,8 @@ void maps__remove(struct maps *maps, struct map *map); ...@@ -190,6 +190,8 @@ void maps__remove(struct maps *maps, struct map *map);
struct map *maps__find(struct maps *maps, u64 addr); struct map *maps__find(struct maps *maps, u64 addr);
struct map *maps__first(struct maps *maps); struct map *maps__first(struct maps *maps);
struct map *map__next(struct map *map); struct map *map__next(struct map *map);
struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name,
struct map **mapp, symbol_filter_t filter);
void map_groups__init(struct map_groups *mg, struct machine *machine); void map_groups__init(struct map_groups *mg, struct machine *machine);
void map_groups__exit(struct map_groups *mg); void map_groups__exit(struct map_groups *mg);
int map_groups__clone(struct map_groups *mg, int map_groups__clone(struct map_groups *mg,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment