Add a comment on the stepback functionality to warn user about how broken is it

This commit is contained in:
pancake 2017-11-15 01:13:29 +09:00
parent d772b5f0ad
commit 8b5e0c0219
2 changed files with 12 additions and 8 deletions

View File

@ -54,7 +54,8 @@ R_API RAnalEsilSession *r_anal_esil_session_add(RAnalEsil *esil) {
r_reg_arena_push (esil->anal->reg);
/* Save current memory dump */
esil->anal->iob.read_at (esil->anal->iob.io, session->addr, session->data, session->size);
esil->anal->iob.read_at (esil->anal->iob.io, session->addr,
session->data, session->size);
r_list_append (esil->sessions, session);
return session;
@ -65,14 +66,14 @@ R_API void r_anal_esil_session_set(RAnalEsil *esil, RAnalEsilSession *session) {
return;
}
ut32 i;
RListIter *iter;
/* Restore registers */
for (i = 0; i < R_REG_TYPE_LAST; i++) {
iter = session->reg[i];
RListIter *iter = session->reg[i];
RRegArena *arena = iter->data;
if (esil->anal->reg->regset[i].arena->bytes) {
if (esil->anal->reg->regset[i].arena->size >= arena->size) {
memcpy (esil->anal->reg->regset[i].arena->bytes, arena->bytes, arena->size);
memcpy (esil->anal->reg->regset[i].arena->bytes,
arena->bytes, arena->size);
}
}
}

View File

@ -3060,8 +3060,9 @@ repeat:
st64 follow = (st64)r_config_get_i (core->config, "dbg.follow");
ut64 pc = r_debug_reg_get (core->dbg, "PC");
if (follow > 0) {
if ((pc < core->offset) || (pc > (core->offset + follow)))
if ((pc < core->offset) || (pc > (core->offset + follow))) {
r_core_cmd0 (core, "sr PC");
}
}
// check addr
@ -3115,11 +3116,13 @@ R_API int r_core_esil_step_back(RCore *core) {
eprintf ("Cannot find any previous state here\n");
return 0;
}
// eprintf ("Execute until 0x%08"PFMT64x"\n", end);
eprintf ("NOTE: step back in esil is setting an initial state and stepping into pc is the same.\n");
eprintf ("NOTE: this is extremely wrong and poorly efficient. so don't use this feature unless\n");
eprintf ("NOTE: you are going to fix it by making it consistent with dts, which is also broken as hell\n");
eprintf ("Execute until 0x%08"PFMT64x"\n", end);
r_anal_esil_session_set (esil, before);
r_core_esil_step (core, end, NULL, &prev);
// eprintf ("Before 0x%08"PFMT64x"\n", prev);
eprintf ("Before 0x%08"PFMT64x"\n", prev);
r_anal_esil_session_set (esil, before);
r_core_esil_step (core, prev, NULL, NULL);
return 1;