server: Set debug enable bits briefly to commit the addresses to kernel.

This commit is contained in:
Grazvydas Ignotas 2011-07-15 23:19:11 +03:00 committed by Alexandre Julliard
parent fa179b1c26
commit 2cc56f379c
2 changed files with 3 additions and 1 deletions

View File

@ -510,7 +510,6 @@ static void check_debug_registers(int test_num, const struct dbgreg_test *test)
CHECK_DEBUG_REG(0, ~0);
CHECK_DEBUG_REG(1, ~0);
CHECK_DEBUG_REG(2, ~0);
if (test_num == 2) todo_wine
CHECK_DEBUG_REG(3, ~0);
CHECK_DEBUG_REG(6, 0x0f);
CHECK_DEBUG_REG(7, ~0xdc00);

View File

@ -605,6 +605,8 @@ void set_thread_context( struct thread *thread, const context_t *context, unsign
if (thread->context) thread->context->debug.i386_regs.dr3 = context->debug.i386_regs.dr3;
if (ptrace( PTRACE_POKEUSER, pid, DR_OFFSET(6), context->debug.i386_regs.dr6 ) == -1) goto error;
if (thread->context) thread->context->debug.i386_regs.dr6 = context->debug.i386_regs.dr6;
/* Linux 2.6.33+ needs enable bits set briefly to update value returned by PEEKUSER later */
ptrace( PTRACE_POKEUSER, pid, DR_OFFSET(7), context->debug.i386_regs.dr7 | 0x55 );
if (ptrace( PTRACE_POKEUSER, pid, DR_OFFSET(7), context->debug.i386_regs.dr7 ) == -1) goto error;
if (thread->context) thread->context->debug.i386_regs.dr7 = context->debug.i386_regs.dr7;
break;
@ -620,6 +622,7 @@ void set_thread_context( struct thread *thread, const context_t *context, unsign
if (thread->context) thread->context->debug.x86_64_regs.dr3 = context->debug.x86_64_regs.dr3;
if (ptrace( PTRACE_POKEUSER, pid, DR_OFFSET(6), context->debug.x86_64_regs.dr6 ) == -1) goto error;
if (thread->context) thread->context->debug.x86_64_regs.dr6 = context->debug.x86_64_regs.dr6;
ptrace( PTRACE_POKEUSER, pid, DR_OFFSET(7), context->debug.x86_64_regs.dr7 | 0x55 );
if (ptrace( PTRACE_POKEUSER, pid, DR_OFFSET(7), context->debug.x86_64_regs.dr7 ) == -1) goto error;
if (thread->context) thread->context->debug.x86_64_regs.dr7 = context->debug.x86_64_regs.dr7;
break;