- 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.

svn path=/trunk/; revision=25997
This commit is contained in:
Alex Ionescu 2007-03-05 03:23:58 +00:00
parent e707b70756
commit 5e5311f4ae
3 changed files with 38 additions and 17 deletions

View file

@ -221,6 +221,13 @@ KdpDeleteBreakpoint(
IN ULONG BpEntry
);
BOOLEAN
NTAPI
KdpDeleteBreakpointRange(
IN PVOID Base,
IN PVOID Limit
);
//
// Global KD Data
//
@ -262,3 +269,5 @@ extern BOOLEAN KdpOweBreakpoint;
extern BOOLEAN BreakpointsSuspended;
extern ULONG KdpNumInternalBreakpoints;
extern ULONG KdpCurrentSymbolStart, KdpCurrentSymbolEnd;
extern ULONG TraceDataBuffer[40];
extern ULONG TraceDataBufferPosition;

View file

@ -14,6 +14,21 @@
/* PRIVATE FUNCTIONS *********************************************************/
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,
@ -87,13 +102,10 @@ KdpSetCommonState(IN ULONG NewState,
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 @@ KdpReadVirtualMemory(IN PDBGKD_MANIPULATE_STATE64 State,
}
#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 @@ KdpReportExceptionStateChange(IN PEXCEPTION_RECORD ExceptionRecord,
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 @@ KdpSwitchProcessor(IN PEXCEPTION_RECORD ExceptionRecord,
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);

View file

@ -55,6 +55,12 @@ ULONG KdpNumInternalBreakpoints;
ULONG KdpCurrentSymbolStart, KdpCurrentSymbolEnd;
//
// Tracepoint Data
//
ULONG TraceDataBuffer[40];
ULONG TraceDataBufferPosition = 1;
//
// Time Slip Support
//