aae improvements (#5727)

* anal: increment instruction ptr even when no ESIL result is available

* anal: axf: try to resolve function names for 'C' refs

* disasm: print function names for 'C' refs
This commit is contained in:
Vlad Ivanov 2016-09-12 19:41:11 +03:00 committed by radare
parent c3c0363196
commit b0b71f9f09
3 changed files with 41 additions and 3 deletions

View File

@ -3069,14 +3069,16 @@ R_API void r_core_anal_esil(RCore *core, const char *str, const char *target) {
if (1) {
const char *esilstr = R_STRBUF_SAFEGET (&op.esil);
r_anal_esil_set_pc (ESIL, cur);
if (!esilstr || !*esilstr)
i += op.size - 1;
if (!esilstr || !*esilstr) {
continue;
}
(void)r_anal_esil_parse (ESIL, esilstr);
// looks like ^C is handled by esil_parse !!!!
r_cons_break (cccb, core);
//r_anal_esil_dumpstack (ESIL);
r_anal_esil_stack_free (ESIL);
i += op.size - 1;
switch (op.type) {
case R_ANAL_OP_TYPE_LEA:

View File

@ -3309,6 +3309,17 @@ static void anal_axg (RCore *core, const char *input, int level, Sdb *db) {
}
}
static void cmd_anal_ucall_ref (RCore *core, ut64 addr) {
RAnalFunction * fcn;
fcn = r_anal_get_fcn_at (core->anal, addr, R_ANAL_FCN_TYPE_NULL);
if (fcn) {
r_cons_printf (" ; %s", fcn->name);
} else {
r_cons_printf (" ; 0x%" PFMT64x, addr);
}
}
static bool cmd_anal_refs(RCore *core, const char *input) {
ut64 addr = core->offset;
const char *help_msg[] = {
@ -3487,8 +3498,18 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
asmop.buf_asm, str, sizeof (str), core->print->big_endian);
buf_asm = r_print_colorize_opcode (str, core->cons->pal.reg,
core->cons->pal.num);
r_cons_printf ("%c 0x%" PFMT64x " %s\n",
r_cons_printf ("%c 0x%" PFMT64x " %s",
ref->type, ref->at, buf_asm);
if (ref->type == R_ANAL_REF_TYPE_CALL) {
RAnalOp aop;
r_anal_op (core->anal, &aop, ref->at, buf, 12);
if (aop.type == R_ANAL_OP_TYPE_UCALL) {
cmd_anal_ucall_ref (core, ref->addr);
}
}
r_cons_printf ("\n");
free (buf_asm);
}
}

View File

@ -762,6 +762,21 @@ static void ds_show_refs(RDisasmState *ds) {
if (cmt) {
r_cons_printf (" ; (%s)", cmt);
}
if (ref->type == R_ANAL_REF_TYPE_CALL) {
RAnalOp aop;
ut8 buf[12];
r_core_read_at (ds->core, ref->at, buf, 12);
r_anal_op (ds->core->anal, &aop, ref->at, buf, 12);
if (aop.type == R_ANAL_OP_TYPE_UCALL) {
RAnalFunction * fcn;
fcn = r_anal_get_fcn_at (ds->core->anal, ref->addr, R_ANAL_FCN_TYPE_NULL);
if (fcn) {
r_cons_printf (" ; %s", fcn->name);
} else {
r_cons_printf (" ; 0x%" PFMT64x, ref->addr);
}
}
}
ds_print_color_reset (ds);
}
}