Author: ion Date: Mon Mar 5 06:23:58 2007 New Revision: 25997
URL: http://svn.reactos.org/svn/reactos?rev=25997&view=rev Log: - Fix KdpSetCommonSTate to clear breakpoints. - Allow KdpReadVirtualMemory to read SharedUserData since it's now readable. - Allow it to read user-mode pointers as well, just not null-pointers. - Fix KdpReportExceptionStateChange by implementing DumpTraceData. Now the crash in ndis.sys gets caught. - Next up: implement breakpoints so that stepping out works.
Modified: trunk/reactos/ntoskrnl/include/internal/kd64.h trunk/reactos/ntoskrnl/kd64/kdapi.c trunk/reactos/ntoskrnl/kd64/kddata.c
Modified: trunk/reactos/ntoskrnl/include/internal/kd64.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/k... ============================================================================== --- trunk/reactos/ntoskrnl/include/internal/kd64.h (original) +++ trunk/reactos/ntoskrnl/include/internal/kd64.h Mon Mar 5 06:23:58 2007 @@ -219,6 +219,13 @@ NTAPI KdpDeleteBreakpoint( IN ULONG BpEntry +); + +BOOLEAN +NTAPI +KdpDeleteBreakpointRange( + IN PVOID Base, + IN PVOID Limit );
// @@ -262,3 +269,5 @@ extern BOOLEAN BreakpointsSuspended; extern ULONG KdpNumInternalBreakpoints; extern ULONG KdpCurrentSymbolStart, KdpCurrentSymbolEnd; +extern ULONG TraceDataBuffer[40]; +extern ULONG TraceDataBufferPosition;
Modified: trunk/reactos/ntoskrnl/kd64/kdapi.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/kdapi.c?rev=2... ============================================================================== --- trunk/reactos/ntoskrnl/kd64/kdapi.c (original) +++ trunk/reactos/ntoskrnl/kd64/kdapi.c Mon Mar 5 06:23:58 2007 @@ -16,6 +16,21 @@
VOID NTAPI +DumpTraceData(IN PSTRING TraceData) +{ + /* Update the buffer */ + TraceDataBuffer[0] = TraceDataBufferPosition; + + /* Setup the trace data */ + TraceData->Length = TraceDataBufferPosition * sizeof(ULONG); + TraceData->Buffer = (PCHAR)TraceDataBuffer; + + /* Reset the buffer location */ + TraceDataBufferPosition = 1; +} + +VOID +NTAPI KdpGetStateChange(IN PDBGKD_MANIPULATE_STATE64 State, IN PCONTEXT Context) { @@ -87,13 +102,10 @@ WaitStateChange->ControlReport.InstructionCount = InstructionCount;
/* Clear all the breakpoints in this region */ - HadBreakpoints = FALSE; -#if 0 - KdpDeleteBreakpointRange((PVOID)WaitStateChange->ProgramCounter, - (PVOID)(WaitStateChange->ProgramCounter + - WaitStateChange->ControlReport. - InstructionCount - 1)); -#endif + HadBreakpoints = + KdpDeleteBreakpointRange((PVOID)(LONG_PTR)WaitStateChange->ProgramCounter, + (PVOID)((ULONG)WaitStateChange->ProgramCounter + + WaitStateChange->ControlReport.InstructionCount - 1)); if (HadBreakpoints) { /* Copy the instruction stream again, this time without breakpoints */ @@ -190,12 +202,7 @@ } #endif
- if ((ULONG_PTR)State->u.ReadMemory.TargetBaseAddress < KSEG0_BASE) - { - Length = 0; - Status = STATUS_UNSUCCESSFUL; - } - else if ((ULONG_PTR)State->u.ReadMemory.TargetBaseAddress >= (ULONG_PTR)SharedUserData) + if (!State->u.ReadMemory.TargetBaseAddress) { Length = 0; Status = STATUS_UNSUCCESSFUL; @@ -900,6 +907,9 @@ Header.Length = sizeof(DBGKD_WAIT_STATE_CHANGE64); Header.Buffer = (PCHAR)&WaitStateChange;
+ /* Setup the trace data */ + DumpTraceData(&Data); + /* Send State Change packet and wait for a reply */ Status = KdpSendWaitContinue(PACKET_TYPE_KD_STATE_CHANGE64, &Header, @@ -971,13 +981,9 @@ KdSave(FALSE);
/* Report a state change */ -#if 0 Status = KdpReportExceptionStateChange(ExceptionRecord, ContextRecord, SecondChanceException); -#else - Status = FALSE; -#endif
/* Restore the port data and return */ KdRestore(FALSE);
Modified: trunk/reactos/ntoskrnl/kd64/kddata.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/kddata.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/kd64/kddata.c (original) +++ trunk/reactos/ntoskrnl/kd64/kddata.c Mon Mar 5 06:23:58 2007 @@ -54,6 +54,12 @@ ULONG KdpNumInternalBreakpoints;
ULONG KdpCurrentSymbolStart, KdpCurrentSymbolEnd; + +// +// Tracepoint Data +// +ULONG TraceDataBuffer[40]; +ULONG TraceDataBufferPosition = 1;
// // Time Slip Support