- Stub NtSystemDebugControl.

- Fully support _WINKD_. Change this to 1, and get kdcom.dll from Windows 2003 or TinyKRNL and you'll be able to connect to WinDBG if using the right debug settings. You can now boot to desktop with WinDBG connected and see debug messages, but not much else is supported.
- Fix bugs in KeGetBugMessageText.
- Implement KeEnterKernelDebugger.

svn path=/trunk/; revision=25994
This commit is contained in:
Alex Ionescu 2007-03-05 01:35:43 +00:00
parent aafc3a967a
commit 05f82784bd
7 changed files with 127 additions and 62 deletions

View file

@ -60,23 +60,6 @@ NtSystemDebugControl(SYSDBG_COMMAND ControlCode,
ULONG OutputBufferLength,
PULONG ReturnLength)
{
switch (ControlCode)
{
case SysDbgQueryTraceInformation:
case SysDbgSetTracepoint:
case SysDbgSetSpecialCall:
case SysDbgClearSpecialCalls:
case SysDbgQuerySpecialCalls:
case SysDbgBreakPoint:
break;
case SysDbgQueryVersion:
KDB_LOADUSERMODULE_HOOK((PLDR_DATA_TABLE_ENTRY) InputBuffer);
break;
default:
break;
}
/* FIXME: TODO */
return STATUS_SUCCESS;
}

View file

@ -16,6 +16,7 @@ extern KD_PORT_INFORMATION GdbPortInfo;
extern BOOLEAN _KdDebuggerEnabled;
extern BOOLEAN _KdDebuggerNotPresent;
extern BOOLEAN KdBreakAfterSymbolLoad;
extern BOOLEAN KdPitchDebugger;
BOOLEAN
NTAPI

View file

@ -19,6 +19,7 @@ BOOLEAN KdDebuggerNotPresent = TRUE;
BOOLEAN KiEnableTimerWatchdog = FALSE;
BOOLEAN KdBreakAfterSymbolLoad = FALSE;
BOOLEAN KdpBreakPending;
BOOLEAN KdPitchDebugger = TRUE;
VOID STDCALL PspDumpThreads(BOOLEAN SystemThreads);
typedef struct
@ -234,22 +235,6 @@ KdPollBreakIn(VOID)
return KdpBreakPending;
}
/*
* @implemented
*/
VOID
STDCALL
KeEnterKernelDebugger(VOID)
{
HalDisplayString("\n\n *** Entered kernel debugger ***\n");
/* Set the Variable */
KdEnteredDebugger = TRUE;
/* Halt the CPU */
for (;;) Ke386HaltProcessor();
}
/*
* @unimplemented
*/

View file

@ -1157,8 +1157,8 @@ KdEnableDebugger(VOID)
}
/*
* @unimplemented
*/
* @unimplemented
*/
NTSTATUS
NTAPI
KdSystemDebugControl(IN SYSDBG_COMMAND Command,
@ -1173,20 +1173,60 @@ KdSystemDebugControl(IN SYSDBG_COMMAND Command,
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
NtQueryDebugFilterState(ULONG ComponentId,
ULONG Level)
{
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
NtSetDebugFilterState(ULONG ComponentId,
ULONG Level,
BOOLEAN State)
{
return STATUS_SUCCESS;
/*
* @unimplemented
*/
NTSTATUS
NTAPI
KdChangeOption(IN KD_OPTION Option,
IN ULONG InBufferBytes OPTIONAL,
IN PVOID InBuffer,
IN ULONG OutBufferBytes OPTIONAL,
OUT PVOID OutBuffer,
OUT PULONG OutBufferNeeded OPTIONAL)
{
/* HACK */
return STATUS_SUCCESS;
}
/*
* @unimplemented
*/
NTSTATUS
NTAPI
KdPowerTransition(IN DEVICE_POWER_STATE NewState)
{
/* HACK */
return STATUS_SUCCESS;
}
/*
* @unimplemented
*/
NTSTATUS
NTAPI
KdDisableDebugger(VOID)
{
/* HACK */
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
NtQueryDebugFilterState(ULONG ComponentId,
ULONG Level)
{
/* HACK */
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
NtSetDebugFilterState(ULONG ComponentId,
ULONG Level,
BOOLEAN State)
{
/* HACK */
return STATUS_SUCCESS;
}

View file

@ -99,7 +99,7 @@ KeRosDumpStackFrames(IN PULONG Frame OPTIONAL,
}
/* Print it out */
if (!KeRosPrintAddress((PVOID)Addr)) DbgPrint("<%X>", Addr);
KiRosPrintAddress((PVOID)Addr);
/* Go to the next frame */
DbgPrint("\n");
@ -148,7 +148,7 @@ KiInitializeBugCheck(VOID)
}
}
VOID
BOOLEAN
NTAPI
KeGetBugMessageText(IN ULONG BugCheckCode,
OUT PANSI_STRING OutputString OPTIONAL)
@ -157,6 +157,10 @@ KeGetBugMessageText(IN ULONG BugCheckCode,
ULONG IdOffset;
ULONG_PTR MessageEntry;
PCHAR BugCode;
BOOLEAN Result = FALSE;
/* Make sure we're not bugchecking too early */
if (!KiBugCodeMessages) return Result;
/* Find the message. This code is based on RtlFindMesssage */
for (i = 0; i < KiBugCodeMessages->NumberOfBlocks; i++)
@ -164,7 +168,7 @@ KeGetBugMessageText(IN ULONG BugCheckCode,
/* Check if the ID Matches */
if ((BugCheckCode >= KiBugCodeMessages->Blocks[i].LowId) &&
(BugCheckCode <= KiBugCodeMessages->Blocks[i].HighId))
{
{
/* Get Offset to Entry */
MessageEntry = KiBugCodeMessages->Blocks[i].OffsetToEntries +
(ULONG_PTR)KiBugCodeMessages;
@ -182,22 +186,39 @@ KeGetBugMessageText(IN ULONG BugCheckCode,
BugCode = ((PRTL_MESSAGE_RESOURCE_ENTRY)MessageEntry)->Text;
i = strlen(BugCode);
/* Return it in the OutputString */
/* Handle newlines */
while ((i > 0) && ((BugCode[i] == '\n') ||
(BugCode[i] == '\r') ||
(BugCode[i] == ANSI_NULL)))
{
/* Check if we have a string to return */
if (!OutputString) BugCode[i] = ANSI_NULL;
i--;
}
/* Check if caller wants an output string */
if (OutputString)
{
/* Return it in the OutputString */
OutputString->Buffer = BugCode;
OutputString->Length = i + 1;
OutputString->MaximumLength = i + 1;
OutputString->Length = (USHORT)i + 1;
OutputString->MaximumLength = (USHORT)i + 1;
}
else
{
/* Direct Output to Screen */
InbvDisplayString(BugCode);
InbvDisplayString("\r");
break;
}
/* We're done */
Result = TRUE;
break;
}
}
/* Return the result */
return Result;
}
VOID
@ -489,7 +510,7 @@ KiDisplayBlueScreen(IN ULONG MessageId,
/* Print message for technical information */
KeGetBugMessageText(BUGCHECK_TECH_INFO, NULL);
/* Show the techincal Data */
/* Show the technical Data */
sprintf(AnsiName,
"\r\n\r\n*** STOP: 0x%08lX (0x%p,0x%p,0x%p,0x%p)\r\n\r\n",
KiBugCheckData[0],
@ -819,6 +840,9 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
}
/* Check if we need to save the context for KD */
#ifdef _WINKD_
if (!KdPitchDebugger) KdDebuggerDataBlock.SavedContext = (ULONG)&Context;
#endif
/* Check if a debugger is connected */
if ((BugCheckCode != MANUALLY_INITIATED_CRASH) && (KdDebuggerEnabled))
@ -901,12 +925,14 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
AnsiName);
/* Check if the debugger is disabled but we can enable it */
//if (!(KdDebuggerEnabled) && !(KdPitchDebugger))
if (!(KdDebuggerEnabled) && !(KdPitchDebugger))
{
/* Enable it */
//KdEnableDebuggerWithLock(FALSE);
#ifdef _WINKD_
KdEnableDebuggerWithLock(FALSE);
#endif
}
//else
else
{
/* Otherwise, print the last line */
InbvDisplayString("\r\n");
@ -1116,4 +1142,30 @@ KeBugCheck(ULONG BugCheckCode)
KeBugCheckWithTf(BugCheckCode, 0, 0, 0, 0, NULL);
}
/*
* @implemented
*/
VOID
NTAPI
KeEnterKernelDebugger(VOID)
{
/* Disable interrupts */
KiHardwareTrigger = 1;
_disable();
/* Check the bugcheck count */
if (!InterlockedDecrement(&KeBugCheckCount))
{
/* There was only one, is the debugger disabled? */
if (!(KdDebuggerEnabled) && !(KdPitchDebugger))
{
/* Enable the debugger */
KdInitSystem(0, NULL);
}
}
/* Bugcheck */
KiBugCheckDebugBreak(DBG_STATUS_FATAL);
}
/* EOF */

View file

@ -17,6 +17,7 @@
KTIMER_TABLE_ENTRY KiTimerTableListHead[TIMER_TABLE_SIZE];
LARGE_INTEGER KiTimeIncrementReciprocal;
UCHAR KiTimeIncrementShiftCount;
BOOLEAN KiEnableTimerWatchdog;
/* PRIVATE FUNCTIONS *********************************************************/

View file

@ -10,6 +10,9 @@
<define name="__USE_W32API" />
<define name="WIN9X_COMPAT_SPINLOCK" />
<define name="_IN_KERNEL_" />
<if property="_WINKD_" value="1">
<define name="_WINKD_" />
</if>
<include base="cmlib">.</include>
<include base="ntoskrnl">include</include>
<include base="ReactOS">include/reactos/drivers</include>