Accept /DEBUGPORT=GDB and /DEBUGPORT=PICE on command line.

Break into debugger on KeBugCheckEx() if available.
Fixed typo in readme.txt.

svn path=/trunk/; revision=2613
This commit is contained in:
Casper Hornstrup 2002-02-09 18:41:24 +00:00
parent effa2fbabb
commit 430a416722
8 changed files with 104 additions and 68 deletions

View file

@ -15,7 +15,7 @@ http://pice.sourceforge.net).
Installation and use: Installation and use:
1. PICE is loaded like a regular device driver. The only limitation - it must 1. PICE is loaded like a regular device driver. The only limitation - it must
be loaded before keyboard.sys driver. You should add: be loaded after keyboard.sys driver. You should add:
LdrLoadAutoConfigDriver( L"pice.sys" ); LdrLoadAutoConfigDriver( L"pice.sys" );
@ -95,11 +95,10 @@ phys show all mappings for linear address
timers show all active timers timers show all active timers
TODO: TODO:
1. Break into pice on KeBugCheck(). 1. Evaluation of pointers.
2. Evaluation of pointers. 2. Virtual breakpoints
3. Virtual breakpoints 3. Unimplemented commands.
4. Unimplemented commands. 4. Video mode switching (to debug gdi applications).
5. Video mode switching (to debug gdi applications).
Enjoy, Enjoy,

View file

@ -11,6 +11,7 @@ echo Installing to %ROS_INSTALL%
md %ROS_INSTALL% md %ROS_INSTALL%
md %ROS_INSTALL%\bin md %ROS_INSTALL%\bin
md %ROS_INSTALL%\symbols
md %ROS_INSTALL%\system32 md %ROS_INSTALL%\system32
md %ROS_INSTALL%\system32\config md %ROS_INSTALL%\system32\config
md %ROS_INSTALL%\system32\drivers md %ROS_INSTALL%\system32\drivers
@ -21,6 +22,7 @@ copy aboot.bat %ROS_INSTALL%
copy system.hiv %ROS_INSTALL%\system32\config copy system.hiv %ROS_INSTALL%\system32\config
copy loaders\dos\loadros.com %ROS_INSTALL% copy loaders\dos\loadros.com %ROS_INSTALL%
copy ntoskrnl\ntoskrnl.exe %ROS_INSTALL%\system32 copy ntoskrnl\ntoskrnl.exe %ROS_INSTALL%\system32
copy ntoskrnl\ntoskrnl.sym %ROS_INSTALL%\symbols
copy hal\halx86\hal.dll %ROS_INSTALL%\system32 copy hal\halx86\hal.dll %ROS_INSTALL%\system32
copy services\fs\vfat\vfatfs.sys %ROS_INSTALL%\system32\drivers copy services\fs\vfat\vfatfs.sys %ROS_INSTALL%\system32\drivers
copy services\fs\ms\msfs.sys %ROS_INSTALL%\system32\drivers copy services\fs\ms\msfs.sys %ROS_INSTALL%\system32\drivers
@ -87,6 +89,9 @@ copy apps\partinfo\partinfo.exe %ROS_INSTALL%\bin
copy apps\objdir\objdir.exe %ROS_INSTALL%\bin copy apps\objdir\objdir.exe %ROS_INSTALL%\bin
copy apps\mutex\mutex.exe %ROS_INSTALL%\bin copy apps\mutex\mutex.exe %ROS_INSTALL%\bin
copy apps\winhello\winhello.exe %ROS_INSTALL%\bin copy apps\winhello\winhello.exe %ROS_INSTALL%\bin
copy apps\pice\module\pice.sys %ROS_INSTALL%\system32\drivers
copy apps\pice\module\pice.sym %ROS_INSTALL%\symbols
copy apps\pice\pice.cfg %ROS_INSTALL%\symbols
copy media\fonts\helb____.ttf %ROS_INSTALL%\media\fonts copy media\fonts\helb____.ttf %ROS_INSTALL%\media\fonts
copy media\fonts\timr____.ttf %ROS_INSTALL%\media\fonts copy media\fonts\timr____.ttf %ROS_INSTALL%\media\fonts
copy media\nls\*.nls %ROS_INSTALL%\system32 copy media\nls\*.nls %ROS_INSTALL%\system32

View file

@ -1,4 +1,4 @@
/* $Id: kd.h,v 1.5 2002/02/02 20:12:45 ekohl Exp $ /* $Id: kd.h,v 1.6 2002/02/09 18:41:23 chorns Exp $
* *
* kernel debugger prototypes * kernel debugger prototypes
*/ */
@ -8,6 +8,19 @@
#include <internal/ke.h> #include <internal/ke.h>
typedef enum
{
NoDebug = 0,
GdbDebug,
PiceDebug,
ScreenDebug,
SerialDebug,
BochsDebug,
FileLogDebug
} DEBUG_TYPE;
extern DEBUG_TYPE KdDebugType;
typedef enum _KD_CONTINUE_TYPE typedef enum _KD_CONTINUE_TYPE
{ {
kdContinue = 0, kdContinue = 0,

View file

@ -1278,6 +1278,8 @@ KdGdbStubInit(ULONG Phase)
} }
KdPortEnableInterrupts(); KdPortEnableInterrupts();
DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C);
} }
} }

View file

@ -1,4 +1,4 @@
/* $Id: kdebug.c,v 1.33 2002/02/08 02:57:06 chorns Exp $ /* $Id: kdebug.c,v 1.34 2002/02/09 18:41:24 chorns Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -25,18 +25,6 @@
/* bochs debug output */ /* bochs debug output */
#define BOCHS_LOGGER_PORT (0xe9) #define BOCHS_LOGGER_PORT (0xe9)
/* TYPEDEFS ****************************************************************/
typedef enum
{
NoDebug,
ScreenDebug,
SerialDebug,
BochsDebug,
FileLogDebug
} DEBUG_TYPE;
/* VARIABLES ***************************************************************/ /* VARIABLES ***************************************************************/
BOOLEAN BOOLEAN
@ -49,8 +37,7 @@ KdDebuggerNotPresent = TRUE; /* EXPORTED */
static BOOLEAN KdpBreakPending = FALSE; static BOOLEAN KdpBreakPending = FALSE;
static BOOLEAN KdpLogOnly = TRUE; DEBUG_TYPE KdDebugType = NoDebug;
static DEBUG_TYPE KdpDebugType = NoDebug;
ULONG KdpPortIrq = 0; ULONG KdpPortIrq = 0;
/* PRIVATE FUNCTIONS ********************************************************/ /* PRIVATE FUNCTIONS ********************************************************/
@ -104,13 +91,25 @@ KdInitSystem(ULONG Reserved,
{ {
p2 += 6; p2 += 6;
KdDebuggerEnabled = TRUE; KdDebuggerEnabled = TRUE;
KdpDebugType = ScreenDebug; KdDebugType = ScreenDebug;
} }
else if (!_strnicmp(p2, "BOCHS", 5)) else if (!_strnicmp(p2, "BOCHS", 5))
{ {
p2 += 5; p2 += 5;
KdDebuggerEnabled = TRUE; KdDebuggerEnabled = TRUE;
KdpDebugType = BochsDebug; KdDebugType = BochsDebug;
}
else if (!_strnicmp(p2, "GDB", 3))
{
p2 += 3;
KdDebuggerEnabled = TRUE;
KdDebugType = GdbDebug;
}
else if (!_strnicmp(p2, "PICE", 4))
{
p2 += 4;
KdDebuggerEnabled = TRUE;
KdDebugType = PiceDebug;
} }
else if (!_strnicmp(p2, "COM", 3)) else if (!_strnicmp(p2, "COM", 3))
{ {
@ -118,8 +117,9 @@ KdInitSystem(ULONG Reserved,
Value = (ULONG)atol(p2); Value = (ULONG)atol(p2);
if (Value > 0 && Value < 5) if (Value > 0 && Value < 5)
{ {
PrintString("\n COM2 found\n\n");
KdDebuggerEnabled = TRUE; KdDebuggerEnabled = TRUE;
KdpDebugType = SerialDebug; KdDebugType = SerialDebug;
PortInfo.ComPort = Value; PortInfo.ComPort = Value;
} }
} }
@ -127,31 +127,35 @@ KdInitSystem(ULONG Reserved,
{ {
p2 += 4; p2 += 4;
KdDebuggerEnabled = TRUE; KdDebuggerEnabled = TRUE;
KdpDebugType = FileLogDebug; KdDebugType = FileLogDebug;
} }
} }
} }
else if (!_strnicmp(p2, "DEBUG", 5)) else if (!_strnicmp(p2, "DEBUG", 5))
{ {
p2 += 5; p2 += 5;
KdDebuggerEnabled = TRUE; /* Check that KdDebugType equals NoDebug so we don't override any set KdDebugType */
KdpDebugType = SerialDebug; if (KdDebugType == NoDebug)
{
KdDebuggerEnabled = TRUE;
KdDebugType = SerialDebug;
}
} }
else if (!_strnicmp(p2, "NODEBUG", 7)) else if (!_strnicmp(p2, "NODEBUG", 7))
{ {
p2 += 7; p2 += 7;
KdDebuggerEnabled = FALSE; KdDebuggerEnabled = FALSE;
KdpDebugType = NoDebug; KdDebugType = NoDebug;
} }
else if (!_strnicmp(p2, "CRASHDEBUG", 10)) else if (!_strnicmp(p2, "CRASHDEBUG", 10))
{ {
p2 += 10; p2 += 10;
KdDebuggerEnabled = FALSE; KdDebuggerEnabled = FALSE;
KdpDebugType = NoDebug; KdDebugType = NoDebug;
} }
else if (!_strnicmp(p2, "BREAK", 5)) else if (!_strnicmp(p2, "BREAK", 5))
{ {
p2 += 7; p2 += 5;
KdpBreakPending = TRUE; KdpBreakPending = TRUE;
} }
else if (!_strnicmp(p2, "BAUDRATE", 8)) else if (!_strnicmp(p2, "BAUDRATE", 8))
@ -164,7 +168,7 @@ KdInitSystem(ULONG Reserved,
if (Value > 0) if (Value > 0)
{ {
KdDebuggerEnabled = TRUE; KdDebuggerEnabled = TRUE;
KdpDebugType = SerialDebug; KdDebugType = SerialDebug;
PortInfo.BaudRate = Value; PortInfo.BaudRate = Value;
} }
} }
@ -178,28 +182,31 @@ KdInitSystem(ULONG Reserved,
if (Value > 0) if (Value > 0)
{ {
KdDebuggerEnabled = TRUE; KdDebuggerEnabled = TRUE;
KdpDebugType = SerialDebug; KdDebugType = SerialDebug;
KdpPortIrq = Value; KdpPortIrq = Value;
} }
} }
} }
} }
else if (!_strnicmp(p2, "GDB", 3))
{
p2 += 3;
KdpLogOnly = FALSE;
}
p1 = p2; p1 = p2;
} }
/* print some information */ /* print some information */
if (KdDebuggerEnabled == TRUE) if (KdDebuggerEnabled == TRUE)
{ {
switch (KdpDebugType) switch (KdDebugType)
{ {
case NoDebug: case NoDebug:
break; break;
case GdbDebug:
PrintString("\n GDB debugging enabled\n\n");
break;
case PiceDebug:
PrintString("\n Private ICE debugger enabled\n\n");
break;
case ScreenDebug: case ScreenDebug:
//PrintString("\n Screen debugging enabled\n\n"); //PrintString("\n Screen debugging enabled\n\n");
break; break;
@ -222,9 +229,10 @@ KdInitSystem(ULONG Reserved,
/* initialize debug port */ /* initialize debug port */
if (KdDebuggerEnabled == TRUE) if (KdDebuggerEnabled == TRUE)
{ {
switch (KdpDebugType) switch (KdDebugType)
{ {
case SerialDebug: case SerialDebug:
case GdbDebug:
KdPortInitialize(&PortInfo, KdPortInitialize(&PortInfo,
0, 0,
0); 0);
@ -246,8 +254,7 @@ KdInit1(VOID)
{ {
/* Initialize kernel debugger */ /* Initialize kernel debugger */
if (KdDebuggerEnabled == TRUE && if (KdDebuggerEnabled == TRUE &&
KdpDebugType == SerialDebug && KdDebugType == GdbDebug)
KdpLogOnly == FALSE)
{ {
KdGdbStubInit(0); KdGdbStubInit(0);
} }
@ -257,8 +264,7 @@ KdInit1(VOID)
VOID KdInit2(VOID) VOID KdInit2(VOID)
{ {
if (KdDebuggerEnabled == TRUE && if (KdDebuggerEnabled == TRUE &&
KdpDebugType == SerialDebug && KdDebugType == GdbDebug)
KdpLogOnly == FALSE)
{ {
KdGdbStubInit(1); KdGdbStubInit(1);
} }
@ -285,20 +291,24 @@ KdpPrintString(PANSI_STRING String)
{ {
PCH pch = String->Buffer; PCH pch = String->Buffer;
switch (KdpDebugType) switch (KdDebugType)
{ {
case NoDebug: case NoDebug:
break; break;
case GdbDebug:
KdGdbDebugPrint(pch);
break;
case PiceDebug:
break;
case ScreenDebug: case ScreenDebug:
HalDisplayString(pch); HalDisplayString(pch);
break; break;
case SerialDebug: case SerialDebug:
if (KdpLogOnly == TRUE)
KdDebugPrint(pch); KdDebugPrint(pch);
else
KdGdbDebugPrint(pch);
break; break;
case BochsDebug: case BochsDebug:
@ -328,13 +338,9 @@ KdpPrintString(PANSI_STRING String)
BOOLEAN STDCALL BOOLEAN STDCALL
KdPollBreakIn(VOID) KdPollBreakIn(VOID)
{ {
return FALSE; if ((!KdDebuggerEnabled) || (KdDebugType != SerialDebug))
#if 0
if (!KdDebuggerEnabled || KdpDebugType != SerialDebug)
return FALSE; return FALSE;
return TRUE; return KdpBreakPending;
#endif
} }
VOID STDCALL VOID STDCALL

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: bug.c,v 1.19 2002/01/10 00:59:32 ekohl Exp $ /* $Id: bug.c,v 1.20 2002/02/09 18:41:24 chorns Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/bug.c * FILE: ntoskrnl/ke/bug.c
@ -140,15 +140,17 @@ KeBugCheckEx(ULONG BugCheckCode,
// PsDumpThreads(); // PsDumpThreads();
KeDumpStackFrames((PULONG)__builtin_frame_address(0)); KeDumpStackFrames((PULONG)__builtin_frame_address(0));
#if 1 if (KdDebuggerEnabled)
{
__asm__("sti\n\t");
DbgBreakPoint();
}
for(;;) for(;;)
{ {
/* PJS: use HLT instruction, rather than busy wait */ /* PJS: use HLT instruction, rather than busy wait */
__asm__("hlt\n\t"); __asm__("hlt\n\t");
} }
#else
for(;;);
#endif
} }
VOID STDCALL VOID STDCALL

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: catch.c,v 1.17 2002/01/23 23:39:25 chorns Exp $ /* $Id: catch.c,v 1.18 2002/02/09 18:41:24 chorns Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/catch.c * FILE: ntoskrnl/ke/catch.c
@ -271,11 +271,10 @@ KiDispatchException(PEXCEPTION_RECORD ExceptionRecord,
/* PreviousMode == KernelMode */ /* PreviousMode == KernelMode */
#ifndef KDBG if (!KdDebuggerEnabled || KdDebugType != GdbDebug)
{
KeBugCheck (KMODE_EXCEPTION_NOT_HANDLED); KeBugCheck (KMODE_EXCEPTION_NOT_HANDLED);
}
#endif /* KDBG */
Action = KdEnterDebuggerException (ExceptionRecord, Context, Tf); Action = KdEnterDebuggerException (ExceptionRecord, Context, Tf);
if (Action != kdHandleException) if (Action != kdHandleException)

View file

@ -1,4 +1,4 @@
/* $Id: loader.c,v 1.95 2002/01/23 23:39:25 chorns Exp $ /* $Id: loader.c,v 1.96 2002/02/09 18:41:24 chorns Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -28,6 +28,7 @@
#include <roscfg.h> #include <roscfg.h>
#include <internal/module.h> #include <internal/module.h>
#include <internal/ntoskrnl.h> #include <internal/ntoskrnl.h>
#include <internal/kd.h>
#include <internal/io.h> #include <internal/io.h>
#include <internal/mm.h> #include <internal/mm.h>
#include <internal/ob.h> #include <internal/ob.h>
@ -792,7 +793,7 @@ VOID LdrLoadUserModuleSymbols(PLDR_MODULE ModuleObject)
return; return;
} }
DbgPrint("Loading symbols from %wZ...\n", &Filename); CPRINT("Loading symbols from %wZ...\n", &Filename);
/* Get the size of the file */ /* Get the size of the file */
Status = ZwQueryInformationFile(FileHandle, Status = ZwQueryInformationFile(FileHandle,
@ -917,6 +918,14 @@ VOID LdrLoadAutoConfigDrivers (VOID)
*/ */
LdrLoadAutoConfigDriver( L"keyboard.sys" ); LdrLoadAutoConfigDriver( L"keyboard.sys" );
if (KdDebugType == PiceDebug)
{
/*
* Private ICE debugger
*/
LdrLoadAutoConfigDriver( L"pice.sys" );
}
/* /*
* Raw console driver * Raw console driver
*/ */
@ -967,6 +976,7 @@ VOID LdrLoadAutoConfigDrivers (VOID)
* Novell Eagle 2000 driver * Novell Eagle 2000 driver
*/ */
//LdrLoadAutoConfigDriver(L"ne2000.sys"); //LdrLoadAutoConfigDriver(L"ne2000.sys");
LdrLoadAutoConfigDriver(L"pcntn3m.sys");
/* /*
* TCP/IP protocol driver * TCP/IP protocol driver
@ -2007,7 +2017,7 @@ PVOID LdrSafePEProcessModule(
} }
else if (Type != 0) else if (Type != 0)
{ {
DbgPrint("Unknown relocation type %x at %x\n",Type, &Type); CPRINT("Unknown relocation type %x at %x\n",Type, &Type);
return 0; return 0;
} }
} }