diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/annotate.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 4ab2f11ee6f4..646e38dad01b 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -830,6 +830,30 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map, | |||
830 | return 0; | 830 | return 0; |
831 | } | 831 | } |
832 | 832 | ||
833 | static void delete_last_nop(struct symbol *sym) | ||
834 | { | ||
835 | struct annotation *notes = symbol__annotation(sym); | ||
836 | struct list_head *list = ¬es->src->source; | ||
837 | struct disasm_line *dl; | ||
838 | |||
839 | while (!list_empty(list)) { | ||
840 | dl = list_entry(list->prev, struct disasm_line, node); | ||
841 | |||
842 | if (dl->ins && dl->ins->ops) { | ||
843 | if (dl->ins->ops != &nop_ops) | ||
844 | return; | ||
845 | } else { | ||
846 | if (!strstr(dl->line, " nop ") && | ||
847 | !strstr(dl->line, " nopl ") && | ||
848 | !strstr(dl->line, " nopw ")) | ||
849 | return; | ||
850 | } | ||
851 | |||
852 | list_del(&dl->node); | ||
853 | disasm_line__free(dl); | ||
854 | } | ||
855 | } | ||
856 | |||
833 | int symbol__annotate(struct symbol *sym, struct map *map, size_t privsize) | 857 | int symbol__annotate(struct symbol *sym, struct map *map, size_t privsize) |
834 | { | 858 | { |
835 | struct dso *dso = map->dso; | 859 | struct dso *dso = map->dso; |
@@ -923,6 +947,13 @@ fallback: | |||
923 | if (symbol__parse_objdump_line(sym, map, file, privsize) < 0) | 947 | if (symbol__parse_objdump_line(sym, map, file, privsize) < 0) |
924 | break; | 948 | break; |
925 | 949 | ||
950 | /* | ||
951 | * kallsyms does not have symbol sizes so there may a nop at the end. | ||
952 | * Remove it. | ||
953 | */ | ||
954 | if (dso__is_kcore(dso)) | ||
955 | delete_last_nop(sym); | ||
956 | |||
926 | pclose(file); | 957 | pclose(file); |
927 | out_free_filename: | 958 | out_free_filename: |
928 | if (free_filename) | 959 | if (free_filename) |