aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/symbol.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-11-20 17:51:24 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-21 08:11:32 -0500
commit6671cb1674e69e2aba3d610714bdd3e97a7b51ff (patch)
tree61eb72c744c19086b272af4b3da21ef959ae35d5 /tools/perf/util/symbol.c
parent96200591a34f8ecb98481c626125df43a2463b55 (diff)
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 4d75e745288f..3b23c18cd36b 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1230,7 +1230,7 @@ failure:
1230 return -1; 1230 return -1;
1231} 1231}
1232 1232
1233static int dsos__load_modules_sym(symbol_filter_t filter) 1233int dsos__load_modules_sym(symbol_filter_t filter)
1234{ 1234{
1235 struct utsname uts; 1235 struct utsname uts;
1236 char modules_path[PATH_MAX]; 1236 char modules_path[PATH_MAX];
@@ -1352,33 +1352,18 @@ static int dso__load_vmlinux(struct dso *self, struct map *map,
1352 return err; 1352 return err;
1353} 1353}
1354 1354
1355int dso__load_kernel_sym(struct dso *self, symbol_filter_t filter, int use_modules) 1355int dso__load_kernel_sym(struct dso *self, symbol_filter_t filter,
1356 int use_modules)
1356{ 1357{
1357 int err = -1; 1358 int err;
1358 1359
1359 kernel_map = map__new2(0, self); 1360 kernel_map = map__new2(0, self);
1360 if (kernel_map == NULL) 1361 if (kernel_map == NULL)
1361 goto out_delete_dso; 1362 return -1;
1362 1363
1363 kernel_map->map_ip = kernel_map->unmap_ip = identity__map_ip; 1364 kernel_map->map_ip = kernel_map->unmap_ip = identity__map_ip;
1364 1365
1365 if (use_modules && dsos__load_modules() < 0) {
1366 pr_warning("Failed to load list of modules in use! "
1367 "Continuing...\n");
1368 use_modules = 0;
1369 }
1370
1371 err = dso__load_vmlinux(self, kernel_map, self->name, filter); 1366 err = dso__load_vmlinux(self, kernel_map, self->name, filter);
1372 if (err > 0 && use_modules) {
1373 int syms = dsos__load_modules_sym(filter);
1374
1375 if (syms < 0)
1376 pr_warning("Failed to read module symbols!"
1377 " Continuing...\n");
1378 else
1379 err += syms;
1380 }
1381
1382 if (err <= 0) 1367 if (err <= 0)
1383 err = kernel_maps__load_kallsyms(filter, use_modules); 1368 err = kernel_maps__load_kallsyms(filter, use_modules);
1384 1369
@@ -1404,17 +1389,12 @@ int dso__load_kernel_sym(struct dso *self, symbol_filter_t filter, int use_modul
1404 } 1389 }
1405 1390
1406 return err; 1391 return err;
1407
1408out_delete_dso:
1409 dso__delete(self);
1410 return -1;
1411} 1392}
1412 1393
1413LIST_HEAD(dsos); 1394LIST_HEAD(dsos);
1414struct dso *vdso; 1395struct dso *vdso;
1415 1396
1416const char *vmlinux_name = "vmlinux"; 1397const char *vmlinux_name = "vmlinux";
1417int modules;
1418 1398
1419static void dsos__add(struct dso *dso) 1399static void dsos__add(struct dso *dso)
1420{ 1400{
@@ -1488,14 +1468,26 @@ struct dso *dsos__load_kernel(void)
1488 return kernel; 1468 return kernel;
1489} 1469}
1490 1470
1491int load_kernel(symbol_filter_t filter) 1471int load_kernel(symbol_filter_t filter, bool use_modules)
1492{ 1472{
1493 struct dso *kernel = dsos__load_kernel(); 1473 struct dso *kernel = dsos__load_kernel();
1494 1474
1495 if (kernel == NULL) 1475 if (kernel == NULL)
1496 return -1; 1476 return -1;
1497 1477
1498 return dso__load_kernel_sym(kernel, filter, modules); 1478 if (use_modules) {
1479 if (dsos__load_modules() < 0)
1480 pr_warning("Failed to load list of modules in use, "
1481 "continuing...\n");
1482 else if (dsos__load_modules_sym(filter) < 0)
1483 pr_warning("Failed to read module symbols, "
1484 "continuing...\n");
1485 }
1486
1487 if (dso__load_kernel_sym(kernel, filter, use_modules) < 0)
1488 pr_warning("Failed to read kernel symbols, continuing...\n");
1489
1490 return 0;
1499} 1491}
1500 1492
1501void symbol__init(unsigned int priv_size) 1493void symbol__init(unsigned int priv_size)