(windows) Fixing RestoreRegisters() save register status to lcContext #75
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.
Hello, a bug fix for the windows platform,
In windows/debugger.cpp#RestoreRegisters(), the target thread context should be restored using the passed register value;
When target program is a multi-threaded program. Using the following command can trigger bugs with a higher probability:
litecov.exe -instrument_module [module] -target_module [module] -target_method [method] -generate_unwind --[harness.exe]
When the bug is triggered, TinyInst usually receives a 0xC0000005 (access violation) exception from the target program; TinyInst treats this as a crash in the target program.
After further testing and analysis, I think that the bug will not be triggered in a single-threaded target program or when
-generate_unwind
is not used; In addition, in a multi-threaded target program, with-generate_unwind
and without-target_module/-target_method
, the bug will (maybe) not be triggered (TinyInst will complete instrumentation at the program entry, and this moment can be regarded as single-threaded Case?)PS: macOS uses a similar implementation, but I think there is no problem with macOS’s implementation.