aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2017-11-28 11:12:32 -0500
committerTony Lindgren <tony@atomide.com>2017-11-28 11:12:32 -0500
commitbc686442f8a601bccac1f22506ecdb4b0d62cadd (patch)
treeb224ab4aa2350b233da640f5850f48bc6bfeb2d0 /tools/perf/util/annotate.c
parent60636a5d0fa2f8bc6d0c23c4027100ba20866f9b (diff)
parentca41e244517d6d3f1600c229ff7ca615049c1e9c (diff)
Merge branch 'dts-fixes' into omap-for-v4.15/fixes-dt
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r--tools/perf/util/annotate.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 4397a8b6e6cd..da1c4c4a0dd8 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -49,10 +49,9 @@ struct arch {
49 void *priv; 49 void *priv;
50 unsigned int model; 50 unsigned int model;
51 unsigned int family; 51 unsigned int family;
52 int (*init)(struct arch *arch); 52 int (*init)(struct arch *arch, char *cpuid);
53 bool (*ins_is_fused)(struct arch *arch, const char *ins1, 53 bool (*ins_is_fused)(struct arch *arch, const char *ins1,
54 const char *ins2); 54 const char *ins2);
55 int (*cpuid_parse)(struct arch *arch, char *cpuid);
56 struct { 55 struct {
57 char comment_char; 56 char comment_char;
58 char skip_functions_char; 57 char skip_functions_char;
@@ -132,10 +131,10 @@ static struct arch architectures[] = {
132 }, 131 },
133 { 132 {
134 .name = "x86", 133 .name = "x86",
134 .init = x86__annotate_init,
135 .instructions = x86__instructions, 135 .instructions = x86__instructions,
136 .nr_instructions = ARRAY_SIZE(x86__instructions), 136 .nr_instructions = ARRAY_SIZE(x86__instructions),
137 .ins_is_fused = x86__ins_is_fused, 137 .ins_is_fused = x86__ins_is_fused,
138 .cpuid_parse = x86__cpuid_parse,
139 .objdump = { 138 .objdump = {
140 .comment_char = '#', 139 .comment_char = '#',
141 }, 140 },
@@ -606,9 +605,19 @@ static struct arch *arch__find(const char *name)
606int symbol__alloc_hist(struct symbol *sym) 605int symbol__alloc_hist(struct symbol *sym)
607{ 606{
608 struct annotation *notes = symbol__annotation(sym); 607 struct annotation *notes = symbol__annotation(sym);
609 const size_t size = symbol__size(sym); 608 size_t size = symbol__size(sym);
610 size_t sizeof_sym_hist; 609 size_t sizeof_sym_hist;
611 610
611 /*
612 * Add buffer of one element for zero length symbol.
613 * When sample is taken from first instruction of
614 * zero length symbol, perf still resolves it and
615 * shows symbol name in perf report and allows to
616 * annotate it.
617 */
618 if (size == 0)
619 size = 1;
620
612 /* Check for overflow when calculating sizeof_sym_hist */ 621 /* Check for overflow when calculating sizeof_sym_hist */
613 if (size > (SIZE_MAX - sizeof(struct sym_hist)) / sizeof(struct sym_hist_entry)) 622 if (size > (SIZE_MAX - sizeof(struct sym_hist)) / sizeof(struct sym_hist_entry))
614 return -1; 623 return -1;
@@ -1447,16 +1456,13 @@ int symbol__disassemble(struct symbol *sym, struct map *map,
1447 *parch = arch; 1456 *parch = arch;
1448 1457
1449 if (arch->init) { 1458 if (arch->init) {
1450 err = arch->init(arch); 1459 err = arch->init(arch, cpuid);
1451 if (err) { 1460 if (err) {
1452 pr_err("%s: failed to initialize %s arch priv area\n", __func__, arch->name); 1461 pr_err("%s: failed to initialize %s arch priv area\n", __func__, arch->name);
1453 return err; 1462 return err;
1454 } 1463 }
1455 } 1464 }
1456 1465
1457 if (arch->cpuid_parse && cpuid)
1458 arch->cpuid_parse(arch, cpuid);
1459
1460 pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__, 1466 pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__,
1461 symfs_filename, sym->name, map->unmap_ip(map, sym->start), 1467 symfs_filename, sym->name, map->unmap_ip(map, sym->start),
1462 map->unmap_ip(map, sym->end)); 1468 map->unmap_ip(map, sym->end));