[NTOSKRNL]

- Do not repeat messages into serial port even when using other debug methods.
- Allow to specify debug log file name.
- When using the "Screen" method, show blue screen when entering KDB.
- Disable the repetition of previous KDB command with long many-page output.

[USETUP]
- Add "ReactOS (Screen)" entry to boot menu.

svn path=/trunk/; revision=54468
This commit is contained in:
Dmitry Gorbachev 2011-11-21 05:28:08 +00:00
parent 34f3db310e
commit b7f9a4b528
9 changed files with 153 additions and 97 deletions

View file

@ -486,6 +486,12 @@ CreateFreeLoaderIniForReactos(
L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /KDSERIAL"); L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /KDSERIAL");
#endif #endif
/* ReactOS_Screen */
CreateFreeLoaderEntry(IniCache, IniSection,
L"ReactOS_Screen", L"\"ReactOS (Screen)\"",
L"Windows2003", ArcPath,
L"/DEBUG /DEBUGPORT=SCREEN /SOS");
/* ReactOS_LogFile */ /* ReactOS_LogFile */
CreateFreeLoaderEntry(IniCache, IniSection, CreateFreeLoaderEntry(IniCache, IniSection,
L"ReactOS_LogFile", L"\"ReactOS (Log file)\"", L"ReactOS_LogFile", L"\"ReactOS (Log file)\"",

View file

@ -1,4 +1,3 @@
[autorun] [autorun]
open=reactos\welcome.exe open=reactos\welcome.exe
icon=icon.ico icon=icon.ico

View file

@ -1,6 +1,6 @@
[FREELOADER] [FREELOADER]
DefaultOS=Setup DefaultOS=Setup
Timeout=0 TimeOut=0
[Display] [Display]
TitleText=ReactOS Setup TitleText=ReactOS Setup
@ -29,4 +29,3 @@ Setup="Setup"
[Setup] [Setup]
BootType=ReactOSSetup BootType=ReactOSSetup

View file

@ -1,9 +1,9 @@
[FREELOADER] [FREELOADER]
DefaultOS=ReactOS DefaultOS=LiveCD_Debug
Timeout=1 TimeOut=3
[Display] [Display]
TitleText=ReactOS Boot Manager TitleText=ReactOS LiveCD
StatusBarColor=Cyan StatusBarColor=Cyan
StatusBarTextColor=Black StatusBarTextColor=Black
BackdropTextColor=White BackdropTextColor=White
@ -13,16 +13,39 @@ TitleBoxTextColor=White
TitleBoxColor=Red TitleBoxColor=Red
MessageBoxTextColor=White MessageBoxTextColor=White
MessageBoxColor=Blue MessageBoxColor=Blue
MenuTextColor=White MenuTextColor=Gray
MenuColor=Blue MenuColor=Black
TextColor=Yellow TextColor=Gray
SelectedTextColor=Black SelectedTextColor=Black
SelectedColor=Gray SelectedColor=Gray
ShowTime=No
MenuBox=No
CenterMenu=No
MinimalUI=Yes
TimeText=Seconds until highlighted choice will be started automatically:
[Operating Systems] [Operating Systems]
ReactOS="ReactOS" LiveCD="LiveCD"
LiveCD_Debug="LiveCD (Debug)"
LiveCD_Screen="LiveCD (Screen)"
LiveCD_LogFile="LiveCD (Log file)"
[ReactOS] [LiveCD]
BootType=Windows2003 BootType=Windows2003
SystemPath=LiveCD\reactos SystemPath=LiveCD\reactos
Options=/DEBUGPORT=COM1 /SOS /MININT Options=/MININT
[LiveCD_Debug]
BootType=Windows2003
SystemPath=LiveCD\reactos
Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT
[LiveCD_Screen]
BootType=Windows2003
SystemPath=LiveCD\reactos
Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT
[LiveCD_LogFile]
BootType=Windows2003
SystemPath=LiveCD\reactos
Options=/DEBUG /DEBUGPORT=FILE:\Device\HarddiskX\PartitionY\debug.log /SOS /MININT

View file

@ -1,12 +1,11 @@
# Example KDB.init file # Example KDB.init file
# #
#
# Set the disassembly flavor to "intel" (default is "at&t") # Set the disassembly flavor to "intel" (default is "at&t")
set syntax intel set syntax intel
# Change the condition to enter KDB on INT3 to "always" (default is "kmode") # Change the condition to enter KDB on INT3 to "always" (default is "kmode")
# set condition INT3 first always #set condition INT3 first always
# This is a special command available only in the KDBinit file - it breaks into # This is a special command available only in the KDBinit file - it breaks into
# KDB when it is interpreting the init file at startup. # KDB when it is interpreting the init file at startup.

View file

@ -40,6 +40,8 @@ PKDP_INIT_ROUTINE InitRoutines[KdMax] = {KdpScreenInit,
KdpBochsInit, KdpBochsInit,
KdpKdbgInit}; KdpKdbgInit};
extern ANSI_STRING KdpLogFileName;
/* PRIVATE FUNCTIONS *********************************************************/ /* PRIVATE FUNCTIONS *********************************************************/
PCHAR PCHAR
@ -47,7 +49,7 @@ NTAPI
INIT_FUNCTION INIT_FUNCTION
KdpGetDebugMode(PCHAR Currentp2) KdpGetDebugMode(PCHAR Currentp2)
{ {
PCHAR p2 = Currentp2; PCHAR p1, p2 = Currentp2;
ULONG Value; ULONG Value;
/* Check for Screen Debugging */ /* Check for Screen Debugging */
@ -73,12 +75,21 @@ KdpGetDebugMode(PCHAR Currentp2)
KdpPort = Value; KdpPort = Value;
} }
} }
/* Check for Debug Log Debugging */ /* Check for Debug Log Debugging */
else if (!_strnicmp(p2, "FILE", 4)) else if (!_strnicmp(p2, "FILE", 4))
{ {
/* Enable It */ /* Enable It */
p2 += 4; p2 += 4;
KdpDebugMode.File = TRUE; KdpDebugMode.File = TRUE;
if (*p2 == ':')
{
p2++;
p1 = p2;
while (*p2 != '\0' && *p2 != ' ') p2++;
KdpLogFileName.MaximumLength = KdpLogFileName.Length = p2 - p1;
KdpLogFileName.Buffer = p1;
}
} }
/* Check for BOCHS Debugging */ /* Check for BOCHS Debugging */
@ -171,11 +182,9 @@ KdInitSystem(ULONG BootPhase,
else if (strstr(CommandLine, "CRASHDEBUG")) KdDebuggerEnabled = FALSE; else if (strstr(CommandLine, "CRASHDEBUG")) KdDebuggerEnabled = FALSE;
else if (strstr(CommandLine, "DEBUG")) else if (strstr(CommandLine, "DEBUG"))
{ {
/* Enable on the serial port */ /* Enable the kernel debugger */
KdDebuggerEnabled = TRUE; KdDebuggerEnabled = TRUE;
KdDebuggerNotPresent = FALSE; KdDebuggerNotPresent = FALSE;
KdpDebugMode.Serial = TRUE;
#ifdef KDBG #ifdef KDBG
/* Get the KDBG Settings */ /* Get the KDBG Settings */
KdbpGetCommandLineSettings(LoaderBlock->LoadOptions); KdbpGetCommandLineSettings(LoaderBlock->LoadOptions);
@ -202,6 +211,10 @@ KdInitSystem(ULONG BootPhase,
Port = strstr(Port, "DEBUGPORT"); Port = strstr(Port, "DEBUGPORT");
} }
/* Use serial port then */
if (KdDebuggerEnabled && KdpDebugMode.Value == 0)
KdpDebugMode.Serial = TRUE;
/* Check if we got a baud rate */ /* Check if we got a baud rate */
if (BaudRate) if (BaudRate)
{ {

View file

@ -23,6 +23,7 @@ volatile ULONG KdpFreeBytes = 0;
KSPIN_LOCK KdpDebugLogSpinLock; KSPIN_LOCK KdpDebugLogSpinLock;
KEVENT KdpLoggerThreadEvent; KEVENT KdpLoggerThreadEvent;
HANDLE KdpLogFileHandle; HANDLE KdpLogFileHandle;
ANSI_STRING KdpLogFileName = RTL_CONSTANT_STRING("\\SystemRoot\\debug.log");
KSPIN_LOCK KdpSerialSpinLock; KSPIN_LOCK KdpSerialSpinLock;
KD_PORT_INFORMATION SerialPortInfo = { DEFAULT_DEBUG_PORT, DEFAULT_DEBUG_BAUD_RATE, 0 }; KD_PORT_INFORMATION SerialPortInfo = { DEFAULT_DEBUG_PORT, DEFAULT_DEBUG_BAUD_RATE, 0 };
@ -201,7 +202,9 @@ KdpInitDebugLog(PKD_DISPATCH_TABLE DispatchTable,
else if (BootPhase == 3) else if (BootPhase == 3)
{ {
/* Setup the log name */ /* Setup the log name */
RtlInitUnicodeString(&FileName, L"\\SystemRoot\\debug.log"); Status = RtlAnsiStringToUnicodeString(&FileName, &KdpLogFileName, TRUE);
if (!NT_SUCCESS(Status)) return;
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&FileName, &FileName,
0, 0,
@ -221,6 +224,8 @@ KdpInitDebugLog(PKD_DISPATCH_TABLE DispatchTable,
NULL, NULL,
0); 0);
RtlFreeUnicodeString(&FileName);
if (!NT_SUCCESS(Status)) return; if (!NT_SUCCESS(Status)) return;
KeInitializeEvent(&KdpLoggerThreadEvent, SynchronizationEvent, TRUE); KeInitializeEvent(&KdpLoggerThreadEvent, SynchronizationEvent, TRUE);

View file

@ -127,12 +127,6 @@ KiEspToTrapFrame(
IN PKTRAP_FRAME TrapFrame, IN PKTRAP_FRAME TrapFrame,
IN ULONG Esp); IN ULONG Esp);
/* ROS Internal. Please deprecate */
NTHALAPI
VOID
NTAPI
HalReleaseDisplayOwnership();
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
static VOID static VOID
@ -1247,9 +1241,21 @@ KdbpInternalEnter()
ULONG SavedStackLimit; ULONG SavedStackLimit;
KbdDisableMouse(); KbdDisableMouse();
if (KdpDebugMode.Screen)
if (KdpDebugMode.Screen &&
InbvIsBootDriverInstalled() &&
!InbvCheckDisplayOwnership())
{ {
/* Acquire ownership and reset the display */
InbvAcquireDisplayOwnership(); InbvAcquireDisplayOwnership();
InbvResetDisplay();
/* Display blue screen */
InbvSolidColorFill(0, 0, 639, 479, 6);
InbvSetTextColor(15);
InbvInstallDisplayStringFilter(NULL);
InbvEnableDisplayString(TRUE);
InbvSetScrollRegion(0, 0, 639, 479);
} }
/* Call the interface's main loop on a different stack */ /* Call the interface's main loop on a different stack */

View file

@ -107,6 +107,7 @@ static LONG KdbCommandHistoryIndex = 0;
static ULONG KdbNumberOfRowsPrinted = 0; static ULONG KdbNumberOfRowsPrinted = 0;
static ULONG KdbNumberOfColsPrinted = 0; static ULONG KdbNumberOfColsPrinted = 0;
static BOOLEAN KdbOutputAborted = FALSE; static BOOLEAN KdbOutputAborted = FALSE;
static BOOLEAN KdbRepeatLastCommand = FALSE;
static LONG KdbNumberOfRowsTerminal = -1; static LONG KdbNumberOfRowsTerminal = -1;
static LONG KdbNumberOfColsTerminal = -1; static LONG KdbNumberOfColsTerminal = -1;
@ -2469,6 +2470,8 @@ KdbpPrint(
if (KdbNumberOfRowsTerminal > 0 && if (KdbNumberOfRowsTerminal > 0 &&
(LONG)(KdbNumberOfRowsPrinted + RowsPrintedByTerminal) >= KdbNumberOfRowsTerminal) (LONG)(KdbNumberOfRowsPrinted + RowsPrintedByTerminal) >= KdbNumberOfRowsTerminal)
{ {
KdbRepeatLastCommand = FALSE;
if (KdbNumberOfColsPrinted > 0) if (KdbNumberOfColsPrinted > 0)
DbgPrint("\n"); DbgPrint("\n");
@ -2789,6 +2792,8 @@ KdbpPager(
if (KdbNumberOfRowsTerminal > 0 && if (KdbNumberOfRowsTerminal > 0 &&
(LONG)(KdbNumberOfRowsPrinted + RowsPrintedByTerminal) >= KdbNumberOfRowsTerminal) (LONG)(KdbNumberOfRowsPrinted + RowsPrintedByTerminal) >= KdbNumberOfRowsTerminal)
{ {
KdbRepeatLastCommand = FALSE;
if (KdbNumberOfColsPrinted > 0) if (KdbNumberOfColsPrinted > 0)
DbgPrint("\n"); DbgPrint("\n");
@ -2987,7 +2992,7 @@ KdbpReadCommand(
PCHAR Orig = Buffer; PCHAR Orig = Buffer;
ULONG ScanCode = 0; ULONG ScanCode = 0;
BOOLEAN EchoOn; BOOLEAN EchoOn;
static CHAR LastCommand[1024] = ""; static CHAR LastCommand[1024];
static CHAR NextKey = '\0'; static CHAR NextKey = '\0';
INT CmdHistIndex = -1; INT CmdHistIndex = -1;
INT i; INT i;
@ -3059,15 +3064,16 @@ KdbpReadCommand(
* Repeat the last command if the user presses enter. Reduces the * Repeat the last command if the user presses enter. Reduces the
* risk of RSI when single-stepping. * risk of RSI when single-stepping.
*/ */
if (Buffer == Orig) if (Buffer != Orig)
{ {
RtlStringCbCopyA(Buffer, Size, LastCommand); KdbRepeatLastCommand = TRUE;
}
else
{
*Buffer = '\0';
RtlStringCbCopyA(LastCommand, sizeof(LastCommand), Orig); RtlStringCbCopyA(LastCommand, sizeof(LastCommand), Orig);
*Buffer = '\0';
} }
else if (KdbRepeatLastCommand)
RtlStringCbCopyA(Buffer, Size, LastCommand);
else
*Buffer = '\0';
return; return;
} }