[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-90ncot487p4h5rzkn8h2whou@git.kernel.org>
Date: Fri, 27 Apr 2012 01:27:27 -0700
From: tip-bot for Arnaldo Carvalho de Melo <acme@...hat.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, eranian@...gle.com, paulus@...ba.org,
acme@...hat.com, hpa@...or.com, mingo@...nel.org,
peterz@...radead.org, efault@....de, namhyung@...il.com,
fweisbec@...il.com, dsahern@...il.com, tglx@...utronix.de
Subject: [tip:perf/core] perf annotate browser:
Use the disasm_line instruction name and operand fields
Commit-ID: 657bcaf5097e1aff53d724358deb24ce803f43a4
Gitweb: http://git.kernel.org/tip/657bcaf5097e1aff53d724358deb24ce803f43a4
Author: Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Sun, 15 Apr 2012 20:12:07 -0300
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Mon, 16 Apr 2012 12:16:39 -0300
perf annotate browser: Use the disasm_line instruction name and operand fields
No need to reparse it everytime.
Cc: David Ahern <dsahern@...il.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Mike Galbraith <efault@....de>
Cc: Namhyung Kim <namhyung@...il.com>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Stephane Eranian <eranian@...gle.com>
Link: http://lkml.kernel.org/n/tip-90ncot487p4h5rzkn8h2whou@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/ui/browsers/annotate.c | 29 ++++++++++-------------------
1 files changed, 10 insertions(+), 19 deletions(-)
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index bc540b1..0bc3e65 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists