summaryrefslogtreecommitdiff
path: root/tools/perf/util/symbol.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-11-20 22:51:24 (GMT)
committerIngo Molnar <mingo@elte.hu>2009-11-21 13:11:32 (GMT)
commit6671cb1674e69e2aba3d610714bdd3e97a7b51ff (patch)
tree61eb72c744c19086b272af4b3da21ef959ae35d5 /tools/perf/util/symbol.c
parent96200591a34f8ecb98481c626125df43a2463b55 (diff)
downloadlinux-fsl-qoriq-6671cb1674e69e2aba3d610714bdd3e97a7b51ff.tar.xz
perf symbols: Remove unrelated actions from dso__load_kernel_sym
It should just load kernel symbols, not load the list of modules. There are more stuff to move to other routines, but lets do it in several steps. End goal is to be able to defer symbol table loading till we find a hit for that map address range. So that the kernel & modules are handled just like all the other DSOs in the system. Signed-off-by: Arnaldo Carvalho de Melo <acme@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: <1258757489-5978-1-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.c46
1 files changed, 19 insertions, 27 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 4d75e74..3b23c18 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1230,7 +1230,7 @@ failure:
return -1;
}
-static int dsos__load_modules_sym(symbol_filter_t filter)
+int dsos__load_modules_sym(symbol_filter_t filter)
{
struct utsname uts;
char modules_path[PATH_MAX];
@@ -1352,33 +1352,18 @@ static int dso__load_vmlinux(struct dso *self, struct map *map,
return err;
}
-int dso__load_kernel_sym(struct dso *self, symbol_filter_t filter, int use_modules)
+int dso__load_kernel_sym(struct dso *self, symbol_filter_t filter,
+ int use_modules)
{
- int err = -1;
+ int err;
kernel_map = map__new2(0, self);
if (kernel_map == NULL)
- goto out_delete_dso;
+ return -1;
kernel_map->map_ip = kernel_map->unmap_ip = identity__map_ip;
- if (use_modules && dsos__load_modules() < 0) {
- pr_warning("Failed to load list of modules in use! "
- "Continuing...\n");
- use_modules = 0;
- }
-
err = dso__load_vmlinux(self, kernel_map, self->name, filter);
- if (err > 0 && use_modules) {
- int syms = dsos__load_modules_sym(filter);
-
- if (syms < 0)
- pr_warning("Failed to read module symbols!"
- " Continuing...\n");
- else
- err += syms;
- }
-
if (err <= 0)
err = kernel_maps__load_kallsyms(filter, use_modules);
@@ -1404,17 +1389,12 @@ int dso__load_kernel_sym(struct dso *self, symbol_filter_t filter, int use_modul
}
return err;
-
-out_delete_dso:
- dso__delete(self);
- return -1;
}
LIST_HEAD(dsos);
struct dso *vdso;
const char *vmlinux_name = "vmlinux";
-int modules;
static void dsos__add(struct dso *dso)
{
@@ -1488,14 +1468,26 @@ struct dso *dsos__load_kernel(void)
return kernel;
}
-int load_kernel(symbol_filter_t filter)
+int load_kernel(symbol_filter_t filter, bool use_modules)
{
struct dso *kernel = dsos__load_kernel();
if (kernel == NULL)
return -1;
- return dso__load_kernel_sym(kernel, filter, modules);
+ if (use_modules) {
+ if (dsos__load_modules() < 0)
+ pr_warning("Failed to load list of modules in use, "
+ "continuing...\n");
+ else if (dsos__load_modules_sym(filter) < 0)
+ pr_warning("Failed to read module symbols, "
+ "continuing...\n");
+ }
+
+ if (dso__load_kernel_sym(kernel, filter, use_modules) < 0)
+ pr_warning("Failed to read kernel symbols, continuing...\n");
+
+ return 0;
}
void symbol__init(unsigned int priv_size)