Got some time to play around? Here is a sample playground #1980
+776
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Debugging is sometimes quite time consuming, especially if you have just a "script" to work on.
The script itself might have a bug, or the binding - or somewhere in between - or is it really Unicorn?
Find it out - with the playground.
Here is a sample (minimal, extendable framework, single file) written in C
to play around to figure out if the bug is inside Unicorn.
Just attach your favorite debugger and step through the code to figure out whats happening.
As an example, I took the #1971 issue to play around.
Only a couple of lines should be needed to convert the python script into C, (you need that for the memory access).
Have a look into the "get_config" method to change the Unicorn specific and platform parameters.
The application sets up hooks and memory to operate on.
It reads a binary file and write it into memory if you provide the filename as argument during start-up of the app.
If no arguments are passed, a default "code chunk" is executed, which only contains invalid instructions to trigger hooks.
For simplicity, there are (almost) no nullptr checks for the pointers.