diff options
-rw-r--r-- | tools/perf/builtin-annotate.c | 5 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 3 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 10 | ||||
-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 |
6 files changed, 38 insertions, 35 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 77d50a6d6802..b6da1476ab1b 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -33,6 +33,7 @@ static int input; | |||
33 | static int full_paths; | 33 | static int full_paths; |
34 | 34 | ||
35 | static int print_line; | 35 | static int print_line; |
36 | static bool use_modules; | ||
36 | 37 | ||
37 | static unsigned long page_size; | 38 | static unsigned long page_size; |
38 | static unsigned long mmap_window = 32; | 39 | static unsigned long mmap_window = 32; |
@@ -636,7 +637,7 @@ static int __cmd_annotate(void) | |||
636 | exit(0); | 637 | exit(0); |
637 | } | 638 | } |
638 | 639 | ||
639 | if (load_kernel(symbol_filter) < 0) { | 640 | if (load_kernel(symbol_filter, use_modules) < 0) { |
640 | perror("failed to load kernel symbols"); | 641 | perror("failed to load kernel symbols"); |
641 | return EXIT_FAILURE; | 642 | return EXIT_FAILURE; |
642 | } | 643 | } |
@@ -742,7 +743,7 @@ static const struct option options[] = { | |||
742 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 743 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
743 | "dump raw trace in ASCII"), | 744 | "dump raw trace in ASCII"), |
744 | OPT_STRING('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"), | 745 | OPT_STRING('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"), |
745 | OPT_BOOLEAN('m', "modules", &modules, | 746 | OPT_BOOLEAN('m', "modules", &use_modules, |
746 | "load module symbols - WARNING: use only with -k and LIVE kernel"), | 747 | "load module symbols - WARNING: use only with -k and LIVE kernel"), |
747 | OPT_BOOLEAN('l', "print-line", &print_line, | 748 | OPT_BOOLEAN('l', "print-line", &print_line, |
748 | "print matching source lines (may be slow)"), | 749 | "print matching source lines (may be slow)"), |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 1a806d5f05cf..0af48401f089 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -38,6 +38,7 @@ static char *dso_list_str, *comm_list_str, *sym_list_str, | |||
38 | static struct strlist *dso_list, *comm_list, *sym_list; | 38 | static struct strlist *dso_list, *comm_list, *sym_list; |
39 | 39 | ||
40 | static int force; | 40 | static int force; |
41 | static bool use_modules; | ||
41 | 42 | ||
42 | static int full_paths; | 43 | static int full_paths; |
43 | static int show_nr_samples; | 44 | static int show_nr_samples; |
@@ -1023,7 +1024,7 @@ static const struct option options[] = { | |||
1023 | "dump raw trace in ASCII"), | 1024 | "dump raw trace in ASCII"), |
1024 | OPT_STRING('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"), | 1025 | OPT_STRING('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"), |
1025 | OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), | 1026 | OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), |
1026 | OPT_BOOLEAN('m', "modules", &modules, | 1027 | OPT_BOOLEAN('m', "modules", &use_modules, |
1027 | "load module symbols - WARNING: use only with -k and LIVE kernel"), | 1028 | "load module symbols - WARNING: use only with -k and LIVE kernel"), |
1028 | OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples, | 1029 | OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples, |
1029 | "Show a column with the number of samples"), | 1030 | "Show a column with the number of samples"), |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 6d770ac7be0b..48cc1084bc30 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -953,8 +953,16 @@ static int parse_symbols(void) | |||
953 | if (kernel == NULL) | 953 | if (kernel == NULL) |
954 | return -1; | 954 | return -1; |
955 | 955 | ||
956 | if (dsos__load_modules() < 0) | ||
957 | pr_debug("Couldn't read the complete list of modules, " | ||
958 | "continuing...\n"); | ||
959 | |||
960 | if (dsos__load_modules_sym(symbol_filter) < 0) | ||
961 | pr_warning("Failed to read module symbols, continuing...\n"); | ||
962 | |||
956 | if (dso__load_kernel_sym(kernel, symbol_filter, 1) <= 0) | 963 | if (dso__load_kernel_sym(kernel, symbol_filter, 1) <= 0) |
957 | return -1; | 964 | pr_debug("Couldn't read the complete list of kernel symbols, " |
965 | "continuing...\n"); | ||
958 | 966 | ||
959 | if (dump_symtab) | 967 | if (dump_symtab) |
960 | dsos__fprintf(stderr); | 968 | dsos__fprintf(stderr); |
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 */ |