Commit 8ad94c60 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Ingo Molnar

perf probe: Don't use a perf_session instance just to resolve symbols

With the recent modifications done to untie the session and
symbol layers, 'perf probe' now can use just the symbols layer.
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 8d92c02a
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include "util/debugfs.h" #include "util/debugfs.h"
#include "util/symbol.h" #include "util/symbol.h"
#include "util/thread.h" #include "util/thread.h"
#include "util/session.h"
#include "util/parse-options.h" #include "util/parse-options.h"
#include "util/parse-events.h" /* For debugfs_path */ #include "util/parse-events.h" /* For debugfs_path */
#include "util/probe-finder.h" #include "util/probe-finder.h"
...@@ -59,8 +58,8 @@ static struct { ...@@ -59,8 +58,8 @@ static struct {
int nr_probe; int nr_probe;
struct probe_point probes[MAX_PROBES]; struct probe_point probes[MAX_PROBES];
struct strlist *dellist; struct strlist *dellist;
struct perf_session *psession; struct map_groups kmap_groups;
struct map *kmap; struct map *kmaps[MAP__NR_TYPES];
struct line_range line_range; struct line_range line_range;
} session; } session;
...@@ -122,7 +121,8 @@ static int opt_del_probe_event(const struct option *opt __used, ...@@ -122,7 +121,8 @@ static int opt_del_probe_event(const struct option *opt __used,
static void evaluate_probe_point(struct probe_point *pp) static void evaluate_probe_point(struct probe_point *pp)
{ {
struct symbol *sym; struct symbol *sym;
sym = map__find_symbol_by_name(session.kmap, pp->function, NULL); sym = map__find_symbol_by_name(session.kmaps[MAP__FUNCTION],
pp->function, NULL);
if (!sym) if (!sym)
die("Kernel symbol \'%s\' not found - probe not added.", die("Kernel symbol \'%s\' not found - probe not added.",
pp->function); pp->function);
...@@ -131,12 +131,13 @@ static void evaluate_probe_point(struct probe_point *pp) ...@@ -131,12 +131,13 @@ static void evaluate_probe_point(struct probe_point *pp)
#ifndef NO_LIBDWARF #ifndef NO_LIBDWARF
static int open_vmlinux(void) static int open_vmlinux(void)
{ {
if (map__load(session.kmap, NULL) < 0) { if (map__load(session.kmaps[MAP__FUNCTION], NULL) < 0) {
pr_debug("Failed to load kernel map.\n"); pr_debug("Failed to load kernel map.\n");
return -EINVAL; return -EINVAL;
} }
pr_debug("Try to open %s\n", session.kmap->dso->long_name); pr_debug("Try to open %s\n",
return open(session.kmap->dso->long_name, O_RDONLY); session.kmaps[MAP__FUNCTION]->dso->long_name);
return open(session.kmaps[MAP__FUNCTION]->dso->long_name, O_RDONLY);
} }
static int opt_show_lines(const struct option *opt __used, static int opt_show_lines(const struct option *opt __used,
...@@ -212,12 +213,11 @@ static void init_vmlinux(void) ...@@ -212,12 +213,11 @@ static void init_vmlinux(void)
pr_debug("Use vmlinux: %s\n", symbol_conf.vmlinux_name); pr_debug("Use vmlinux: %s\n", symbol_conf.vmlinux_name);
if (symbol__init() < 0) if (symbol__init() < 0)
die("Failed to init symbol map."); die("Failed to init symbol map.");
session.psession = perf_session__new(NULL, O_WRONLY, false);
if (session.psession == NULL) map_groups__init(&session.kmap_groups);
die("Failed to init perf_session."); if (map_groups__create_kernel_maps(&session.kmap_groups,
session.kmap = session.psession->vmlinux_maps[MAP__FUNCTION]; session.kmaps) < 0)
if (!session.kmap) die("Failed to create kernel maps.");
die("Could not find kernel map.\n");
} }
int cmd_probe(int argc, const char **argv, const char *prefix __used) int cmd_probe(int argc, const char **argv, const char *prefix __used)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment