aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/map.c')
-rw-r--r--tools/perf/util/map.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index cc33486ad9e..115654c469c 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -86,6 +86,25 @@ out_delete:
86 return NULL; 86 return NULL;
87} 87}
88 88
89/*
90 * Constructor variant for modules (where we know from /proc/modules where
91 * they are loaded) and for vmlinux, where only after we load all the
92 * symbols we'll know where it starts and ends.
93 */
94struct map *map__new2(u64 start, struct dso *dso, enum map_type type)
95{
96 struct map *map = calloc(1, (sizeof(*map) +
97 (dso->kernel ? sizeof(struct kmap) : 0)));
98 if (map != NULL) {
99 /*
100 * ->end will be filled after we load all the symbols
101 */
102 map__init(map, type, start, 0, 0, dso);
103 }
104
105 return map;
106}
107
89void map__delete(struct map *self) 108void map__delete(struct map *self)
90{ 109{
91 free(self); 110 free(self);