struct symbol *target;
u64 ip;
- if (strcmp(dl->name, "callq"))
+ if (!ins__is_call(dl->ins))
return false;
- ip = strtoull(dl->operands, NULL, 16);
- ip = ms->map->map_ip(ms->map, ip);
+ ip = ms->map->map_ip(ms->map, dl->target);
target = map__find_symbol(ms->map, ip, NULL);
if (target == NULL) {
ui_helpline__puts("The called function was not found.");
struct disasm_line *dl = browser->selection;
s64 idx;
- if (!dl->ins || !ins__is_jump(dl->ins))
+ if (!ins__is_jump(dl->ins))
return false;
dl = annotate_browser__find_offset(browser, dl->target, &idx);
ui_helpline__puts("Huh? No selection. Report to linux-kernel@vger.kernel.org");
else if (self->selection->offset == -1)
ui_helpline__puts("Actions are only available for assembly lines.");
- else if (!(annotate_browser__jump(self) ||
+ else if (!self->selection->ins ||
+ !(annotate_browser__jump(self) ||
annotate_browser__callq(self, evidx, timer, arg, delay_secs)))
ui_helpline__puts("Actions are only available for the 'callq' and jump instructions.");
continue;
const char *disassembler_style;
+static int call_ops__parse_target(const char *operands, u64 *target)
+{
+ *target = strtoull(operands, NULL, 16);
+ return 0;
+}
+
+static struct ins_ops call_ops = {
+ .parse_target = call_ops__parse_target,
+};
+
+bool ins__is_call(const struct ins *ins)
+{
+ return ins->ops == &call_ops;
+}
+
static int jump_ops__parse_target(const char *operands, u64 *target)
{
const char *s = strchr(operands, '+');
return ins->ops == &jump_ops;
}
-
/*
* Must be sorted by name!
*/
static struct ins instructions[] = {
+ { .name = "call", .ops = &call_ops, },
+ { .name = "callq", .ops = &call_ops, },
{ .name = "ja", .ops = &jump_ops, },
{ .name = "je", .ops = &jump_ops, },
{ .name = "jmp", .ops = &jump_ops, },
};
bool ins__is_jump(const struct ins *ins);
+bool ins__is_call(const struct ins *ins);
struct disasm_line {
struct list_head node;