diff options
-rw-r--r-- | tools/perf/util/symbol.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 0500895a45af..2af4d7d22373 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -532,7 +532,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map, | |||
532 | struct machine *machine = kmaps->machine; | 532 | struct machine *machine = kmaps->machine; |
533 | struct map *curr_map = map; | 533 | struct map *curr_map = map; |
534 | struct symbol *pos; | 534 | struct symbol *pos; |
535 | int count = 0; | 535 | int count = 0, moved = 0; |
536 | struct rb_root *root = &self->symbols[map->type]; | 536 | struct rb_root *root = &self->symbols[map->type]; |
537 | struct rb_node *next = rb_first(root); | 537 | struct rb_node *next = rb_first(root); |
538 | int kernel_range = 0; | 538 | int kernel_range = 0; |
@@ -590,6 +590,11 @@ static int dso__split_kallsyms(struct dso *self, struct map *map, | |||
590 | char dso_name[PATH_MAX]; | 590 | char dso_name[PATH_MAX]; |
591 | struct dso *dso; | 591 | struct dso *dso; |
592 | 592 | ||
593 | if (count == 0) { | ||
594 | curr_map = map; | ||
595 | goto filter_symbol; | ||
596 | } | ||
597 | |||
593 | if (self->kernel == DSO_TYPE_GUEST_KERNEL) | 598 | if (self->kernel == DSO_TYPE_GUEST_KERNEL) |
594 | snprintf(dso_name, sizeof(dso_name), | 599 | snprintf(dso_name, sizeof(dso_name), |
595 | "[guest.kernel].%d", | 600 | "[guest.kernel].%d", |
@@ -615,7 +620,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map, | |||
615 | map_groups__insert(kmaps, curr_map); | 620 | map_groups__insert(kmaps, curr_map); |
616 | ++kernel_range; | 621 | ++kernel_range; |
617 | } | 622 | } |
618 | 623 | filter_symbol: | |
619 | if (filter && filter(curr_map, pos)) { | 624 | if (filter && filter(curr_map, pos)) { |
620 | discard_symbol: rb_erase(&pos->rb_node, root); | 625 | discard_symbol: rb_erase(&pos->rb_node, root); |
621 | symbol__delete(pos); | 626 | symbol__delete(pos); |
@@ -623,8 +628,9 @@ discard_symbol: rb_erase(&pos->rb_node, root); | |||
623 | if (curr_map != map) { | 628 | if (curr_map != map) { |
624 | rb_erase(&pos->rb_node, root); | 629 | rb_erase(&pos->rb_node, root); |
625 | symbols__insert(&curr_map->dso->symbols[curr_map->type], pos); | 630 | symbols__insert(&curr_map->dso->symbols[curr_map->type], pos); |
626 | } | 631 | ++moved; |
627 | count++; | 632 | } else |
633 | ++count; | ||
628 | } | 634 | } |
629 | } | 635 | } |
630 | 636 | ||
@@ -634,7 +640,7 @@ discard_symbol: rb_erase(&pos->rb_node, root); | |||
634 | dso__set_loaded(curr_map->dso, curr_map->type); | 640 | dso__set_loaded(curr_map->dso, curr_map->type); |
635 | } | 641 | } |
636 | 642 | ||
637 | return count; | 643 | return count + moved; |
638 | } | 644 | } |
639 | 645 | ||
640 | int dso__load_kallsyms(struct dso *self, const char *filename, | 646 | int dso__load_kallsyms(struct dso *self, const char *filename, |