diff options
author | Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> | 2017-11-13 22:25:40 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-11-16 12:50:00 -0500 |
commit | 648388ae68e953b312e28eaf869fe6c01e2f70cc (patch) | |
tree | ebfa2794891648e32cae4b67d0a3bf6c0c0fa0a8 /tools/perf/util/annotate.c | |
parent | 2f0af8600e82e9f950fc32908386b9c639f88d48 (diff) |
perf annotate: Do not truncate instruction names at 6 chars
There are many instructions, esp on PowerPC, whose mnemonics are longer
than 6 characters. Using precision limit causes truncation of such
mnemonics.
Fix this by removing precision limit. Note that, 'width' is still 6, so
alignment won't get affected for length <= 6.
Before:
li r11,-1
xscvdp vs1,vs1
add. r10,r10,r11
After:
li r11,-1
xscvdpsxds vs1,vs1
add. r10,r10,r11
Reported-by: Donald Stence <dstence@us.ibm.com>
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Taeung Song <treeze.taeung@gmail.com>
Link: http://lkml.kernel.org/r/20171114032540.4564-1-ravi.bangoria@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r-- | tools/perf/util/annotate.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index eab4a8e3c679..30d74dabdc42 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -165,7 +165,7 @@ static void ins__delete(struct ins_operands *ops) | |||
165 | static int ins__raw_scnprintf(struct ins *ins, char *bf, size_t size, | 165 | static int ins__raw_scnprintf(struct ins *ins, char *bf, size_t size, |
166 | struct ins_operands *ops) | 166 | struct ins_operands *ops) |
167 | { | 167 | { |
168 | return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->raw); | 168 | return scnprintf(bf, size, "%-6s %s", ins->name, ops->raw); |
169 | } | 169 | } |
170 | 170 | ||
171 | int ins__scnprintf(struct ins *ins, char *bf, size_t size, | 171 | int ins__scnprintf(struct ins *ins, char *bf, size_t size, |
@@ -230,12 +230,12 @@ static int call__scnprintf(struct ins *ins, char *bf, size_t size, | |||
230 | struct ins_operands *ops) | 230 | struct ins_operands *ops) |
231 | { | 231 | { |
232 | if (ops->target.name) | 232 | if (ops->target.name) |
233 | return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->target.name); | 233 | return scnprintf(bf, size, "%-6s %s", ins->name, ops->target.name); |
234 | 234 | ||
235 | if (ops->target.addr == 0) | 235 | if (ops->target.addr == 0) |
236 | return ins__raw_scnprintf(ins, bf, size, ops); | 236 | return ins__raw_scnprintf(ins, bf, size, ops); |
237 | 237 | ||
238 | return scnprintf(bf, size, "%-6.6s *%" PRIx64, ins->name, ops->target.addr); | 238 | return scnprintf(bf, size, "%-6s *%" PRIx64, ins->name, ops->target.addr); |
239 | } | 239 | } |
240 | 240 | ||
241 | static struct ins_ops call_ops = { | 241 | static struct ins_ops call_ops = { |
@@ -299,7 +299,7 @@ static int jump__scnprintf(struct ins *ins, char *bf, size_t size, | |||
299 | c++; | 299 | c++; |
300 | } | 300 | } |
301 | 301 | ||
302 | return scnprintf(bf, size, "%-6.6s %.*s%" PRIx64, | 302 | return scnprintf(bf, size, "%-6s %.*s%" PRIx64, |
303 | ins->name, c ? c - ops->raw : 0, ops->raw, | 303 | ins->name, c ? c - ops->raw : 0, ops->raw, |
304 | ops->target.offset); | 304 | ops->target.offset); |
305 | } | 305 | } |
@@ -372,7 +372,7 @@ static int lock__scnprintf(struct ins *ins, char *bf, size_t size, | |||
372 | if (ops->locked.ins.ops == NULL) | 372 | if (ops->locked.ins.ops == NULL) |
373 | return ins__raw_scnprintf(ins, bf, size, ops); | 373 | return ins__raw_scnprintf(ins, bf, size, ops); |
374 | 374 | ||
375 | printed = scnprintf(bf, size, "%-6.6s ", ins->name); | 375 | printed = scnprintf(bf, size, "%-6s ", ins->name); |
376 | return printed + ins__scnprintf(&ops->locked.ins, bf + printed, | 376 | return printed + ins__scnprintf(&ops->locked.ins, bf + printed, |
377 | size - printed, ops->locked.ops); | 377 | size - printed, ops->locked.ops); |
378 | } | 378 | } |
@@ -448,7 +448,7 @@ out_free_source: | |||
448 | static int mov__scnprintf(struct ins *ins, char *bf, size_t size, | 448 | static int mov__scnprintf(struct ins *ins, char *bf, size_t size, |
449 | struct ins_operands *ops) | 449 | struct ins_operands *ops) |
450 | { | 450 | { |
451 | return scnprintf(bf, size, "%-6.6s %s,%s", ins->name, | 451 | return scnprintf(bf, size, "%-6s %s,%s", ins->name, |
452 | ops->source.name ?: ops->source.raw, | 452 | ops->source.name ?: ops->source.raw, |
453 | ops->target.name ?: ops->target.raw); | 453 | ops->target.name ?: ops->target.raw); |
454 | } | 454 | } |
@@ -488,7 +488,7 @@ static int dec__parse(struct arch *arch __maybe_unused, struct ins_operands *ops | |||
488 | static int dec__scnprintf(struct ins *ins, char *bf, size_t size, | 488 | static int dec__scnprintf(struct ins *ins, char *bf, size_t size, |
489 | struct ins_operands *ops) | 489 | struct ins_operands *ops) |
490 | { | 490 | { |
491 | return scnprintf(bf, size, "%-6.6s %s", ins->name, | 491 | return scnprintf(bf, size, "%-6s %s", ins->name, |
492 | ops->target.name ?: ops->target.raw); | 492 | ops->target.name ?: ops->target.raw); |
493 | } | 493 | } |
494 | 494 | ||
@@ -500,7 +500,7 @@ static struct ins_ops dec_ops = { | |||
500 | static int nop__scnprintf(struct ins *ins __maybe_unused, char *bf, size_t size, | 500 | static int nop__scnprintf(struct ins *ins __maybe_unused, char *bf, size_t size, |
501 | struct ins_operands *ops __maybe_unused) | 501 | struct ins_operands *ops __maybe_unused) |
502 | { | 502 | { |
503 | return scnprintf(bf, size, "%-6.6s", "nop"); | 503 | return scnprintf(bf, size, "%-6s", "nop"); |
504 | } | 504 | } |
505 | 505 | ||
506 | static struct ins_ops nop_ops = { | 506 | static struct ins_ops nop_ops = { |
@@ -990,7 +990,7 @@ void disasm_line__free(struct disasm_line *dl) | |||
990 | int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw) | 990 | int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw) |
991 | { | 991 | { |
992 | if (raw || !dl->ins.ops) | 992 | if (raw || !dl->ins.ops) |
993 | return scnprintf(bf, size, "%-6.6s %s", dl->ins.name, dl->ops.raw); | 993 | return scnprintf(bf, size, "%-6s %s", dl->ins.name, dl->ops.raw); |
994 | 994 | ||
995 | return ins__scnprintf(&dl->ins, bf, size, &dl->ops); | 995 | return ins__scnprintf(&dl->ins, bf, size, &dl->ops); |
996 | } | 996 | } |