Improve leahints to handle UJMP references

This commit is contained in:
pancake 2018-04-25 04:28:13 +02:00 committed by radare
parent 0a22f4a36b
commit 709a9c58fe
3 changed files with 24 additions and 4 deletions

View File

@ -539,7 +539,7 @@ static int r_anal_analyze_fcn_refs(RCore *core, RAnalFunction *fcn, int depth) {
static int core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int depth) {
if (depth < 0) {
eprintf ("Too deep for 0x%08"PFMT64x"\n", at);
// eprintf ("Too deep for 0x%08"PFMT64x"\n", at);
return false;
}
int has_next = r_config_get_i (core->config, "anal.hasnext");

View File

@ -1191,10 +1191,9 @@ static int cmd_resize(void *data, const char *input) {
eprintf ("r_io_resize: cannot resize\n");
}
}
if (delta && core->offset < newsize)
if (delta && core->offset < newsize) {
r_io_shift (core->io, core->offset, grow?newsize:oldsize, delta);
}
if (!grow) {
ret = r_io_resize (core->io, newsize);
if (ret < 1) {

View File

@ -3042,6 +3042,18 @@ static bool ds_print_core_vmode_jump_hit(RDisasmState *ds, int pos) {
return false;
}
static void getPtr(RDisasmState *ds, ut64 addr, int pos) {
ut8 buf[sizeof(ut64)] = {0};
r_io_read_at (ds->core->io, addr, buf, sizeof (buf));
if (ds->core->assembler->bits == 64) {
ut64 n64 = r_read_ble64 (buf, 0);
ds_print_shortcut (ds, n64, pos);
} else {
ut32 n32 = r_read_ble32 (buf, 0);
ds_print_shortcut (ds, n32, pos);
}
}
static void ds_print_core_vmode(RDisasmState *ds, int pos) {
RCore *core = ds->core;
bool gotShortcut = false;
@ -3050,6 +3062,15 @@ static void ds_print_core_vmode(RDisasmState *ds, int pos) {
return;
}
switch (ds->analop.type) {
case R_ANAL_OP_TYPE_UJMP:
case R_ANAL_OP_TYPE_UJMP | R_ANAL_OP_TYPE_IND:
case R_ANAL_OP_TYPE_UJMP | R_ANAL_OP_TYPE_IND | R_ANAL_OP_TYPE_COND:
case R_ANAL_OP_TYPE_UJMP | R_ANAL_OP_TYPE_IND | R_ANAL_OP_TYPE_REG:
if (ds->show_leahints) {
getPtr (ds, ds->analop.ptr, pos);
gotShortcut = true;
}
break;
case R_ANAL_OP_TYPE_MOV:
case R_ANAL_OP_TYPE_LEA:
case R_ANAL_OP_TYPE_LOAD: