mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
perf annotate: Resolve symbols using objdump comment for single op ins
Starting with inc, incl, dec, decl. Requested-by: Linus Torvalds <[email protected]> Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
6de783b6f5
commit
a43712c472
1 changed files with 45 additions and 0 deletions
|
|
@ -205,6 +205,47 @@ static struct ins_ops mov_ops = {
|
|||
.scnprintf = mov__scnprintf,
|
||||
};
|
||||
|
||||
static int dec__parse(struct ins_operands *ops)
|
||||
{
|
||||
char *target, *comment, *s, prev;
|
||||
|
||||
target = s = ops->raw;
|
||||
|
||||
while (s[0] != '\0' && !isspace(s[0]))
|
||||
++s;
|
||||
prev = *s;
|
||||
*s = '\0';
|
||||
|
||||
ops->target.raw = strdup(target);
|
||||
*s = prev;
|
||||
|
||||
if (ops->target.raw == NULL)
|
||||
return -1;
|
||||
|
||||
comment = strchr(s, '#');
|
||||
if (comment == NULL)
|
||||
return 0;
|
||||
|
||||
while (comment[0] != '\0' && isspace(comment[0]))
|
||||
++comment;
|
||||
|
||||
comment__symbol(ops->target.raw, comment, &ops->target.addr, &ops->target.name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dec__scnprintf(struct ins *ins, char *bf, size_t size,
|
||||
struct ins_operands *ops)
|
||||
{
|
||||
return scnprintf(bf, size, "%-6.6s %s", ins->name,
|
||||
ops->target.name ?: ops->target.raw);
|
||||
}
|
||||
|
||||
static struct ins_ops dec_ops = {
|
||||
.parse = dec__parse,
|
||||
.scnprintf = dec__scnprintf,
|
||||
};
|
||||
|
||||
static int nop__scnprintf(struct ins *ins __used, char *bf, size_t size,
|
||||
struct ins_operands *ops __used)
|
||||
{
|
||||
|
|
@ -232,7 +273,11 @@ static struct ins instructions[] = {
|
|||
{ .name = "cmpq", .ops = &mov_ops, },
|
||||
{ .name = "cmpw", .ops = &mov_ops, },
|
||||
{ .name = "cmpxch", .ops = &mov_ops, },
|
||||
{ .name = "dec", .ops = &dec_ops, },
|
||||
{ .name = "decl", .ops = &dec_ops, },
|
||||
{ .name = "imul", .ops = &mov_ops, },
|
||||
{ .name = "inc", .ops = &dec_ops, },
|
||||
{ .name = "incl", .ops = &dec_ops, },
|
||||
{ .name = "ja", .ops = &jump_ops, },
|
||||
{ .name = "jae", .ops = &jump_ops, },
|
||||
{ .name = "jb", .ops = &jump_ops, },
|
||||
|
|
|
|||
Loading…
Reference in a new issue