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
Multi-threaded breakpoint program crashes #2168
Comments
Thread concurrency,This bug always exists.To avoid this bug, use hardware breakpoints. |
Unfortunately hardware breakpoints do not solve this issue iirc. Anyway, closing this issue as a duplicate of #1764. Your explanation is really good though so it's very useful thanks :) |
If the code is reentrant, hardware breakpoint + exception filters may be a mitigation. |
The problem is that once you remove the hardware breakpoint to step over the instruction you immediately create a race condition (because other threads can start running). |
Yeah...I mean this method somehow reduces the probability (the filter performs like a buffer). It doesn't solve the problem. Looks like .bpsync suspends all other threads, and marks them as "frozen" for debugger (https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/controlling-processes-and-threads). Is it possible to temporarily ignore events from another threads until they defrost? |
Yes, this issue has already been fixed in TitanEngine. But the updated TitanEngine is not yet in releases because it also messes up the suspend count. I’m looking into using the new thread freezing APIs to improve performance, but my time is unfortunately limited. |
Write a simple program:
Set breakpoints for thread1 and thread2
Ignore all exceptions:
Repeated F9 run program
program crash
the reason:
When I press f9 to continue running, the debugger first accepts the EXCEPTION_SINGLE_STEP of the next instruction of the breakpoint, and then continues to run.
The tf of the previous breakpoint has not yet entered, and another breakpoint is interrupted. Then the TF of the previous breakpoint is considered an illegal exception to be handed over to the application for processing, and the program crashes.
The text was updated successfully, but these errors were encountered: