}\r
else if (SecondChanceException)\r
{\r
- /* We won't bother unless this is second chance */\r
+ /* We won't bother unless this is first chance */\r
return FALSE;\r
}\r
\r
RtlCopyMemory(ContextRecord,\r
&Prcb->ProcessorState.ContextFrame,\r
sizeof(CONTEXT));\r
- //KiRestoreProcessorControlState(&Prcb->ProcessorState);\r
+ KiRestoreProcessorControlState(&Prcb->ProcessorState);\r
\r
/* Exit the debugger and clear the CTRL-C state */\r
KdExitDebugger(Entered);\r
IN BOOLEAN SecondChanceException)\r
{\r
BOOLEAN Unload = FALSE;\r
- ULONG Eip, Eax;\r
+ ULONG_PTR ProgramCounter, ReturnValue;\r
BOOLEAN Status = FALSE;\r
\r
/*\r
if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) &&\r
(ExceptionRecord->ExceptionInformation[0] != BREAKPOINT_BREAK))\r
{\r
- /* Save EIP */\r
- Eip = ContextRecord->Eip;\r
+ /* Save Program Counter */\r
+ ProgramCounter = KeGetContextPc(ContextRecord);\r
\r
/* Check what kind of operation was requested from us */\r
switch (ExceptionRecord->ExceptionInformation[0])\r
case BREAKPOINT_PRINT:\r
\r
/* Call the worker routine */\r
- Eax = KdpPrint(ContextRecord->Ebx,\r
- ContextRecord->Edi,\r
- (LPSTR)ExceptionRecord->ExceptionInformation[1],\r
- (ULONG)ExceptionRecord->ExceptionInformation[2],\r
- PreviousMode,\r
- TrapFrame,\r
- ExceptionFrame,\r
- &Status);\r
+ ReturnValue = KdpPrint((ULONG)ContextRecord->Ebx,\r
+ (ULONG)ContextRecord->Edi,\r
+ (LPSTR)ExceptionRecord->\r
+ ExceptionInformation[1],\r
+ (USHORT)ExceptionRecord->\r
+ ExceptionInformation[2],\r
+ PreviousMode,\r
+ TrapFrame,\r
+ ExceptionFrame,\r
+ &Status);\r
\r
/* Update the return value for the caller */\r
- ContextRecord->Eax = Eax;\r
+ KeSetContextReturnRegister(ContextRecord, ReturnValue);\r
break;\r
\r
/* DbgPrompt */\r
case BREAKPOINT_PROMPT:\r
\r
/* Call the worker routine */\r
- while (TRUE);\r
- Eax = 0;\r
+ ReturnValue = KdpPrompt((LPSTR)ExceptionRecord->\r
+ ExceptionInformation[1],\r
+ (USHORT)ExceptionRecord->\r
+ ExceptionInformation[2],\r
+ (LPSTR)ContextRecord->Ebx,\r
+ (USHORT)ContextRecord->Edi,\r
+ PreviousMode,\r
+ TrapFrame,\r
+ ExceptionFrame);\r
Status = TRUE;\r
\r
/* Update the return value for the caller */\r
- ContextRecord->Eax = Eax;\r
+ KeSetContextReturnRegister(ContextRecord, ReturnValue);\r
break;\r
\r
- /* DbgUnloadSymbols */\r
+ /* DbgUnloadImageSymbols */\r
case BREAKPOINT_UNLOAD_SYMBOLS:\r
\r
/* Drop into the load case below, with the unload parameter */\r
Unload = TRUE;\r
\r
- /* DbgLoadSymbols */\r
+ /* DbgLoadImageSymbols */\r
case BREAKPOINT_LOAD_SYMBOLS:\r
\r
/* Call the worker routine */\r
- KdpSymbol((PVOID)ExceptionRecord->ExceptionInformation[1],\r
- (PVOID)ExceptionRecord->ExceptionInformation[2],\r
+ KdpSymbol((PSTRING)ExceptionRecord->\r
+ ExceptionInformation[1],\r
+ (PKD_SYMBOLS_INFO)ExceptionRecord->\r
+ ExceptionInformation[2],\r
Unload,\r
PreviousMode,\r
ContextRecord,\r
Status = TRUE;\r
break;\r
\r
- /* DbgCommandString*/\r
+ /* DbgCommandString */\r
case BREAKPOINT_COMMAND_STRING:\r
\r
/* Call the worker routine */\r
- while (TRUE);\r
+ KdpCommandString((ULONG)ExceptionRecord->\r
+ ExceptionInformation[1],\r
+ (LPSTR)ExceptionRecord->\r
+ ExceptionInformation[2],\r
+ PreviousMode,\r
+ ContextRecord,\r
+ TrapFrame,\r
+ ExceptionFrame);\r
Status = TRUE;\r
\r
/* Anything else, do nothing */\r
}\r
\r
/*\r
- * If EIP was not updated, we'll increment it ourselves so execution\r
+ * If the PC was not updated, we'll increment it ourselves so execution\r
* continues past the breakpoint.\r
*/\r
- if (ContextRecord->Eip == Eip) ContextRecord->Eip++;\r
+ if (ProgramCounter == KeGetContextPc(ContextRecord))\r
+ {\r
+ /* Update it */\r
+ KeSetContextPc(ContextRecord,\r
+ ProgramCounter + KD_BREAKPOINT_SIZE);\r
+ }\r
}\r
else\r
{\r
(ExceptionCommand == BREAKPOINT_COMMAND_STRING) ||\r
(ExceptionCommand == BREAKPOINT_PRINT)))\r
{\r
- /* This we can handle: simply bump EIP */\r
- ContextRecord->Eip++;\r
+ /* This we can handle: simply bump the Program Counter */\r
+ KeSetContextPc(ContextRecord,\r
+ KeGetContextPc(ContextRecord) + KD_BREAKPOINT_SIZE);\r
return TRUE;\r
}\r
else if (KdPitchDebugger)\r
else if ((KdAutoEnableOnEvent) &&\r
(KdPreviouslyEnabled) &&\r
!(KdDebuggerEnabled) &&\r
- (KdEnableDebugger()) &&\r
+ (NT_SUCCESS(KdEnableDebugger())) &&\r
(KdDebuggerEnabled))\r
{\r
/* Debugging was Auto-Enabled. We can now send this to KD. */\r