summaryrefslogtreecommitdiff
path: root/tools/perf/util/symbol.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-01-04 16:19:29 -0200
committerIngo Molnar <mingo@elte.hu>2010-01-13 10:09:10 +0100
commitde1764892a61a3ed212973cc028c80dd083179dd (patch)
tree677ee82901a5c1e5ea34d8218e5fa859641de7dc /tools/perf/util/symbol.c
parentf92cb24c78a7c853435e46a20d1bd5c894378132 (diff)
perf session: Keep pointers to the vmlinux maps
So that tools such as 'perf probe' don't have to lookup '[kernel.kallsyms]' but instead access them directly after perf_session__create_kernel_maps or map_groups__create_kernel_maps. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Masami Hiramatsu <mhiramat@redhat.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <1262629169-22797-4-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r--tools/perf/util/symbol.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 5dffcd132d15..e290429e9c00 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1662,7 +1662,7 @@ size_t dsos__fprintf_buildid(FILE *fp)
__dsos__fprintf_buildid(&dsos__user, fp));
}
-static struct dso *dsos__create_kernel( const char *vmlinux)
+static struct dso *dsos__create_kernel(const char *vmlinux)
{
struct dso *kernel = dso__new(vmlinux ?: "[kernel.kallsyms]");
@@ -1691,29 +1691,26 @@ out_delete_kernel_dso:
return NULL;
}
-static int map_groups__create_kernel_maps(struct map_groups *self, const char *vmlinux)
+static int map_groups__create_kernel_maps(struct map_groups *self,
+ struct map *vmlinux_maps[MAP__NR_TYPES],
+ const char *vmlinux)
{
- struct map *functions, *variables;
struct dso *kernel = dsos__create_kernel(vmlinux);
+ enum map_type type;
if (kernel == NULL)
return -1;
- functions = map__new2(0, kernel, MAP__FUNCTION);
- if (functions == NULL)
- return -1;
+ for (type = 0; type < MAP__NR_TYPES; ++type) {
+ vmlinux_maps[type] = map__new2(0, kernel, type);
+ if (vmlinux_maps[type] == NULL)
+ return -1;
- variables = map__new2(0, kernel, MAP__VARIABLE);
- if (variables == NULL) {
- map__delete(functions);
- return -1;
+ vmlinux_maps[type]->map_ip =
+ vmlinux_maps[type]->unmap_ip = identity__map_ip;
+ map_groups__insert(self, vmlinux_maps[type]);
}
- functions->map_ip = functions->unmap_ip =
- variables->map_ip = variables->unmap_ip = identity__map_ip;
- map_groups__insert(self, functions);
- map_groups__insert(self, variables);
-
return 0;
}
@@ -1824,7 +1821,7 @@ out_free_comm_list:
int perf_session__create_kernel_maps(struct perf_session *self)
{
- if (map_groups__create_kernel_maps(&self->kmaps,
+ if (map_groups__create_kernel_maps(&self->kmaps, self->vmlinux_maps,
symbol_conf.vmlinux_name) < 0)
return -1;