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:
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" );
@ -95,11 +95,10 @@ phys show all mappings for linear address
timers show all active timers
TODO:
1. Break into pice on KeBugCheck().
2. Evaluation of pointers.
3. Virtual breakpoints
4. Unimplemented commands.
5. Video mode switching (to debug gdi applications).
1. Evaluation of pointers.
2. Virtual breakpoints
3. Unimplemented commands.
4. Video mode switching (to debug gdi applications).
Enjoy,

View file

@ -11,6 +11,7 @@ echo Installing to %ROS_INSTALL%
md %ROS_INSTALL%
md %ROS_INSTALL%\bin
md %ROS_INSTALL%\symbols
md %ROS_INSTALL%\system32
md %ROS_INSTALL%\system32\config
md %ROS_INSTALL%\system32\drivers
@ -21,6 +22,7 @@ copy aboot.bat %ROS_INSTALL%
copy system.hiv %ROS_INSTALL%\system32\config
copy loaders\dos\loadros.com %ROS_INSTALL%
copy ntoskrnl\ntoskrnl.exe %ROS_INSTALL%\system32
copy ntoskrnl\ntoskrnl.sym %ROS_INSTALL%\symbols
copy hal\halx86\hal.dll %ROS_INSTALL%\system32
copy services\fs\vfat\vfatfs.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\mutex\mutex.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\timr____.ttf %ROS_INSTALL%\media\fonts
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
*/
@ -8,6 +8,19 @@
#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
{
kdContinue = 0,

View file

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

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* FILE: ntoskrnl/ke/bug.c
@ -140,15 +140,17 @@ KeBugCheckEx(ULONG BugCheckCode,
// PsDumpThreads();
KeDumpStackFrames((PULONG)__builtin_frame_address(0));
#if 1
if (KdDebuggerEnabled)
{
__asm__("sti\n\t");
DbgBreakPoint();
}
for(;;)
{
/* PJS: use HLT instruction, rather than busy wait */
__asm__("hlt\n\t");
}
#else
for(;;);
#endif
}
VOID STDCALL

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* FILE: ntoskrnl/ke/catch.c
@ -271,11 +271,10 @@ KiDispatchException(PEXCEPTION_RECORD ExceptionRecord,
/* PreviousMode == KernelMode */
#ifndef KDBG
KeBugCheck (KMODE_EXCEPTION_NOT_HANDLED);
#endif /* KDBG */
if (!KdDebuggerEnabled || KdDebugType != GdbDebug)
{
KeBugCheck (KMODE_EXCEPTION_NOT_HANDLED);
}
Action = KdEnterDebuggerException (ExceptionRecord, Context, Tf);
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
* PROJECT: ReactOS kernel
@ -28,6 +28,7 @@
#include <roscfg.h>
#include <internal/module.h>
#include <internal/ntoskrnl.h>
#include <internal/kd.h>
#include <internal/io.h>
#include <internal/mm.h>
#include <internal/ob.h>
@ -792,7 +793,7 @@ VOID LdrLoadUserModuleSymbols(PLDR_MODULE ModuleObject)
return;
}
DbgPrint("Loading symbols from %wZ...\n", &Filename);
CPRINT("Loading symbols from %wZ...\n", &Filename);
/* Get the size of the file */
Status = ZwQueryInformationFile(FileHandle,
@ -916,6 +917,14 @@ VOID LdrLoadAutoConfigDrivers (VOID)
* Keyboard driver
*/
LdrLoadAutoConfigDriver( L"keyboard.sys" );
if (KdDebugType == PiceDebug)
{
/*
* Private ICE debugger
*/
LdrLoadAutoConfigDriver( L"pice.sys" );
}
/*
* Raw console driver
@ -967,6 +976,7 @@ VOID LdrLoadAutoConfigDrivers (VOID)
* Novell Eagle 2000 driver
*/
//LdrLoadAutoConfigDriver(L"ne2000.sys");
LdrLoadAutoConfigDriver(L"pcntn3m.sys");
/*
* TCP/IP protocol driver
@ -2007,7 +2017,7 @@ PVOID LdrSafePEProcessModule(
}
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;
}
}