Conversation
| for detailed error). | ||
| */ | ||
| UNICORN_EXPORT | ||
| uc_err uc_emu_run(uc_engine *uc, uint64_t until, uint64_t timeout, |
There was a problem hiding this comment.
I like the idea but I feel that the state after uc_emu_start is not always safe to start immediately, like those after errors.
uc_emu_start with a pc write shall reset states in most cases, but uc_emu_run does not. Do you think that introduces potential issues?
There was a problem hiding this comment.
Might be, I need to think about it a bit. But I have a few questions:
- Which error states are not save to start immediately from?
- does a pc write restore from a context does have the same effect?
There was a problem hiding this comment.
Which error states are not save to start immediately from?
I can not really come up with one so I think this PR is mostly safe to go but let me review others firstly.
does a pc write restore from a context does have the same effect?
Writing a pc is always making the emulator to a clean state, at least I design it in this way.
|
An alternative way would be to implement this the other way around. So read the pc and call uc_emu_start. This way the pc write is done every time and state is reseted. |
But then that is not really worth a new API because users could do that by themselves. |
|
I have added this to have a simpler API, not to avoid the reg_write. I just run into a bug because I forgot to update my local pc variable. I believe I'm not the only one who depends on a correct set pc register and just reads the pc to pass it to uc_emu_start. I would say having a simple to use API for this cases is worth it. |
This function allows to run from the current instruction pointer. Can be used when you allready manage all registers, so you don't need to read the instruction pointer and start unicorn with it.
14a8f66 to
933fda6
Compare
This function allows to run from the current instruction pointer. Can be used when you allready manage all registers, so you don't need to read the instruction pointer and start unicorn with it.