Lines Matching refs:map
9 #include "map.h"
21 void map__init(struct map *self, enum map_type type,
36 struct map *map__new(struct list_head *dsos__list, u64 start, u64 len,
40 struct map *self = malloc(sizeof(*self));
50 snprintf(newfilename, sizeof(newfilename), "/tmp/perf-%d.map", pid);
74 void map__delete(struct map *self)
79 void map__fixup_start(struct map *self)
89 void map__fixup_end(struct map *self)
101 int map__load(struct map *self, symbol_filter_t filter)
150 struct symbol *map__find_symbol(struct map *self, u64 addr,
159 struct symbol *map__find_symbol_by_name(struct map *self, const char *name,
171 struct map *map__clone(struct map *self)
173 struct map *map = malloc(sizeof(*self));
175 if (!map)
178 memcpy(map, self, sizeof(*self));
180 return map;
183 int map__overlap(struct map *l, struct map *r)
186 struct map *t = l;
197 size_t map__fprintf(struct map *self, FILE *fp)
205 * map->dso->adjust_symbols==1 for ET_EXEC-like cases.
207 u64 map__rip_2objdump(struct map *map, u64 rip)
209 u64 addr = map->dso->adjust_symbols ?
210 map->unmap_ip(map, rip) : /* RIP -> IP */
215 u64 map__objdump_2ip(struct map *map, u64 addr)
217 u64 ip = map->dso->adjust_symbols ?
219 map->unmap_ip(map, addr); /* RIP -> IP */
238 struct map *pos = rb_entry(next, struct map, rb_node);
248 struct map *pos, *n;
275 struct map *pos = rb_entry(next, struct map, rb_node);
279 * We may have references to this map, for
290 struct map **mapp,
293 struct map *map = map_groups__find(self, type, addr);
295 if (map != NULL) {
297 *mapp = map;
298 return map__find_symbol(map, map->map_ip(map, addr), filter);
307 struct map **mapp,
313 struct map *pos = rb_entry(nd, struct map, rb_node);
333 struct map *pos = rb_entry(nd, struct map, rb_node);
334 printed += fprintf(fp, "Map:");
357 struct map *pos;
361 printed += fprintf(fp, "Map:");
387 int map_groups__fixup_overlappings(struct map_groups *self, struct map *map,
390 struct rb_root *root = &self->maps[map->type];
395 struct map *pos = rb_entry(next, struct map, rb_node);
398 if (!map__overlap(pos, map))
403 map__fprintf(map, fp);
410 * overlapped by the new map:
412 if (map->start > pos->start) {
413 struct map *before = map__clone(pos);
420 before->end = map->start - 1;
426 if (map->end < pos->end) {
427 struct map *after = map__clone(pos);
434 after->start = map->end + 1;
444 list_add_tail(&pos->node, &self->removed_maps[map->type]);
463 struct map *map = rb_entry(nd, struct map, rb_node);
464 struct map *new = map__clone(map);
472 static u64 map__reloc_map_ip(struct map *map, u64 ip)
474 return ip + (s64)map->pgoff;
477 static u64 map__reloc_unmap_ip(struct map *map, u64 ip)
479 return ip - (s64)map->pgoff;
482 void map__reloc_vmlinux(struct map *self)
501 void maps__insert(struct rb_root *maps, struct map *map)
505 const u64 ip = map->start;
506 struct map *m;
510 m = rb_entry(parent, struct map, rb_node);
517 rb_link_node(&map->rb_node, parent, p);
518 rb_insert_color(&map->rb_node, maps);
521 void maps__remove(struct rb_root *self, struct map *map)
523 rb_erase(&map->rb_node, self);
526 struct map *maps__find(struct rb_root *maps, u64 ip)
530 struct map *m;
534 m = rb_entry(parent, struct map, rb_node);