diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-04-18 12:58:34 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-04-18 12:58:34 -0400 |
commit | 4f9d03251b9d202ebce805757360ef0fac5eb74e (patch) | |
tree | 828b5d690bcd1bb1b04a98d7c735a54545cc589e /tools/perf/ui/browsers/annotate.c | |
parent | 657bcaf5097e1aff53d724358deb24ce803f43a4 (diff) |
perf annotate: Disassembler instruction parsing
So that at disassembly time we parse targets, etc.
Supporting jump instructions initially, call functions are next.
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-7vzlh66n5or46n27ji658cnl@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/browsers/annotate.c')
-rw-r--r-- | tools/perf/ui/browsers/annotate.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index 0bc3e652b541..bdbb54fd05ae 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c | |||
@@ -315,26 +315,13 @@ struct disasm_line *annotate_browser__find_offset(struct annotate_browser *brows | |||
315 | 315 | ||
316 | static bool annotate_browser__jump(struct annotate_browser *browser) | 316 | static bool annotate_browser__jump(struct annotate_browser *browser) |
317 | { | 317 | { |
318 | const char *jumps[] = { "je", "jne", "ja", "jmpq", "js", "jmp", NULL }; | ||
319 | struct disasm_line *dl = browser->selection; | 318 | struct disasm_line *dl = browser->selection; |
320 | s64 idx, offset; | 319 | s64 idx; |
321 | char *s; | ||
322 | int i = 0; | ||
323 | |||
324 | while (jumps[i] && strcmp(dl->name, jumps[i])) | ||
325 | ++i; | ||
326 | 320 | ||
327 | if (jumps[i] == NULL) | 321 | if (!dl->ins || !ins__is_jump(dl->ins)) |
328 | return false; | 322 | return false; |
329 | 323 | ||
330 | s = strchr(dl->operands, '+'); | 324 | dl = annotate_browser__find_offset(browser, dl->target, &idx); |
331 | if (s++ == NULL) { | ||
332 | ui_helpline__puts("Invallid jump instruction."); | ||
333 | return true; | ||
334 | } | ||
335 | |||
336 | offset = strtoll(s, NULL, 16); | ||
337 | dl = annotate_browser__find_offset(browser, offset, &idx); | ||
338 | if (dl == NULL) { | 325 | if (dl == NULL) { |
339 | ui_helpline__puts("Invallid jump offset"); | 326 | ui_helpline__puts("Invallid jump offset"); |
340 | return true; | 327 | return true; |