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>
This commit is contained in:
Arnaldo Carvalho de Melo
2012-04-18 13:58:34 -03:00
parent 657bcaf509
commit 4f9d03251b
3 changed files with 79 additions and 16 deletions

View File

@@ -315,26 +315,13 @@ 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 = browser->selection;
s64 idx, offset;
char *s;
int i = 0;
s64 idx;
while (jumps[i] && strcmp(dl->name, jumps[i]))
++i;
if (jumps[i] == NULL)
if (!dl->ins || !ins__is_jump(dl->ins))
return false;
s = strchr(dl->operands, '+');
if (s++ == NULL) {
ui_helpline__puts("Invallid jump instruction.");
return true;
}
offset = strtoll(s, NULL, 16);
dl = annotate_browser__find_offset(browser, offset, &idx);
dl = annotate_browser__find_offset(browser, dl->target, &idx);
if (dl == NULL) {
ui_helpline__puts("Invallid jump offset");
return true;