diff options
| -rw-r--r-- | tools/perf/builtin-probe.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 4fa73eca1d82..ad47bd4c50ef 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c | |||
| @@ -41,7 +41,6 @@ | |||
| 41 | #include "util/debugfs.h" | 41 | #include "util/debugfs.h" |
| 42 | #include "util/symbol.h" | 42 | #include "util/symbol.h" |
| 43 | #include "util/thread.h" | 43 | #include "util/thread.h" |
| 44 | #include "util/session.h" | ||
| 45 | #include "util/parse-options.h" | 44 | #include "util/parse-options.h" |
| 46 | #include "util/parse-events.h" /* For debugfs_path */ | 45 | #include "util/parse-events.h" /* For debugfs_path */ |
| 47 | #include "util/probe-finder.h" | 46 | #include "util/probe-finder.h" |
| @@ -59,8 +58,8 @@ static struct { | |||
| 59 | int nr_probe; | 58 | int nr_probe; |
| 60 | struct probe_point probes[MAX_PROBES]; | 59 | struct probe_point probes[MAX_PROBES]; |
| 61 | struct strlist *dellist; | 60 | struct strlist *dellist; |
| 62 | struct perf_session *psession; | 61 | struct map_groups kmap_groups; |
| 63 | struct map *kmap; | 62 | struct map *kmaps[MAP__NR_TYPES]; |
| 64 | struct line_range line_range; | 63 | struct line_range line_range; |
| 65 | } session; | 64 | } session; |
| 66 | 65 | ||
| @@ -122,7 +121,8 @@ static int opt_del_probe_event(const struct option *opt __used, | |||
| 122 | static void evaluate_probe_point(struct probe_point *pp) | 121 | static void evaluate_probe_point(struct probe_point *pp) |
| 123 | { | 122 | { |
| 124 | struct symbol *sym; | 123 | struct symbol *sym; |
| 125 | sym = map__find_symbol_by_name(session.kmap, pp->function, NULL); | 124 | sym = map__find_symbol_by_name(session.kmaps[MAP__FUNCTION], |
| 125 | pp->function, NULL); | ||
| 126 | if (!sym) | 126 | if (!sym) |
| 127 | die("Kernel symbol \'%s\' not found - probe not added.", | 127 | die("Kernel symbol \'%s\' not found - probe not added.", |
| 128 | pp->function); | 128 | pp->function); |
| @@ -131,12 +131,13 @@ static void evaluate_probe_point(struct probe_point *pp) | |||
| 131 | #ifndef NO_LIBDWARF | 131 | #ifndef NO_LIBDWARF |
| 132 | static int open_vmlinux(void) | 132 | static int open_vmlinux(void) |
| 133 | { | 133 | { |
| 134 | if (map__load(session.kmap, NULL) < 0) { | 134 | if (map__load(session.kmaps[MAP__FUNCTION], NULL) < 0) { |
| 135 | pr_debug("Failed to load kernel map.\n"); | 135 | pr_debug("Failed to load kernel map.\n"); |
| 136 | return -EINVAL; | 136 | return -EINVAL; |
| 137 | } | 137 | } |
| 138 | pr_debug("Try to open %s\n", session.kmap->dso->long_name); | 138 | pr_debug("Try to open %s\n", |
| 139 | return open(session.kmap->dso->long_name, O_RDONLY); | 139 | session.kmaps[MAP__FUNCTION]->dso->long_name); |
| 140 | return open(session.kmaps[MAP__FUNCTION]->dso->long_name, O_RDONLY); | ||
| 140 | } | 141 | } |
| 141 | 142 | ||
| 142 | static int opt_show_lines(const struct option *opt __used, | 143 | static int opt_show_lines(const struct option *opt __used, |
| @@ -212,12 +213,11 @@ static void init_vmlinux(void) | |||
| 212 | pr_debug("Use vmlinux: %s\n", symbol_conf.vmlinux_name); | 213 | pr_debug("Use vmlinux: %s\n", symbol_conf.vmlinux_name); |
| 213 | if (symbol__init() < 0) | 214 | if (symbol__init() < 0) |
| 214 | die("Failed to init symbol map."); | 215 | die("Failed to init symbol map."); |
| 215 | session.psession = perf_session__new(NULL, O_WRONLY, false); | 216 | |
| 216 | if (session.psession == NULL) | 217 | map_groups__init(&session.kmap_groups); |
| 217 | die("Failed to init perf_session."); | 218 | if (map_groups__create_kernel_maps(&session.kmap_groups, |
| 218 | session.kmap = session.psession->vmlinux_maps[MAP__FUNCTION]; | 219 | session.kmaps) < 0) |
| 219 | if (!session.kmap) | 220 | die("Failed to create kernel maps."); |
| 220 | die("Could not find kernel map.\n"); | ||
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | int cmd_probe(int argc, const char **argv, const char *prefix __used) | 223 | int cmd_probe(int argc, const char **argv, const char *prefix __used) |
