1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PERF_MAP_GROUPS_H
3 #define __PERF_MAP_GROUPS_H
5 #include <linux/refcount.h>
6 #include <linux/rbtree.h>
9 #include <linux/types.h>
18 struct rb_root entries;
20 struct rw_semaphore lock;
23 void maps__insert(struct maps *maps, struct map *map);
24 void maps__remove(struct maps *maps, struct map *map);
25 struct map *maps__find(struct maps *maps, u64 addr);
26 struct map *maps__first(struct maps *maps);
27 struct map *map__next(struct map *map);
28 struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name, struct map **mapp);
32 struct machine *machine;
34 #ifdef HAVE_LIBUNWIND_SUPPORT
36 struct unwind_libunwind_ops *unwind_libunwind_ops;
40 #define KMAP_NAME_LEN 256
43 struct ref_reloc_sym *ref_reloc_sym;
44 struct map_groups *kmaps;
45 char name[KMAP_NAME_LEN];
48 struct map_groups *map_groups__new(struct machine *machine);
49 void map_groups__delete(struct map_groups *mg);
50 bool map_groups__empty(struct map_groups *mg);
52 static inline struct map_groups *map_groups__get(struct map_groups *mg)
55 refcount_inc(&mg->refcnt);
59 void map_groups__put(struct map_groups *mg);
60 void map_groups__init(struct map_groups *mg, struct machine *machine);
61 void map_groups__exit(struct map_groups *mg);
62 int map_groups__clone(struct thread *thread, struct map_groups *parent);
63 size_t map_groups__fprintf(struct map_groups *mg, FILE *fp);
65 void map_groups__insert(struct map_groups *mg, struct map *map);
67 static inline void map_groups__remove(struct map_groups *mg, struct map *map)
69 maps__remove(&mg->maps, map);
72 static inline struct map *map_groups__find(struct map_groups *mg, u64 addr)
74 return maps__find(&mg->maps, addr);
77 struct map *map_groups__first(struct map_groups *mg);
79 static inline struct map *map_groups__next(struct map *map)
81 return map__next(map);
84 struct symbol *map_groups__find_symbol(struct map_groups *mg, u64 addr, struct map **mapp);
85 struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg, const char *name, struct map **mapp);
87 struct addr_map_symbol;
89 int map_groups__find_ams(struct addr_map_symbol *ams);
91 int map_groups__fixup_overlappings(struct map_groups *mg, struct map *map, FILE *fp);
93 struct map *map_groups__find_by_name(struct map_groups *mg, const char *name);
95 int map_groups__merge_in(struct map_groups *kmaps, struct map *new_map);
97 #endif // __PERF_MAP_GROUPS_H