Implement detour unit tests with emulator
stevemk14ebr opened this issue · 1 comments
The current approach to unit testing the x86 and x64 detours is limited. It involves directly executing manually crafted assembly within the unit testing process. This is error prone and can make it hard to actually inspect CPU effects like ensuring registers / stack data is preserved and control flow is successful.
Instead, implement unit testing with an x86 / x64 emulator. We can create a set of CPU constraints that model what the before / after architectural state should look like per hook. We can then call polyhook functions to edit the memory buffers of the emulator, or mirror them temporarily and write back. This should be much better and unlock more confidence in quality and new tests to be written.
This is a long term goal. If someone is interested in working on this, please let me know. Unit Tests Here.
There is a $250 USD bounty on this issue:
https://twitter.com/stevemk14ebr/status/1720549142634566102?t=VbYJ_vg_bTZ9fahTtq0Qvg&s=19