Set emulation_done to true if and only if we exit the outer uc_emu_start

Or we may lost uc_emu_stop wrongly
This commit is contained in:
mio
2022-01-19 21:58:46 +01:00
parent e018a9ca6a
commit 2ad9f152f9
2 changed files with 43 additions and 3 deletions

10
uc.c
View File

@ -804,8 +804,13 @@ uc_err uc_emu_start(uc_engine *uc, uint64_t begin, uint64_t until,
uc->vm_start(uc);
// emulation is done
uc->emulation_done = true;
uc->nested_level--;
// emulation is done if and only if we exit the outer uc_emu_start
// or we may lost uc_emu_stop
if (uc->nested_level == 0) {
uc->emulation_done = true;
}
// remove hooks to delete
clear_deleted_hooks(uc);
@ -815,7 +820,6 @@ uc_err uc_emu_start(uc_engine *uc, uint64_t begin, uint64_t until,
qemu_thread_join(&uc->timer);
}
uc->nested_level--;
return uc->invalid_error;
}