Resotre hook_mem_write when asm.emu activated

This commit is contained in:
alvarofe 2017-06-08 18:20:48 +02:00
parent f590de9e71
commit 82fc246f1d

View File

@ -3220,6 +3220,7 @@ static void ds_print_esil_anal(RDisasmState *ds) {
RCore *core = ds->core; RCore *core = ds->core;
RAnalEsil *esil = core->anal->esil; RAnalEsil *esil = core->anal->esil;
const char *pc; const char *pc;
int (*hook_mem_write)(RAnalEsil *esil, ut64 addr, const ut8 *buf, int len) = NULL;
int i, nargs; int i, nargs;
ut64 at = p2v (ds, ds->at); ut64 at = p2v (ds, ds->at);
RConfigHold *hc = r_config_hold_new (core->config); RConfigHold *hc = r_config_hold_new (core->config);
@ -3242,6 +3243,7 @@ static void ds_print_esil_anal(RDisasmState *ds) {
r_reg_setv (core->anal->reg, pc, at + ds->analop.size); r_reg_setv (core->anal->reg, pc, at + ds->analop.size);
esil->cb.user = ds; esil->cb.user = ds;
esil->cb.hook_reg_write = myregwrite; esil->cb.hook_reg_write = myregwrite;
hook_mem_write = esil->cb.hook_mem_write;
if (ds->show_emu_write) { if (ds->show_emu_write) {
esil->cb.hook_mem_write = mymemwrite0; esil->cb.hook_mem_write = mymemwrite0;
} else { } else {
@ -3253,6 +3255,9 @@ static void ds_print_esil_anal(RDisasmState *ds) {
r_anal_esil_stack_free (esil); r_anal_esil_stack_free (esil);
hc = r_config_hold_new (core->config); hc = r_config_hold_new (core->config);
if (!hc) { if (!hc) {
if (esil) {
esil->cb.hook_mem_write = hook_mem_write;
}
return; return;
} }
r_config_save_num (hc, "io.cache", NULL); r_config_save_num (hc, "io.cache", NULL);
@ -3430,6 +3435,9 @@ callfallback:
break; break;
} }
beach: beach:
if (esil) {
esil->cb.hook_mem_write = hook_mem_write;
}
r_config_restore (hc); r_config_restore (hc);
r_config_hold_free (hc); r_config_hold_free (hc);
} }