diff options
author | Franck Bui-Huu <fbuihuu@gmail.com> | 2010-12-10 08:06:03 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-12-16 06:41:45 -0500 |
commit | fd930ff91e7fda18f7790984a98489a85edb7c71 (patch) | |
tree | 5210fee0494c7be8233c0e0d5479a0cc5773bc02 /tools/perf | |
parent | d949750fed168b6553ca11ed19e4affd19d7a4d7 (diff) |
perf probe: Fix use of kernel image path given by 'k' option
Users were not being able to have the explicitely specified vmlinux
pathname used, instead a search on the vmlinux path was always being
made.
Reported-by: Francis Moreau <francis.moro@gmail.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: 2nddept-manager@sdl.hitachi.co.jp
Cc: Francis Moreau <francis.moro@gmail.com>
Cc: Franck Bui-Huu <vagabon.xyz@gmail.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
LPU-Reference: <m3hbelydz8.fsf_-_@gmail.com>
Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-probe.c | 5 | ||||
-rw-r--r-- | tools/perf/util/probe-event.c | 15 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 4 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 2 |
4 files changed, 21 insertions, 5 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 2e000c068cc5..add163c9f0e7 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c | |||
@@ -249,6 +249,11 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used) | |||
249 | !params.show_lines)) | 249 | !params.show_lines)) |
250 | usage_with_options(probe_usage, options); | 250 | usage_with_options(probe_usage, options); |
251 | 251 | ||
252 | /* | ||
253 | * Only consider the user's kernel image path if given. | ||
254 | */ | ||
255 | symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL); | ||
256 | |||
252 | if (params.list_events) { | 257 | if (params.list_events) { |
253 | if (params.mod_events) { | 258 | if (params.mod_events) { |
254 | pr_err(" Error: Don't use --list with --add/--del.\n"); | 259 | pr_err(" Error: Don't use --list with --add/--del.\n"); |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 3b6a5297bf16..b71acd6423cb 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -114,6 +114,8 @@ static struct symbol *__find_kernel_function_by_name(const char *name, | |||
114 | const char *kernel_get_module_path(const char *module) | 114 | const char *kernel_get_module_path(const char *module) |
115 | { | 115 | { |
116 | struct dso *dso; | 116 | struct dso *dso; |
117 | struct map *map; | ||
118 | const char *vmlinux_name; | ||
117 | 119 | ||
118 | if (module) { | 120 | if (module) { |
119 | list_for_each_entry(dso, &machine.kernel_dsos, node) { | 121 | list_for_each_entry(dso, &machine.kernel_dsos, node) { |
@@ -123,10 +125,17 @@ const char *kernel_get_module_path(const char *module) | |||
123 | } | 125 | } |
124 | pr_debug("Failed to find module %s.\n", module); | 126 | pr_debug("Failed to find module %s.\n", module); |
125 | return NULL; | 127 | return NULL; |
128 | } | ||
129 | |||
130 | map = machine.vmlinux_maps[MAP__FUNCTION]; | ||
131 | dso = map->dso; | ||
132 | |||
133 | vmlinux_name = symbol_conf.vmlinux_name; | ||
134 | if (vmlinux_name) { | ||
135 | if (dso__load_vmlinux(dso, map, vmlinux_name, NULL) <= 0) | ||
136 | return NULL; | ||
126 | } else { | 137 | } else { |
127 | dso = machine.vmlinux_maps[MAP__FUNCTION]->dso; | 138 | if (dso__load_vmlinux_path(dso, map, NULL) < 0) { |
128 | if (dso__load_vmlinux_path(dso, | ||
129 | machine.vmlinux_maps[MAP__FUNCTION], NULL) < 0) { | ||
130 | pr_debug("Failed to load kernel map.\n"); | 139 | pr_debug("Failed to load kernel map.\n"); |
131 | return NULL; | 140 | return NULL; |
132 | } | 141 | } |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index d628c8d1cf5e..439ab947daf4 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1780,8 +1780,8 @@ out_failure: | |||
1780 | return -1; | 1780 | return -1; |
1781 | } | 1781 | } |
1782 | 1782 | ||
1783 | static int dso__load_vmlinux(struct dso *self, struct map *map, | 1783 | int dso__load_vmlinux(struct dso *self, struct map *map, |
1784 | const char *vmlinux, symbol_filter_t filter) | 1784 | const char *vmlinux, symbol_filter_t filter) |
1785 | { | 1785 | { |
1786 | int err = -1, fd; | 1786 | int err = -1, fd; |
1787 | 1787 | ||
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 038f2201ee09..6c6eafdb932d 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -166,6 +166,8 @@ void dso__sort_by_name(struct dso *self, enum map_type type); | |||
166 | struct dso *__dsos__findnew(struct list_head *head, const char *name); | 166 | struct dso *__dsos__findnew(struct list_head *head, const char *name); |
167 | 167 | ||
168 | int dso__load(struct dso *self, struct map *map, symbol_filter_t filter); | 168 | int dso__load(struct dso *self, struct map *map, symbol_filter_t filter); |
169 | int dso__load_vmlinux(struct dso *self, struct map *map, | ||
170 | const char *vmlinux, symbol_filter_t filter); | ||
169 | int dso__load_vmlinux_path(struct dso *self, struct map *map, | 171 | int dso__load_vmlinux_path(struct dso *self, struct map *map, |
170 | symbol_filter_t filter); | 172 | symbol_filter_t filter); |
171 | int dso__load_kallsyms(struct dso *self, const char *filename, struct map *map, | 173 | int dso__load_kallsyms(struct dso *self, const char *filename, struct map *map, |