aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/util
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/event.h8
-rw-r--r--tools/perf/util/map.c6
-rw-r--r--tools/perf/util/symbol.c8
3 files changed, 16 insertions, 6 deletions
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index c2e62be6279..6b5be56a827 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -82,6 +82,7 @@ struct map {
u64 end;
u64 pgoff;
u64 (*map_ip)(struct map *, u64);
+ u64 (*unmap_ip)(struct map *, u64);
struct dso *dso;
};
@@ -90,7 +91,12 @@ static inline u64 map__map_ip(struct map *map, u64 ip)
return ip - map->start + map->pgoff;
}
-static inline u64 vdso__map_ip(struct map *map __used, u64 ip)
+static inline u64 map__unmap_ip(struct map *map, u64 ip)
+{
+ return ip + map->start - map->pgoff;
+}
+
+static inline u64 identity__map_ip(struct map *map __used, u64 ip)
{
return ip;
}
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 804e0238273..4e203d144f9 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -54,9 +54,11 @@ static int strcommon(const char *pathname, char *cwd, int cwdlen)
goto out_delete;
if (self->dso == vdso || anon)
- self->map_ip = vdso__map_ip;
- else
+ self->map_ip = self->unmap_ip = identity__map_ip;
+ else {
self->map_ip = map__map_ip;
+ self->unmap_ip = map__unmap_ip;
+ }
}
return self;
out_delete:
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index faa84f5d4f5..3350119f690 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -337,7 +337,7 @@ static int kernel_maps__split_kallsyms(symbol_filter_t filter, int use_modules)
return -1;
}
- map->map_ip = vdso__map_ip;
+ map->map_ip = map->unmap_ip = identity__map_ip;
kernel_maps__insert(map);
++kernel_range;
}
@@ -790,7 +790,8 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name,
dso__delete(curr_dso);
goto out_elf_end;
}
- curr_map->map_ip = vdso__map_ip;
+ curr_map->map_ip = identity__map_ip;
+ curr_map->unmap_ip = identity__map_ip;
curr_dso->origin = DSO__ORIG_KERNEL;
kernel_maps__insert(curr_map);
dsos__add(curr_dso);
@@ -1158,6 +1159,7 @@ static struct map *map__new2(u64 start, struct dso *dso)
self->pgoff = 0;
self->dso = dso;
self->map_ip = map__map_ip;
+ self->unmap_ip = map__unmap_ip;
RB_CLEAR_NODE(&self->rb_node);
}
return self;
@@ -1259,7 +1261,7 @@ int dsos__load_kernel(const char *vmlinux, unsigned int sym_priv_size,
if (kernel_map == NULL)
goto out_delete_dso;
- kernel_map->map_ip = vdso__map_ip;
+ kernel_map->map_ip = kernel_map->unmap_ip = identity__map_ip;
if (use_modules && dsos__load_modules(sym_priv_size) < 0) {
fprintf(stderr, "Failed to load list of modules in use! "