]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
perf annotate browser: Use the disasm_line instruction name and operand fields
authorArnaldo Carvalho de Melo <acme@redhat.com>
Sun, 15 Apr 2012 23:12:07 +0000 (20:12 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 16 Apr 2012 15:16:39 +0000 (12:16 -0300)
No need to reparse it everytime.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-90ncot487p4h5rzkn8h2whou@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/ui/browsers/annotate.c

index bc540b1576c366a4dfa844dc77575d87776e8e81..0bc3e652b5417ca3ad18d55ba3729760972e1d77 100644 (file)
@@ -260,22 +260,16 @@ static bool annotate_browser__callq(struct annotate_browser *browser,
                                    void *arg, int delay_secs)
 {
        struct map_symbol *ms = browser->b.priv;
+       struct disasm_line *dl = browser->selection;
        struct symbol *sym = ms->sym;
        struct annotation *notes;
        struct symbol *target;
-       char *s = strstr(browser->selection->line, "callq ");
        u64 ip;
 
-       if (s == NULL)
+       if (strcmp(dl->name, "callq"))
                return false;
 
-       s = strchr(s, ' ');
-       if (s++ == NULL) {
-               ui_helpline__puts("Invallid callq instruction.");
-               return true;
-       }
-
-       ip = strtoull(s, NULL, 16);
+       ip = strtoull(dl->operands, NULL, 16);
        ip = ms->map->map_ip(ms->map, ip);
        target = map__find_symbol(ms->map, ip, NULL);
        if (target == NULL) {
@@ -321,22 +315,19 @@ struct disasm_line *annotate_browser__find_offset(struct annotate_browser *brows
 
 static bool annotate_browser__jump(struct annotate_browser *browser)
 {
-       const char *jumps[] = { "je ", "jne ", "ja ", "jmpq ", "js ", "jmp ", NULL };
-       struct disasm_line *dl;
+       const char *jumps[] = { "je", "jne", "ja", "jmpq", "js", "jmp", NULL };
+       struct disasm_line *dl = browser->selection;
        s64 idx, offset;
-       char *s = NULL;
+       char *s;
        int i = 0;
 
-       while (jumps[i]) {
-               s = strstr(browser->selection->line, jumps[i++]);
-               if (s)
-                       break;
-       }
+       while (jumps[i] && strcmp(dl->name, jumps[i]))
+               ++i;
 
-       if (s == NULL)
+       if (jumps[i] == NULL)
                return false;
 
-       s = strchr(s, '+');
+       s = strchr(dl->operands, '+');
        if (s++ == NULL) {
                ui_helpline__puts("Invallid jump instruction.");
                return true;