diff options
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/data_map.c | 2 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 46 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 7 |
3 files changed, 24 insertions, 31 deletions
diff --git a/tools/perf/util/data_map.c b/tools/perf/util/data_map.c index 5543e7d0487d..a444a2645c85 100644 --- a/tools/perf/util/data_map.c +++ b/tools/perf/util/data_map.c | |||
@@ -171,7 +171,7 @@ int mmap_dispatch_perf_file(struct perf_header **pheader, | |||
171 | goto out_delete; | 171 | goto out_delete; |
172 | 172 | ||
173 | err = -ENOMEM; | 173 | err = -ENOMEM; |
174 | if (load_kernel(NULL) < 0) { | 174 | if (load_kernel(NULL, 1) < 0) { |
175 | pr_err("failed to load kernel symbols\n"); | 175 | pr_err("failed to load kernel symbols\n"); |
176 | goto out_delete; | 176 | goto out_delete; |
177 | } | 177 | } |
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 | ||
1233 | static int dsos__load_modules_sym(symbol_filter_t filter) | 1233 | int 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 | ||
1355 | int dso__load_kernel_sym(struct dso *self, symbol_filter_t filter, int use_modules) | 1355 | int 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 | |||
1408 | out_delete_dso: | ||
1409 | dso__delete(self); | ||
1410 | return -1; | ||
1411 | } | 1392 | } |
1412 | 1393 | ||
1413 | LIST_HEAD(dsos); | 1394 | LIST_HEAD(dsos); |
1414 | struct dso *vdso; | 1395 | struct dso *vdso; |
1415 | 1396 | ||
1416 | const char *vmlinux_name = "vmlinux"; | 1397 | const char *vmlinux_name = "vmlinux"; |
1417 | int modules; | ||
1418 | 1398 | ||
1419 | static void dsos__add(struct dso *dso) | 1399 | static 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 | ||
1491 | int load_kernel(symbol_filter_t filter) | 1471 | int 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 | ||
1501 | void symbol__init(unsigned int priv_size) | 1493 | void symbol__init(unsigned int priv_size) |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index f0593a649c3d..3d9d346d101b 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -78,9 +78,11 @@ void dso__delete(struct dso *self); | |||
78 | struct symbol *dso__find_symbol(struct dso *self, u64 ip); | 78 | struct symbol *dso__find_symbol(struct dso *self, u64 ip); |
79 | 79 | ||
80 | int dsos__load_modules(void); | 80 | int dsos__load_modules(void); |
81 | int dsos__load_modules_sym(symbol_filter_t filter); | ||
81 | struct dso *dsos__findnew(const char *name); | 82 | struct dso *dsos__findnew(const char *name); |
82 | int dso__load(struct dso *self, struct map *map, symbol_filter_t filter); | 83 | int dso__load(struct dso *self, struct map *map, symbol_filter_t filter); |
83 | int dso__load_kernel_sym(struct dso *self, symbol_filter_t filter, int modules); | 84 | int dso__load_kernel_sym(struct dso *self, symbol_filter_t filter, |
85 | int use_modules); | ||
84 | void dsos__fprintf(FILE *fp); | 86 | void dsos__fprintf(FILE *fp); |
85 | size_t dsos__fprintf_buildid(FILE *fp); | 87 | size_t dsos__fprintf_buildid(FILE *fp); |
86 | 88 | ||
@@ -95,7 +97,7 @@ bool dsos__read_build_ids(void); | |||
95 | int build_id__sprintf(u8 *self, int len, char *bf); | 97 | int build_id__sprintf(u8 *self, int len, char *bf); |
96 | 98 | ||
97 | struct dso *dsos__load_kernel(void); | 99 | struct dso *dsos__load_kernel(void); |
98 | int load_kernel(symbol_filter_t filter); | 100 | int load_kernel(symbol_filter_t filter, bool use_modules); |
99 | 101 | ||
100 | void symbol__init(unsigned int priv_size); | 102 | void symbol__init(unsigned int priv_size); |
101 | 103 | ||
@@ -103,5 +105,4 @@ extern struct list_head dsos; | |||
103 | extern struct map *kernel_map; | 105 | extern struct map *kernel_map; |
104 | extern struct dso *vdso; | 106 | extern struct dso *vdso; |
105 | extern const char *vmlinux_name; | 107 | extern const char *vmlinux_name; |
106 | extern int modules; | ||
107 | #endif /* __PERF_SYMBOL */ | 108 | #endif /* __PERF_SYMBOL */ |