diff options
-rw-r--r-- | tools/perf/util/symbol-elf.c | 21 | ||||
-rw-r--r-- | tools/perf/util/symbol-minimal.c | 8 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 10 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 3 |
4 files changed, 25 insertions, 17 deletions
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 591594775904..492ebecfbfb6 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -525,6 +525,10 @@ static int dso__swap_init(struct dso *dso, unsigned char eidata) | |||
525 | return 0; | 525 | return 0; |
526 | } | 526 | } |
527 | 527 | ||
528 | bool symsrc__has_symtab(struct symsrc *ss) | ||
529 | { | ||
530 | return ss->symtab != NULL; | ||
531 | } | ||
528 | 532 | ||
529 | void symsrc__destroy(struct symsrc *ss) | 533 | void symsrc__destroy(struct symsrc *ss) |
530 | { | 534 | { |
@@ -616,7 +620,7 @@ out_close: | |||
616 | } | 620 | } |
617 | 621 | ||
618 | int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *ss, | 622 | int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *ss, |
619 | symbol_filter_t filter, int kmodule, int want_symtab) | 623 | symbol_filter_t filter, int kmodule) |
620 | { | 624 | { |
621 | struct kmap *kmap = dso->kernel ? map__kmap(map) : NULL; | 625 | struct kmap *kmap = dso->kernel ? map__kmap(map) : NULL; |
622 | struct map *curr_map = map; | 626 | struct map *curr_map = map; |
@@ -636,21 +640,16 @@ int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *ss, | |||
636 | 640 | ||
637 | dso->symtab_type = ss->type; | 641 | dso->symtab_type = ss->type; |
638 | 642 | ||
643 | if (!ss->symtab) { | ||
644 | ss->symtab = ss->dynsym; | ||
645 | ss->symshdr = ss->dynshdr; | ||
646 | } | ||
647 | |||
639 | elf = ss->elf; | 648 | elf = ss->elf; |
640 | ehdr = ss->ehdr; | 649 | ehdr = ss->ehdr; |
641 | sec = ss->symtab; | 650 | sec = ss->symtab; |
642 | shdr = ss->symshdr; | 651 | shdr = ss->symshdr; |
643 | 652 | ||
644 | if (sec == NULL) { | ||
645 | if (want_symtab) | ||
646 | goto out_elf_end; | ||
647 | |||
648 | sec = ss->dynsym; | ||
649 | shdr = ss->dynshdr; | ||
650 | if (sec == NULL) | ||
651 | goto out_elf_end; | ||
652 | } | ||
653 | |||
654 | opdsec = ss->opdsec; | 653 | opdsec = ss->opdsec; |
655 | opdshdr = ss->opdshdr; | 654 | opdshdr = ss->opdshdr; |
656 | opdidx = ss->opdidx; | 655 | opdidx = ss->opdidx; |
diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c index cc580c046c04..11c2c606ce77 100644 --- a/tools/perf/util/symbol-minimal.c +++ b/tools/perf/util/symbol-minimal.c | |||
@@ -260,6 +260,11 @@ out_close: | |||
260 | return -1; | 260 | return -1; |
261 | } | 261 | } |
262 | 262 | ||
263 | bool symsrc__has_symtab(struct symsrc *ss __used) | ||
264 | { | ||
265 | return false; | ||
266 | } | ||
267 | |||
263 | void symsrc__destroy(struct symsrc *ss) | 268 | void symsrc__destroy(struct symsrc *ss) |
264 | { | 269 | { |
265 | free(ss->name); | 270 | free(ss->name); |
@@ -275,8 +280,7 @@ int dso__synthesize_plt_symbols(struct dso *dso __used, | |||
275 | } | 280 | } |
276 | 281 | ||
277 | int dso__load_sym(struct dso *dso, struct map *map __used, struct symsrc *ss, | 282 | int dso__load_sym(struct dso *dso, struct map *map __used, struct symsrc *ss, |
278 | symbol_filter_t filter __used, int kmodule __used, | 283 | symbol_filter_t filter __used, int kmodule __used) |
279 | int want_symtab __used) | ||
280 | { | 284 | { |
281 | unsigned char *build_id[BUILD_ID_SIZE]; | 285 | unsigned char *build_id[BUILD_ID_SIZE]; |
282 | 286 | ||
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index f8a306865201..8e7d74ff6ba5 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1089,8 +1089,12 @@ restart: | |||
1089 | if (symsrc__init(&ss, dso, name, symtab_type) < 0) | 1089 | if (symsrc__init(&ss, dso, name, symtab_type) < 0) |
1090 | continue; | 1090 | continue; |
1091 | 1091 | ||
1092 | ret = dso__load_sym(dso, map, &ss, filter, 0, | 1092 | if (want_symtab && !symsrc__has_symtab(&ss)) { |
1093 | want_symtab); | 1093 | symsrc__destroy(&ss); |
1094 | continue; | ||
1095 | } | ||
1096 | |||
1097 | ret = dso__load_sym(dso, map, &ss, filter, 0); | ||
1094 | 1098 | ||
1095 | /* | 1099 | /* |
1096 | * Some people seem to have debuginfo files _WITHOUT_ debug | 1100 | * Some people seem to have debuginfo files _WITHOUT_ debug |
@@ -1376,7 +1380,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map, | |||
1376 | if (symsrc__init(&ss, dso, symfs_vmlinux, symtab_type)) | 1380 | if (symsrc__init(&ss, dso, symfs_vmlinux, symtab_type)) |
1377 | return -1; | 1381 | return -1; |
1378 | 1382 | ||
1379 | err = dso__load_sym(dso, map, &ss, filter, 0, 0); | 1383 | err = dso__load_sym(dso, map, &ss, filter, 0); |
1380 | symsrc__destroy(&ss); | 1384 | symsrc__destroy(&ss); |
1381 | 1385 | ||
1382 | if (err > 0) { | 1386 | if (err > 0) { |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 2981513ce1d4..fa9f6b1cdc46 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -252,6 +252,7 @@ struct symsrc { | |||
252 | void symsrc__destroy(struct symsrc *ss); | 252 | void symsrc__destroy(struct symsrc *ss); |
253 | int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, | 253 | int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, |
254 | enum dso_binary_type type); | 254 | enum dso_binary_type type); |
255 | bool symsrc__has_symtab(struct symsrc *ss); | ||
255 | 256 | ||
256 | #define DSO__SWAP(dso, type, val) \ | 257 | #define DSO__SWAP(dso, type, val) \ |
257 | ({ \ | 258 | ({ \ |
@@ -369,7 +370,7 @@ ssize_t dso__data_read_addr(struct dso *dso, struct map *map, | |||
369 | u8 *data, ssize_t size); | 370 | u8 *data, ssize_t size); |
370 | int dso__test_data(void); | 371 | int dso__test_data(void); |
371 | int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *ss, | 372 | int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *ss, |
372 | symbol_filter_t filter, int kmodule, int want_symtab); | 373 | symbol_filter_t filter, int kmodule); |
373 | int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, | 374 | int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, |
374 | struct map *map, symbol_filter_t filter); | 375 | struct map *map, symbol_filter_t filter); |
375 | 376 | ||