ULONG DebugMask = KeGetCurrentThread()->DispatcherHeader.DebugActive;
/* Check if debugging is enabled */
- if (DebugMask & DR_ACTIVE_MASK)
+ if (DebugMask & DR_MASK(DR7_OVERRIDE_V))
{
/* Sanity checks */
ASSERT((DebugMask & DR_REG_MASK) != 0);
Result = FALSE;
/* Check the DR mask */
- NewMask &= 0x7F;
+ NewMask &= ~(DR_MASK(7));
if (NewMask & DR_REG_MASK)
{
/* Set the active mask */
- NewMask |= DR_ACTIVE_MASK;
+ NewMask |= DR_MASK(DR7_OVERRIDE_V);
/* Set DR7 override */
*DrMask = DR7_OVERRIDE_MASK;
Result = NewMask ? TRUE: FALSE;
/* Update the mask to disable debugging */
- NewMask &= ~DR_ACTIVE_MASK;
- NewMask |= 0x80;
+ NewMask &= ~(DR_MASK(DR7_OVERRIDE_V));
+ NewMask |= DR_MASK(7);
}
/* Check if caller wants the new mask */
/* Set the context flags */
Context.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;
- /* Check if User Mode or if the debugger is enabled */
+ /* Check if User Mode or if the debugger isenabled */
if ((PreviousMode == UserMode) || (KdDebuggerEnabled))
{
/* Add the FPU Flag */
goto Handled;
}
+ /* HACK: GDB Entry */
+ if (KdpCallGdb(TrapFrame, ExceptionRecord, &Context)) goto Handled;
+
/* If the Debugger couldn't handle it, dispatch the exception */
if (RtlDispatchException(ExceptionRecord, &Context)) goto Handled;
}
goto Handled;
}
+ /* HACK: GDB Entry */
+ if (KdpCallGdb(TrapFrame, ExceptionRecord, &Context)) goto Handled;
+
/* Forward exception to user mode debugger */
if (DbgkForwardException(ExceptionRecord, TRUE, FALSE)) goto Exit;
return (NTSTATUS)OldEip;
}
-
-