ntdll: Add tests for (some) debugging exceptions

Petr Tesarik hat at tesarici.cz
Tue Apr 4 08:10:43 CDT 2006


Hi folks!

This patch adds tests for the INT3 and single step debugging
exceptions. I have also added a test that the EIP in the context is
the same as the ExeptionAddress, because that's what I see in WinXP,
(but not in Wine).

I'm working on a fix in signal_i386.c, but since that obviously means
adjusting EIP after the return from the exception handler and I don't
know how this interfaces with the debugging API (WaitForDebugEvent and
ContinueDebugEvent), I need to do some more testing on native Windows
first.

ChangeLog:

* dlls/ntdll/tests/exception.c:
  ntdll: Add tests for INT3 and single step exceptions.
-------------- next part --------------
Index: exception.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/tests/exception.c,v
retrieving revision 1.3
diff -u -r1.3 exception.c
--- exception.c	12 Jan 2006 12:46:37 -0000	1.3
+++ exception.c	4 Apr 2006 12:53:34 -0000
@@ -157,6 +157,18 @@
       0, 5, STATUS_ACCESS_VIOLATION, 2, { 0, 0xffffffff } },
     { { 0xa3, 0xff, 0xff, 0xff, 0xff, 0xc3 },  /* movl %eax,0xffffffff; ret */
       0, 5, STATUS_ACCESS_VIOLATION, 2, { 0, 0xffffffff } },
+
+    /* test debug exceptions */
+    /* FIXME: I've no idea what that "magic" value of 0x45fcc8 could
+     * mean, but that's what I got on WinXP Professional...
+     */
+    { { 0xcc, 0xc3 },  /* int3; ret */
+      0, 1, STATUS_BREAKPOINT, 3, { 0, 0x45fcc8, 0 } },
+    { { 0xcd, 0x03, 0xc3 },  /* int $0x03; ret */
+      1, 1, STATUS_BREAKPOINT, 3, { 0, 0x45fcc8, 0 } },
+    { { 0x9c, 0x9c, 0x58, 0x80, 0xcc, 0x01, 0x50, 0x9d, 0x9d, 0xc3 },
+          /* pushf; pushf; pop %eax; or $1,%ah; push %eax; popf; popf; ret */
+      9, 0, STATUS_SINGLE_STEP, 0 },
 };
 
 static int got_exception;
@@ -184,6 +196,9 @@
             "%u: Wrong parameter %d: %lx/%lx\n",
             entry, i, rec->ExceptionInformation[i], except->params[i] );
 
+    ok( (DWORD) rec->ExceptionAddress == context->Eip,
+	"%u: Wrong EIP value %08lx/%p\n", entry, context->Eip, rec->ExceptionAddress );
+
     /* don't handle exception if it's not the address we expected */
     if (rec->ExceptionAddress != except->code + except->offset) return ExceptionContinueSearch;
 


More information about the wine-patches mailing list