ntdll: Fix SIGTRAP handling

Vitaliy Margolen wine-devel at kievinfo.com
Mon Mar 27 09:13:23 CST 2006

Monday, March 27, 2006, 7:58:38 AM, Petr Tesarik wrote:
> Dne 03/27/06 v 16:05:15 (+0200), Alexandre Julliard napsal(a):
>> Petr Tesarik <hat at tesarici.cz> writes:
>> > No, Windows need not do things like that, because the Windows kernel
>> > knows very well, whether it got INT1 or INT3... Some UNIX kernels do
>> > not give us that information reliably.
>> I'm afraid it's not acceptable to do things differently, especially
>> not things like the checking of the previous instruction that may
>> cause extra exceptions. Also stuff like the clearing of DR6 needs a
>> test case, that's something that's visible from the application.


>    There is no other way to detect a hardware breakpoint than to look
>    at DR6.  Additionally, since the bits would get stuck for all
>    subsequent SIGTRAPs, we need to clear them.

If you need a program that uses DR6 for copy protection and will brake if
you touch anything in it look here: http://bugs.winehq.org/show_bug.cgi?id=4036
It's using hardware breakpoints for lots of nasty things. And depends on
the _exact_ content of the DR* registers when exception handler is
called. Also it sets those registers only once. So if you alter any of
the DR* registers in any way, this copy protection will brake.

Please don't forget here that we are not inventing something new. We can
not deviate from what native does, or it will brake some applications. If
you have a test case that shows that windows does what you trying to do -
I would like to see it. Or you could write your own test to test this on


More information about the wine-devel mailing list