pref tools: Make 'struct addr_map_symbol' contain 'struct map_symbol'

So that we pass that substructure around and with it consolidate lots of
functions that receive a (map, symbol) pair and now can receive just a
'struct map_symbol' pointer.

This further paves the way to add 'struct map_groups' to 'struct
map_symbol' so that we can have all we need for annotation so that we
can ditch 'struct map'->groups, i.e. have the map_groups pointer in a
more central place, avoiding the pointer in the 'struct map' that have
tons of instances.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-fs90ttd9q12l7989fo7pw81q@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo
2019-11-04 15:57:38 -03:00
parent 5f0fef8ac3
commit d46a4cdf49
10 changed files with 114 additions and 125 deletions

View File

@@ -705,18 +705,18 @@ struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg,
int map_groups__find_ams(struct map_groups *mg, struct addr_map_symbol *ams)
{
if (ams->addr < ams->map->start || ams->addr >= ams->map->end) {
if (ams->addr < ams->ms.map->start || ams->addr >= ams->ms.map->end) {
if (mg == NULL)
return -1;
ams->map = map_groups__find(mg, ams->addr);
if (ams->map == NULL)
ams->ms.map = map_groups__find(mg, ams->addr);
if (ams->ms.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);
ams->al_addr = ams->ms.map->map_ip(ams->ms.map, ams->addr);
ams->ms.sym = map__find_symbol(ams->ms.map, ams->al_addr);
return ams->sym ? 0 : -1;
return ams->ms.sym ? 0 : -1;
}
static size_t maps__fprintf(struct maps *maps, FILE *fp)