Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Ravi Bangoria and committed by
Arnaldo Carvalho de Melo
05d0e62d af98f227

+9 -9
+9 -9
tools/perf/util/annotate.c
··· 165 165 static int ins__raw_scnprintf(struct ins *ins, char *bf, size_t size, 166 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 171 int ins__scnprintf(struct ins *ins, char *bf, size_t size, ··· 230 230 struct ins_operands *ops) 231 231 { 232 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 235 if (ops->target.addr == 0) 236 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 241 static struct ins_ops call_ops = { ··· 299 299 c++; 300 300 } 301 301 302 - return scnprintf(bf, size, "%-6.6s %.*s%" PRIx64, 302 + return scnprintf(bf, size, "%-6s %.*s%" PRIx64, 303 303 ins->name, c ? c - ops->raw : 0, ops->raw, 304 304 ops->target.offset); 305 305 } ··· 372 372 if (ops->locked.ins.ops == NULL) 373 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 376 return printed + ins__scnprintf(&ops->locked.ins, bf + printed, 377 377 size - printed, ops->locked.ops); 378 378 } ··· 448 448 static int mov__scnprintf(struct ins *ins, char *bf, size_t size, 449 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 452 ops->source.name ?: ops->source.raw, 453 453 ops->target.name ?: ops->target.raw); 454 454 } ··· 488 488 static int dec__scnprintf(struct ins *ins, char *bf, size_t size, 489 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 492 ops->target.name ?: ops->target.raw); 493 493 } 494 494 ··· 500 500 static int nop__scnprintf(struct ins *ins __maybe_unused, char *bf, size_t size, 501 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 506 static struct ins_ops nop_ops = { ··· 924 924 int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw) 925 925 { 926 926 if (raw || !dl->ins.ops) 927 - return scnprintf(bf, size, "%-6.6s %s", dl->ins.name, dl->ops.raw); 927 + return scnprintf(bf, size, "%-6s %s", dl->ins.name, dl->ops.raw); 928 928 929 929 return ins__scnprintf(&dl->ins, bf, size, &dl->ops); 930 930 }