mirror of
https://github.com/reactos/reactos.git
synced 2025-06-08 02:40:32 +00:00
[KD]
- When enabling or disabling the kernel debugger and setting the KdDebuggerEnabled flag, also update the corresponding user-mode flag in SharedUserData->KdDebuggerEnabled. - Turn KdpGetMemorySizeInMBs into a INIT_FUNCTION. - Print kernel command line & ARC paths even in debug log file mode. [KD64] WinKD: Also print our nice ReactOS debug header (version, # of processors & memory MB, kernel command line and ARC paths). svn path=/trunk/; revision=72922
This commit is contained in:
parent
9593c338c3
commit
f239ca0f04
5 changed files with 89 additions and 7 deletions
|
@ -118,8 +118,9 @@ KdpGetDebugMode(PCHAR Currentp2)
|
||||||
KdpDebugMode.Gdb = TRUE;
|
KdpDebugMode.Gdb = TRUE;
|
||||||
|
|
||||||
/* Enable Debugging */
|
/* Enable Debugging */
|
||||||
KdDebuggerEnabled = TRUE;
|
|
||||||
KdDebuggerNotPresent = FALSE;
|
KdDebuggerNotPresent = FALSE;
|
||||||
|
KdDebuggerEnabled = TRUE;
|
||||||
|
SharedUserData->KdDebuggerEnabled = TRUE;
|
||||||
WrapperInitRoutine = KdpGdbStubInit;
|
WrapperInitRoutine = KdpGdbStubInit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,8 +132,9 @@ KdpGetDebugMode(PCHAR Currentp2)
|
||||||
KdpDebugMode.Pice = TRUE;
|
KdpDebugMode.Pice = TRUE;
|
||||||
|
|
||||||
/* Enable Debugging */
|
/* Enable Debugging */
|
||||||
KdDebuggerEnabled = TRUE;
|
|
||||||
KdDebuggerNotPresent = FALSE;
|
KdDebuggerNotPresent = FALSE;
|
||||||
|
KdDebuggerEnabled = TRUE;
|
||||||
|
SharedUserData->KdDebuggerEnabled = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return p2;
|
return p2;
|
||||||
|
@ -192,14 +194,17 @@ KdInitSystem(ULONG BootPhase,
|
||||||
else if (strstr(CommandLine, "DEBUG"))
|
else if (strstr(CommandLine, "DEBUG"))
|
||||||
{
|
{
|
||||||
/* Enable the kernel debugger */
|
/* Enable the kernel debugger */
|
||||||
KdDebuggerEnabled = TRUE;
|
|
||||||
KdDebuggerNotPresent = FALSE;
|
KdDebuggerNotPresent = FALSE;
|
||||||
|
KdDebuggerEnabled = TRUE;
|
||||||
#ifdef KDBG
|
#ifdef KDBG
|
||||||
/* Get the KDBG Settings */
|
/* Get the KDBG Settings */
|
||||||
KdbpGetCommandLineSettings(LoaderBlock->LoadOptions);
|
KdbpGetCommandLineSettings(LoaderBlock->LoadOptions);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Let user-mode know our state */
|
||||||
|
SharedUserData->KdDebuggerEnabled = KdDebuggerEnabled;
|
||||||
|
|
||||||
/* Get the port and baud rate */
|
/* Get the port and baud rate */
|
||||||
Port = strstr(CommandLine, "DEBUGPORT");
|
Port = strstr(CommandLine, "DEBUGPORT");
|
||||||
BaudRate = strstr(CommandLine, "BAUDRATE");
|
BaudRate = strstr(CommandLine, "BAUDRATE");
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include <ntoskrnl.h>
|
#include <ntoskrnl.h>
|
||||||
#include <reactos/buildno.h>
|
#include <reactos/buildno.h>
|
||||||
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
@ -53,9 +54,11 @@ volatile BOOLEAN KdbpIsInDmesgMode = FALSE;
|
||||||
*
|
*
|
||||||
* Strongly inspired by:
|
* Strongly inspired by:
|
||||||
* mm\ARM3\mminit.c : MiScanMemoryDescriptors(...)
|
* mm\ARM3\mminit.c : MiScanMemoryDescriptors(...)
|
||||||
|
*
|
||||||
|
* See also: kd64\kdinit.c
|
||||||
*/
|
*/
|
||||||
SIZE_T
|
static SIZE_T
|
||||||
NTAPI
|
INIT_FUNCTION
|
||||||
KdpGetMemorySizeInMBs(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
KdpGetMemorySizeInMBs(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY ListEntry;
|
PLIST_ENTRY ListEntry;
|
||||||
|
@ -240,10 +243,15 @@ KdpInitDebugLog(PKD_DISPATCH_TABLE DispatchTable,
|
||||||
KeInitializeSpinLock(&KdpDebugLogSpinLock);
|
KeInitializeSpinLock(&KdpDebugLogSpinLock);
|
||||||
|
|
||||||
/* Display separator + ReactOS version at start of the debug log */
|
/* Display separator + ReactOS version at start of the debug log */
|
||||||
DPRINT1("---------------------------------------------------------------\n");
|
DPRINT1("-----------------------------------------------------\n");
|
||||||
DPRINT1("ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n");
|
DPRINT1("ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n");
|
||||||
MemSizeMBs = MmNumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024;
|
MemSizeMBs = MmNumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024;
|
||||||
DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs);
|
DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs);
|
||||||
|
DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions);
|
||||||
|
DPRINT1("ARC Paths: %s %s %s %s\n", KeLoaderBlock->ArcBootDeviceName,
|
||||||
|
KeLoaderBlock->NtHalPathName,
|
||||||
|
KeLoaderBlock->ArcHalDeviceName,
|
||||||
|
KeLoaderBlock->NtBootPathName);
|
||||||
}
|
}
|
||||||
else if (BootPhase == 2)
|
else if (BootPhase == 2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -295,6 +295,7 @@ KdDisableDebugger(VOID)
|
||||||
|
|
||||||
/* Disable the Debugger */
|
/* Disable the Debugger */
|
||||||
KdDebuggerEnabled = FALSE;
|
KdDebuggerEnabled = FALSE;
|
||||||
|
SharedUserData->KdDebuggerEnabled = FALSE;
|
||||||
|
|
||||||
/* Lower the IRQL */
|
/* Lower the IRQL */
|
||||||
KeLowerIrql(OldIrql);
|
KeLowerIrql(OldIrql);
|
||||||
|
@ -319,6 +320,7 @@ KdEnableDebugger(VOID)
|
||||||
|
|
||||||
/* Enable the Debugger */
|
/* Enable the Debugger */
|
||||||
KdDebuggerEnabled = TRUE;
|
KdDebuggerEnabled = TRUE;
|
||||||
|
SharedUserData->KdDebuggerEnabled = TRUE;
|
||||||
|
|
||||||
/* Lower the IRQL */
|
/* Lower the IRQL */
|
||||||
KeLowerIrql(OldIrql);
|
KeLowerIrql(OldIrql);
|
||||||
|
|
|
@ -2013,7 +2013,7 @@ KdEnableDebuggerWithLock(IN BOOLEAN NeedLock)
|
||||||
if (KdPreviouslyEnabled)
|
if (KdPreviouslyEnabled)
|
||||||
{
|
{
|
||||||
/* Reinitialize the Debugger */
|
/* Reinitialize the Debugger */
|
||||||
KdInitSystem(0, NULL) ;
|
KdInitSystem(0, NULL);
|
||||||
KdpRestoreAllBreakpoints();
|
KdpRestoreAllBreakpoints();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,61 @@
|
||||||
/* INCLUDES ******************************************************************/
|
/* INCLUDES ******************************************************************/
|
||||||
|
|
||||||
#include <ntoskrnl.h>
|
#include <ntoskrnl.h>
|
||||||
|
#include <reactos/buildno.h>
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* UTILITY FUNCTIONS *********************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the total size of the memory before
|
||||||
|
* Mm is initialized, by counting the number
|
||||||
|
* of physical pages. Useful for debug logging.
|
||||||
|
*
|
||||||
|
* Strongly inspired by:
|
||||||
|
* mm\ARM3\mminit.c : MiScanMemoryDescriptors(...)
|
||||||
|
*
|
||||||
|
* See also: kd\kdio.c
|
||||||
|
*/
|
||||||
|
static SIZE_T
|
||||||
|
INIT_FUNCTION
|
||||||
|
KdpGetMemorySizeInMBs(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
|
{
|
||||||
|
PLIST_ENTRY ListEntry;
|
||||||
|
PMEMORY_ALLOCATION_DESCRIPTOR Descriptor;
|
||||||
|
SIZE_T NumberOfPhysicalPages = 0;
|
||||||
|
|
||||||
|
/* Loop the memory descriptors */
|
||||||
|
for (ListEntry = LoaderBlock->MemoryDescriptorListHead.Flink;
|
||||||
|
ListEntry != &LoaderBlock->MemoryDescriptorListHead;
|
||||||
|
ListEntry = ListEntry->Flink)
|
||||||
|
{
|
||||||
|
/* Get the descriptor */
|
||||||
|
Descriptor = CONTAINING_RECORD(ListEntry,
|
||||||
|
MEMORY_ALLOCATION_DESCRIPTOR,
|
||||||
|
ListEntry);
|
||||||
|
|
||||||
|
/* Check if this is invisible memory */
|
||||||
|
if ((Descriptor->MemoryType == LoaderFirmwarePermanent) ||
|
||||||
|
(Descriptor->MemoryType == LoaderSpecialMemory) ||
|
||||||
|
(Descriptor->MemoryType == LoaderHALCachedMemory) ||
|
||||||
|
(Descriptor->MemoryType == LoaderBBTMemory))
|
||||||
|
{
|
||||||
|
/* Skip this descriptor */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if this is bad memory */
|
||||||
|
if (Descriptor->MemoryType != LoaderBad)
|
||||||
|
{
|
||||||
|
/* Count this in the total of pages */
|
||||||
|
NumberOfPhysicalPages += Descriptor->PageCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024;
|
||||||
|
}
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -80,6 +132,7 @@ KdInitSystem(IN ULONG BootPhase,
|
||||||
PLIST_ENTRY NextEntry;
|
PLIST_ENTRY NextEntry;
|
||||||
ULONG i, j, Length;
|
ULONG i, j, Length;
|
||||||
SIZE_T DebugOptionLength;
|
SIZE_T DebugOptionLength;
|
||||||
|
SIZE_T MemSizeMBs;
|
||||||
CHAR NameBuffer[256];
|
CHAR NameBuffer[256];
|
||||||
PWCHAR Name;
|
PWCHAR Name;
|
||||||
|
|
||||||
|
@ -321,6 +374,20 @@ KdInitSystem(IN ULONG BootPhase,
|
||||||
/* Let user-mode know that it's enabled as well */
|
/* Let user-mode know that it's enabled as well */
|
||||||
SharedUserData->KdDebuggerEnabled = TRUE;
|
SharedUserData->KdDebuggerEnabled = TRUE;
|
||||||
|
|
||||||
|
/* Display separator + ReactOS version at start of the debug log */
|
||||||
|
DPRINT1("-----------------------------------------------------\n");
|
||||||
|
DPRINT1("ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n");
|
||||||
|
MemSizeMBs = KdpGetMemorySizeInMBs(KeLoaderBlock);
|
||||||
|
DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs);
|
||||||
|
if (KeLoaderBlock)
|
||||||
|
{
|
||||||
|
DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions);
|
||||||
|
DPRINT1("ARC Paths: %s %s %s %s\n", KeLoaderBlock->ArcBootDeviceName,
|
||||||
|
KeLoaderBlock->NtHalPathName,
|
||||||
|
KeLoaderBlock->ArcHalDeviceName,
|
||||||
|
KeLoaderBlock->NtBootPathName);
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if the debugger should be disabled initially */
|
/* Check if the debugger should be disabled initially */
|
||||||
if (DisableKdAfterInit)
|
if (DisableKdAfterInit)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue