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
emu_stop segfault #65
Comments
actually there is no reason to call emu_stop() because after emu_start() returns, emulation already stopped. this is a bug anyway, so please could you send a PR to put your script under regress/ directory? thanks. |
It makes sense to me to call emu_stop from a debugger or a callback. |
yes, we already had a bunch of samples calling emu_stop() from callbacks. |
I ran into this as well. Other than callbacks, when is it valid to call
|
the only place to use emu_stop() is from inside the callbacks. note that for emu_start(), there are 3 choices to stop emulation: by until-address, by timeout and by number of instructions emulated. |
actually this is already documented for |
It looks roughly safe to call from a separate thread as well, as it just registers a request to stop by setting two integers. I care about this because I might want to force the CPU to arbitrarily stop when I'm not inside a callback. |
ah yes, calling from another thread to stop emulation in the middle is also another choice. |
PR sent. Btw, is there some mechanism right now for running regression tests or other tests automatically? On a similar note, is there a mechanism or a desired pattern you wish to follow for Python unit tests? I encountered a minor bug (which I've yet to report) and I was going to send along a fix but I can't see any existing Python unit tests so I wasn't exactly sure where you'd prefer them. (If this requires its own discussion thread let me know and I'll start one) |
I haven't yet looked at the code, but if we're considering calling this from another thread, we might have to worry about consistency. In other words, will Unicorn be confused or behave poorly if it "sees" those two integers in an intermediate state, where one has been changed, and the other has not? |
No, I don't believe so. |
Added a regression script for issue #65
this issue is fixed now. please confirm, thanks. |
lgtm |
I'm not sure if this is due to a misunderstanding on my behalf of how this API is supposed to be used, but earlier today when playing around with something I found the following causes a NULL pointer dereference.
The crash details are as follows
I'm not familiar enough with Unicorn yet to guess at why current_cpu would be 0x0.
The text was updated successfully, but these errors were encountered: