aezsu: Fix outdated pc when checking for completion (#2367)

* aezsu: Fix outdated `pc` when checking for completion
* Check reg pc after stepping as well
This commit is contained in:
Khairul Azhar Kasmiran 2022-02-27 22:04:45 +08:00 committed by GitHub
parent b4c716a99d
commit f3c77de061
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 4 deletions

View file

@ -8033,10 +8033,12 @@ RZ_IPI RzCmdStatus rz_il_vm_step_until_addr_handler(RzCore *core, int argc, cons
RZ_LOG_ERROR("RzIL: the VM is not initialized.\n");
return RZ_CMD_STATUS_ERROR;
}
RzILVM *vm = core->analysis->il_vm->vm;
ut64 pc = rz_bv_to_ut64(vm->pc);
while (pc != address) {
while (1) {
ut64 pc = rz_reg_get_value_by_role(core->analysis->reg, RZ_REG_NAME_PC);
if (pc == address) {
break;
}
if (rz_cons_is_breaked()) {
rz_cons_printf("CTRL+C was pressed.\n");
break;
@ -8044,7 +8046,6 @@ RZ_IPI RzCmdStatus rz_il_vm_step_until_addr_handler(RzCore *core, int argc, cons
if (!rz_core_il_step(core)) {
break;
}
pc = rz_bv_to_ut64(vm->pc);
}
return RZ_CMD_STATUS_OK;
}

View file

@ -151,3 +151,23 @@ EXPECT=<<EOF
0x00010000 8 ptr
EOF
RUN
NAME=double aezsu with different start pc
FILE=bins/bf/2+5.bf
CMDS=<<EOF
e io.cache=1
aezi
(emu_pc pc; ar pc=$0; ar; aezsu $s; ?e)
.(emu_pc 1)
wv1 0 @ ptr
.(emu_pc 0)
EOF
EXPECT=<<EOF
ptr = 0x00010000
pc = 0x00000001
6
ptr = 0x00010000
pc = 0x00000000
7
EOF
RUN