diff options
| author | Arnaldo Carvalho de Melo <[email protected]> | 2013-10-14 13:43:38 +0300 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <[email protected]> | 2013-10-14 10:29:02 -0300 |
| commit | 4e987712740a3634c19a6fedaf12577b26775dc5 (patch) | |
| tree | 4ae0dfe2471d60b608b5fc9cd049f35f6f17de47 | |
| parent | afba19d9dc8eba66ea26901708cf99354c637786 (diff) | |
perf symbols: Add map_groups__find_ams()
Add a function to find a symbol using an ip that might be on a different
map.
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Adrian Hunter <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
| -rw-r--r-- | tools/perf/util/map.c | 17 | ||||
| -rw-r--r-- | tools/perf/util/map.h | 4 |
2 files changed, 21 insertions, 0 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index 17ee458a0870..9dea404de3fa 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -371,6 +371,23 @@ struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg, return NULL; } +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->map->groups == NULL) + return -1; + ams->map = map_groups__find(ams->map->groups, ams->map->type, + ams->addr); + if (ams->map == NULL) + return -1; + } + + ams->al_addr = ams->map->map_ip(ams->map, ams->addr); + ams->sym = map__find_symbol(ams->map, ams->al_addr, filter); + + return ams->sym ? 0 : -1; +} + size_t __map_groups__fprintf_maps(struct map_groups *mg, enum map_type type, int verbose, FILE *fp) { diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h index 4886ca280536..0359b4a808f0 100644 --- a/tools/perf/util/map.h +++ b/tools/perf/util/map.h @@ -167,6 +167,10 @@ struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg, struct map **mapp, symbol_filter_t filter); +struct addr_map_symbol; + +int map_groups__find_ams(struct addr_map_symbol *ams, symbol_filter_t filter); + static inline struct symbol *map_groups__find_function_by_name(struct map_groups *mg, const char *name, struct map **mapp, |