Christian Inci : ntdll/tests: Check debug registers of a newly created thread.
Alexandre Julliard
julliard at winehq.org
Mon Apr 10 15:37:17 CDT 2017
Module: wine
Branch: master
Commit: 8335d9152f64a51ffc3ba810d6ea0286883e3e58
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8335d9152f64a51ffc3ba810d6ea0286883e3e58
Author: Christian Inci <chris.wine at broke-the-inter.net>
Date: Sun Apr 9 20:22:34 2017 +0200
ntdll/tests: Check debug registers of a newly created thread.
Signed-off-by: Christian Inci <chris.wine at broke-the-inter.net>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/tests/exception.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index 3abec1b..27eac27 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -1991,6 +1991,11 @@ static void test___C_specific_handler(void)
#if defined(__i386__) || defined(__x86_64__)
+static DWORD WINAPI dummy_thread(void *arg)
+{
+ return 0;
+}
+
static void test_debug_registers(void)
{
static const struct
@@ -2004,6 +2009,7 @@ static void test_debug_registers(void)
};
NTSTATUS status;
CONTEXT ctx;
+ HANDLE thread;
int i;
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
@@ -2032,6 +2038,30 @@ static void test_debug_registers(void)
ok((ctx.Dr6 & 0xf00f) == tests[i].dr6, "test %d: expected %lx, got %lx\n", i, tests[i].dr6, (DWORD_PTR)ctx.Dr6);
ok((ctx.Dr7 & ~0xdc00) == tests[i].dr7, "test %d: expected %lx, got %lx\n", i, tests[i].dr7, (DWORD_PTR)ctx.Dr7);
}
+
+ memset(&ctx, 0, sizeof(ctx));
+ ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;
+ ctx.Dr0 = 0xffffffff;
+ ctx.Dr1 = 0xffffffff;
+ ctx.Dr2 = 0xffffffff;
+ ctx.Dr3 = 0xffffffff;
+ ctx.Dr6 = 0xffffffff;
+ ctx.Dr7 = 0x00000400;
+ status = pNtSetContextThread(GetCurrentThread(), &ctx);
+ ok(status == STATUS_SUCCESS, "NtSetContextThread failed with %x\n", status);
+ thread = CreateThread(NULL, 0, dummy_thread, NULL, CREATE_SUSPENDED, NULL);
+ ok(thread != INVALID_HANDLE_VALUE, "CreateThread failed with %d\n", GetLastError());
+ ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;
+ status = pNtGetContextThread(thread, &ctx);
+ ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", status);
+ ok(!ctx.Dr0, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr0);
+ ok(!ctx.Dr1, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr1);
+ ok(!ctx.Dr2, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr2);
+ ok(!ctx.Dr3, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr3);
+ todo_wine ok(!ctx.Dr6, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr6);
+ todo_wine ok(!ctx.Dr7, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr7);
+ TerminateThread(thread, 0);
+ CloseHandle(thread);
}
static DWORD outputdebugstring_exceptions;
More information about the wine-cvs
mailing list