diff options
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r-- | tools/perf/util/symbol.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index b4cc7662677e..cd08027a6d2c 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -654,19 +654,24 @@ static int dso__split_kallsyms_for_kcore(struct dso *dso, struct map *map, | |||
654 | struct map_groups *kmaps = map__kmaps(map); | 654 | struct map_groups *kmaps = map__kmaps(map); |
655 | struct map *curr_map; | 655 | struct map *curr_map; |
656 | struct symbol *pos; | 656 | struct symbol *pos; |
657 | int count = 0, moved = 0; | 657 | int count = 0; |
658 | struct rb_root old_root = dso->symbols[map->type]; | ||
658 | struct rb_root *root = &dso->symbols[map->type]; | 659 | struct rb_root *root = &dso->symbols[map->type]; |
659 | struct rb_node *next = rb_first(root); | 660 | struct rb_node *next = rb_first(root); |
660 | 661 | ||
661 | if (!kmaps) | 662 | if (!kmaps) |
662 | return -1; | 663 | return -1; |
663 | 664 | ||
665 | *root = RB_ROOT; | ||
666 | |||
664 | while (next) { | 667 | while (next) { |
665 | char *module; | 668 | char *module; |
666 | 669 | ||
667 | pos = rb_entry(next, struct symbol, rb_node); | 670 | pos = rb_entry(next, struct symbol, rb_node); |
668 | next = rb_next(&pos->rb_node); | 671 | next = rb_next(&pos->rb_node); |
669 | 672 | ||
673 | rb_erase_init(&pos->rb_node, &old_root); | ||
674 | |||
670 | module = strchr(pos->name, '\t'); | 675 | module = strchr(pos->name, '\t'); |
671 | if (module) | 676 | if (module) |
672 | *module = '\0'; | 677 | *module = '\0'; |
@@ -674,28 +679,21 @@ static int dso__split_kallsyms_for_kcore(struct dso *dso, struct map *map, | |||
674 | curr_map = map_groups__find(kmaps, map->type, pos->start); | 679 | curr_map = map_groups__find(kmaps, map->type, pos->start); |
675 | 680 | ||
676 | if (!curr_map || (filter && filter(curr_map, pos))) { | 681 | if (!curr_map || (filter && filter(curr_map, pos))) { |
677 | rb_erase_init(&pos->rb_node, root); | ||
678 | symbol__delete(pos); | 682 | symbol__delete(pos); |
679 | } else { | 683 | continue; |
680 | pos->start -= curr_map->start - curr_map->pgoff; | ||
681 | if (pos->end) | ||
682 | pos->end -= curr_map->start - curr_map->pgoff; | ||
683 | if (curr_map->dso != map->dso) { | ||
684 | rb_erase_init(&pos->rb_node, root); | ||
685 | symbols__insert( | ||
686 | &curr_map->dso->symbols[curr_map->type], | ||
687 | pos); | ||
688 | ++moved; | ||
689 | } else { | ||
690 | ++count; | ||
691 | } | ||
692 | } | 684 | } |
685 | |||
686 | pos->start -= curr_map->start - curr_map->pgoff; | ||
687 | if (pos->end) | ||
688 | pos->end -= curr_map->start - curr_map->pgoff; | ||
689 | symbols__insert(&curr_map->dso->symbols[curr_map->type], pos); | ||
690 | ++count; | ||
693 | } | 691 | } |
694 | 692 | ||
695 | /* Symbols have been adjusted */ | 693 | /* Symbols have been adjusted */ |
696 | dso->adjust_symbols = 1; | 694 | dso->adjust_symbols = 1; |
697 | 695 | ||
698 | return count + moved; | 696 | return count; |
699 | } | 697 | } |
700 | 698 | ||
701 | /* | 699 | /* |
@@ -1438,9 +1436,9 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) | |||
1438 | if (lstat(dso->name, &st) < 0) | 1436 | if (lstat(dso->name, &st) < 0) |
1439 | goto out; | 1437 | goto out; |
1440 | 1438 | ||
1441 | if (st.st_uid && (st.st_uid != geteuid())) { | 1439 | if (!symbol_conf.force && st.st_uid && (st.st_uid != geteuid())) { |
1442 | pr_warning("File %s not owned by current user or root, " | 1440 | pr_warning("File %s not owned by current user or root, " |
1443 | "ignoring it.\n", dso->name); | 1441 | "ignoring it (use -f to override).\n", dso->name); |
1444 | goto out; | 1442 | goto out; |
1445 | } | 1443 | } |
1446 | 1444 | ||