mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
- Implement KdpSetContext.
- Fix KdpReport, it was totally out of whack. svn path=/branches/alex-kd-branch/; revision=25853
This commit is contained in:
parent
3006d54080
commit
bf616180df
3 changed files with 103 additions and 63 deletions
|
@ -121,9 +121,6 @@ KdpGetVersion(IN PDBGKD_MANIPULATE_STATE64 State)
|
|||
&KdpContext);
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN VirtCalled = FALSE;
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KdpReadVirtualMemory(IN PDBGKD_MANIPULATE_STATE64 State,
|
||||
|
@ -326,6 +323,54 @@ KdpGetContext(IN PDBGKD_MANIPULATE_STATE64 State,
|
|||
&KdpContext);
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KdpSetContext(IN PDBGKD_MANIPULATE_STATE64 State,
|
||||
IN PSTRING Data,
|
||||
IN PCONTEXT Context)
|
||||
{
|
||||
STRING Header;
|
||||
PVOID ControlStart;
|
||||
|
||||
/* Setup the header */
|
||||
Header.Length = sizeof(DBGKD_MANIPULATE_STATE64);
|
||||
Header.Buffer = (PCHAR)State;
|
||||
ASSERT(Data->Length == 0);
|
||||
|
||||
/* Make sure that this is a valid request */
|
||||
if (State->Processor < KeNumberProcessors)
|
||||
{
|
||||
/* Check if the request is for this CPU */
|
||||
if (State->Processor == KeGetCurrentPrcb()->Number)
|
||||
{
|
||||
/* We're just copying our own context */
|
||||
ControlStart = Context;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* SMP not yet handled */
|
||||
ControlStart = NULL;
|
||||
while (TRUE);
|
||||
}
|
||||
|
||||
/* Copy the memory */
|
||||
RtlCopyMemory(ControlStart, Data->Buffer, sizeof(CONTEXT));
|
||||
|
||||
/* Finish up */
|
||||
State->ReturnStatus = STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Invalid request */
|
||||
State->ReturnStatus = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
/* Send the reply */
|
||||
KdSendPacket(PACKET_TYPE_KD_STATE_MANIPULATE,
|
||||
&Header,
|
||||
Data,
|
||||
&KdpContext);
|
||||
}
|
||||
|
||||
KCONTINUE_STATUS
|
||||
NTAPI
|
||||
|
@ -377,7 +422,6 @@ SendPacket:
|
|||
|
||||
/* Read virtual memory */
|
||||
KdpReadVirtualMemory(&ManipulateState, &Data, Context);
|
||||
VirtCalled = TRUE;
|
||||
break;
|
||||
|
||||
case DbgKdWriteVirtualMemoryApi:
|
||||
|
@ -389,15 +433,14 @@ SendPacket:
|
|||
|
||||
case DbgKdGetContextApi:
|
||||
|
||||
/* FIXME: TODO */
|
||||
/* Get the current context */
|
||||
KdpGetContext(&ManipulateState, &Data, Context);
|
||||
break;
|
||||
|
||||
case DbgKdSetContextApi:
|
||||
|
||||
/* FIXME: TODO */
|
||||
Ke386SetCr2(DbgKdSetContextApi);
|
||||
while (TRUE);
|
||||
/* Set a new context */
|
||||
KdpSetContext(&ManipulateState, &Data, Context);
|
||||
break;
|
||||
|
||||
case DbgKdWriteBreakPointApi:
|
||||
|
|
|
@ -248,6 +248,7 @@ KdInitSystem(IN ULONG BootPhase,
|
|||
|
||||
/* Check for incoming breakin and break on symbol load if we have it*/
|
||||
KdBreakAfterSymbolLoad = KdPollBreakIn();
|
||||
while (TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -25,32 +25,31 @@ KdpReport(IN PKTRAP_FRAME TrapFrame,
|
|||
{
|
||||
BOOLEAN Entered, Status;
|
||||
PKPRCB Prcb;
|
||||
while (TRUE);
|
||||
NTSTATUS ExceptionCode = ExceptionRecord->ExceptionCode;
|
||||
|
||||
/*
|
||||
* Only go ahead with this if this is an INT3 or an INT1, or if the global
|
||||
* flag forces us to call up the debugger on exception, or if this is a
|
||||
* second chance exception which means it hasn't been handled by now.
|
||||
*/
|
||||
if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) ||
|
||||
(ExceptionRecord->ExceptionCode == STATUS_SINGLE_STEP) ||
|
||||
(NtGlobalFlag & FLG_STOP_ON_EXCEPTION) ||
|
||||
(SecondChanceException))
|
||||
/* Check if this is INT1 or 3, or if we're forced to handle it */
|
||||
if ((ExceptionCode == STATUS_BREAKPOINT) ||
|
||||
(ExceptionCode == STATUS_SINGLE_STEP) ||
|
||||
//(ExceptionCode == STATUS_ASSERTION_FAILURE) ||
|
||||
(NtGlobalFlag & FLG_STOP_ON_EXCEPTION))
|
||||
{
|
||||
/*
|
||||
* Also, unless this is a second chance exception, then do not call up
|
||||
* the debugger if the debug port is disconnected or the exception code
|
||||
* indicates success.
|
||||
*/
|
||||
if (!(SecondChanceException) &&
|
||||
((ExceptionRecord->ExceptionCode == STATUS_PORT_DISCONNECTED) ||
|
||||
(NT_SUCCESS(ExceptionRecord->ExceptionCode))))
|
||||
/* Check if we can't really handle this */
|
||||
if ((SecondChanceException) ||
|
||||
(ExceptionCode == STATUS_PORT_DISCONNECTED) ||
|
||||
(NT_SUCCESS(ExceptionCode)))
|
||||
{
|
||||
/* Return false to hide the exception */
|
||||
/* Return false to have someone else take care of the exception */
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (SecondChanceException)
|
||||
{
|
||||
/* We won't bother unless this is second chance */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Enter the debugger */
|
||||
while (TRUE);
|
||||
Entered = KdEnterDebugger(TrapFrame, ExceptionFrame);
|
||||
|
||||
/*
|
||||
|
@ -70,6 +69,7 @@ KdpReport(IN PKTRAP_FRAME TrapFrame,
|
|||
ContextFrame,
|
||||
SecondChanceException);
|
||||
#else
|
||||
while (TRUE);
|
||||
Status = FALSE;
|
||||
#endif
|
||||
|
||||
|
@ -83,10 +83,6 @@ KdpReport(IN PKTRAP_FRAME TrapFrame,
|
|||
KdExitDebugger(Entered);
|
||||
KdpControlCPressed = FALSE;
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Fail if we got here */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
|
|
Loading…
Reference in a new issue