Fix GDB stub:

- Initialize WrapperTable routines as early as possible
- Initialize debug port (hard coded to COM2, 115200 baud for now)
- Don't limit runnable thread on startup

svn path=/trunk/; revision=14977
This commit is contained in:
Gé van Geldorp 2005-05-04 20:38:43 +00:00
parent 68b564e30a
commit 600cfcc505

View file

@ -107,7 +107,7 @@ static PETHREAD GspDbgThread;
static PETHREAD GspEnumThread; static PETHREAD GspEnumThread;
extern LIST_ENTRY PsActiveProcessHead; extern LIST_ENTRY PsActiveProcessHead;
KD_PORT_INFORMATION GdbPortInfo; KD_PORT_INFORMATION GdbPortInfo = { 2, 115200, 0 }; /* FIXME hardcoded for COM2, 115200 baud */
/* Number of Registers. */ /* Number of Registers. */
#define NUMREGS 16 #define NUMREGS 16
@ -718,10 +718,15 @@ GspSetThread(PCHAR Request)
GspOutBuffer[0] = 'O'; GspOutBuffer[0] = 'O';
GspOutBuffer[1] = 'K'; GspOutBuffer[1] = 'K';
if(GspRunThread) ObDereferenceObject(GspRunThread); if (NULL != GspRunThread)
{
ObDereferenceObject(GspRunThread);
}
GspRunThread = ThreadInfo; GspRunThread = ThreadInfo;
if (GspRunThread) ObReferenceObject(GspRunThread); if (NULL != GspRunThread)
{
ObReferenceObject(GspRunThread);
}
} }
else else
{ {
@ -1548,6 +1553,10 @@ KdpGdbStubInit(PKD_DISPATCH_TABLE WrapperTable,
if (BootPhase == 0) if (BootPhase == 0)
{ {
/* Write out the functions that we support for now */
WrapperTable->KdpInitRoutine = KdpGdbStubInit;
WrapperTable->KdpPrintRoutine = KdpGdbDebugPrint;
WrapperTable->KdpExceptionRoutine = KdpGdbEnterDebuggerException;
/* Initialize the Port */ /* Initialize the Port */
KdPortInitializeEx(&GdbPortInfo, 0, 0); KdPortInitializeEx(&GdbPortInfo, 0, 0);
@ -1555,18 +1564,11 @@ KdpGdbStubInit(PKD_DISPATCH_TABLE WrapperTable,
else if (BootPhase == 1) else if (BootPhase == 1)
{ {
GspInitialized = TRUE; GspInitialized = TRUE;
GspRunThread = PsGetCurrentThread();
ObReferenceObject(GspRunThread);
GspRunThread = NULL;
GspDbgThread = NULL; GspDbgThread = NULL;
GspEnumThread = NULL; GspEnumThread = NULL;
/* Write out the functions that we support for now */
WrapperTable->KdpInitRoutine = KdpGdbStubInit;
WrapperTable->KdpPrintRoutine = KdpGdbDebugPrint;
WrapperTable->KdpExceptionRoutine = KdpGdbEnterDebuggerException;
HalDisplayString("Waiting for GDB to attach\n"); HalDisplayString("Waiting for GDB to attach\n");
DbgPrint("Module 'hal.dll' loaded at 0x%.08x.\n", LdrHalBase); DbgPrint("Module 'hal.dll' loaded at 0x%.08x.\n", LdrHalBase);
DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C); DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C);