-
Notifications
You must be signed in to change notification settings - Fork 1.5k
add uc_emu_run #2282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
add uc_emu_run #2282
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.