mirror of
https://github.com/reactos/reactos.git
synced 2025-06-09 11:20:39 +00:00
- If KDBG is not compiled in, try to use GDB instead.
- Check WrapperTable.KdpPrintRoutine. - Allow to use GDB (/DEBUGPORT=GDB) and have debug output (/DEBUGPORT=COM1) at the same time. svn path=/trunk/; revision=41534
This commit is contained in:
parent
30a7c1f02f
commit
ae5cb55a9c
3 changed files with 53 additions and 53 deletions
|
@ -42,47 +42,6 @@ PKDP_INIT_ROUTINE InitRoutines[KdMax] = {KdpScreenInit,
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS *********************************************************/
|
/* PRIVATE FUNCTIONS *********************************************************/
|
||||||
|
|
||||||
PCHAR
|
|
||||||
NTAPI
|
|
||||||
KdpGetWrapperDebugMode(PCHAR Currentp2,
|
|
||||||
PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|
||||||
{
|
|
||||||
PCHAR p2 = Currentp2;
|
|
||||||
|
|
||||||
/* Check for GDB Debugging */
|
|
||||||
if (!_strnicmp(p2, "GDB", 3))
|
|
||||||
{
|
|
||||||
/* Enable it */
|
|
||||||
p2 += 3;
|
|
||||||
KdpDebugMode.Gdb = TRUE;
|
|
||||||
|
|
||||||
/* Enable Debugging */
|
|
||||||
KdDebuggerEnabled = TRUE;
|
|
||||||
KdDebuggerNotPresent = FALSE;
|
|
||||||
WrapperInitRoutine = KdpGdbStubInit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for PICE Debugging */
|
|
||||||
else if (!_strnicmp(p2, "PICE", 4))
|
|
||||||
{
|
|
||||||
/* Enable it */
|
|
||||||
p2 += 4;
|
|
||||||
KdpDebugMode.Pice = TRUE;
|
|
||||||
|
|
||||||
/* Enable Debugging */
|
|
||||||
KdDebuggerEnabled = TRUE;
|
|
||||||
KdDebuggerNotPresent = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef KDBG
|
|
||||||
/* Get the KDBG Settings and enable it */
|
|
||||||
KdDebuggerEnabled = TRUE;
|
|
||||||
KdDebuggerNotPresent = FALSE;
|
|
||||||
KdbpGetCommandLineSettings(LoaderBlock->LoadOptions);
|
|
||||||
#endif
|
|
||||||
return p2;
|
|
||||||
}
|
|
||||||
|
|
||||||
PCHAR
|
PCHAR
|
||||||
NTAPI
|
NTAPI
|
||||||
KdpGetDebugMode(PCHAR Currentp2)
|
KdpGetDebugMode(PCHAR Currentp2)
|
||||||
|
@ -129,6 +88,31 @@ KdpGetDebugMode(PCHAR Currentp2)
|
||||||
KdpDebugMode.Bochs = TRUE;
|
KdpDebugMode.Bochs = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check for GDB Debugging */
|
||||||
|
else if (!_strnicmp(p2, "GDB", 3))
|
||||||
|
{
|
||||||
|
/* Enable it */
|
||||||
|
p2 += 3;
|
||||||
|
KdpDebugMode.Gdb = TRUE;
|
||||||
|
|
||||||
|
/* Enable Debugging */
|
||||||
|
KdDebuggerEnabled = TRUE;
|
||||||
|
KdDebuggerNotPresent = FALSE;
|
||||||
|
WrapperInitRoutine = KdpGdbStubInit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for PICE Debugging */
|
||||||
|
else if (!_strnicmp(p2, "PICE", 4))
|
||||||
|
{
|
||||||
|
/* Enable it */
|
||||||
|
p2 += 4;
|
||||||
|
KdpDebugMode.Pice = TRUE;
|
||||||
|
|
||||||
|
/* Enable Debugging */
|
||||||
|
KdDebuggerEnabled = TRUE;
|
||||||
|
KdDebuggerNotPresent = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return p2;
|
return p2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +163,7 @@ KdInitSystem(ULONG BootPhase,
|
||||||
/* Upcase it */
|
/* Upcase it */
|
||||||
_strupr(CommandLine);
|
_strupr(CommandLine);
|
||||||
|
|
||||||
/* Check for settings that we support */
|
/* XXX Check for settings that we support */
|
||||||
if (strstr(CommandLine, "BREAK")) KdpEarlyBreak = TRUE;
|
if (strstr(CommandLine, "BREAK")) KdpEarlyBreak = TRUE;
|
||||||
if (strstr(CommandLine, "NODEBUG")) KdDebuggerEnabled = FALSE;
|
if (strstr(CommandLine, "NODEBUG")) KdDebuggerEnabled = FALSE;
|
||||||
if (strstr(CommandLine, "CRASHDEBUG")) KdDebuggerEnabled = FALSE;
|
if (strstr(CommandLine, "CRASHDEBUG")) KdDebuggerEnabled = FALSE;
|
||||||
|
@ -190,16 +174,23 @@ KdInitSystem(ULONG BootPhase,
|
||||||
KdpDebugMode.Serial = TRUE;
|
KdpDebugMode.Serial = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef KDBG
|
||||||
|
/* Get the KDBG Settings and enable it */
|
||||||
|
KdDebuggerEnabled = TRUE;
|
||||||
|
KdDebuggerNotPresent = FALSE;
|
||||||
|
KdbpGetCommandLineSettings(LoaderBlock->LoadOptions);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* 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");
|
||||||
Irq = strstr(CommandLine, "IRQ");
|
Irq = strstr(CommandLine, "IRQ");
|
||||||
|
|
||||||
/* Check if we got the /DEBUGPORT parameter */
|
/* Check if we got the /DEBUGPORT parameter(s) */
|
||||||
if (Port)
|
while (Port)
|
||||||
{
|
{
|
||||||
/* Move past the actual string, to reach the port*/
|
/* Move past the actual string, to reach the port*/
|
||||||
Port += strlen("DEBUGPORT");
|
Port += sizeof("DEBUGPORT") - 1;
|
||||||
|
|
||||||
/* Now get past any spaces and skip the equal sign */
|
/* Now get past any spaces and skip the equal sign */
|
||||||
while (*Port == ' ') Port++;
|
while (*Port == ' ') Port++;
|
||||||
|
@ -207,15 +198,14 @@ KdInitSystem(ULONG BootPhase,
|
||||||
|
|
||||||
/* Get the debug mode and wrapper */
|
/* Get the debug mode and wrapper */
|
||||||
Port = KdpGetDebugMode(Port);
|
Port = KdpGetDebugMode(Port);
|
||||||
Port = KdpGetWrapperDebugMode(Port, LoaderBlock);
|
Port = strstr(Port, "DEBUGPORT");
|
||||||
KdDebuggerEnabled = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we got a baud rate */
|
/* Check if we got a baud rate */
|
||||||
if (BaudRate)
|
if (BaudRate)
|
||||||
{
|
{
|
||||||
/* Move past the actual string, to reach the rate */
|
/* Move past the actual string, to reach the rate */
|
||||||
BaudRate += strlen("BAUDRATE");
|
BaudRate += sizeof("BAUDRATE") - 1;
|
||||||
|
|
||||||
/* Now get past any spaces */
|
/* Now get past any spaces */
|
||||||
while (*BaudRate == ' ') BaudRate++;
|
while (*BaudRate == ' ') BaudRate++;
|
||||||
|
@ -233,7 +223,7 @@ KdInitSystem(ULONG BootPhase,
|
||||||
if (Irq)
|
if (Irq)
|
||||||
{
|
{
|
||||||
/* Move past the actual string, to reach the rate */
|
/* Move past the actual string, to reach the rate */
|
||||||
Irq += strlen("IRQ");
|
Irq += sizeof("IRQ") - 1;
|
||||||
|
|
||||||
/* Now get past any spaces */
|
/* Now get past any spaces */
|
||||||
while (*Irq == ' ') Irq++;
|
while (*Irq == ' ') Irq++;
|
||||||
|
@ -257,7 +247,7 @@ KdInitSystem(ULONG BootPhase,
|
||||||
if (WrapperInitRoutine) WrapperInitRoutine(&WrapperTable, 0);
|
if (WrapperInitRoutine) WrapperInitRoutine(&WrapperTable, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else /* BootPhase > 0 */
|
||||||
{
|
{
|
||||||
#ifdef _M_IX86
|
#ifdef _M_IX86
|
||||||
KdpEnableSafeMem();
|
KdpEnableSafeMem();
|
||||||
|
@ -271,4 +261,4 @@ KdInitSystem(ULONG BootPhase,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -293,11 +293,11 @@ KdpPrintString(LPSTR String,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call the Wrapper Routine */
|
/* Call the Wrapper Routine */
|
||||||
if (WrapperInitRoutine) WrapperTable.KdpPrintRoutine(String, Length);
|
if (WrapperTable.KdpPrintRoutine)
|
||||||
|
WrapperTable.KdpPrintRoutine(String, Length);
|
||||||
|
|
||||||
/* Return the Length */
|
/* Return the Length */
|
||||||
return Length;
|
return Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
||||||
|
|
|
@ -163,12 +163,22 @@ KdpEnterDebuggerException(IN PKTRAP_FRAME TrapFrame,
|
||||||
EipOld = Context->Eip;
|
EipOld = Context->Eip;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef KDBG
|
||||||
/* Call KDBG if available */
|
/* Call KDBG if available */
|
||||||
Return = KdbEnterDebuggerException(ExceptionRecord,
|
Return = KdbEnterDebuggerException(ExceptionRecord,
|
||||||
PreviousMode,
|
PreviousMode,
|
||||||
Context,
|
Context,
|
||||||
TrapFrame,
|
TrapFrame,
|
||||||
!SecondChance);
|
!SecondChance);
|
||||||
|
#else /* not KDBG */
|
||||||
|
if (WrapperInitRoutine)
|
||||||
|
{
|
||||||
|
/* Call GDB */
|
||||||
|
Return = WrapperTable.KdpExceptionRoutine(ExceptionRecord,
|
||||||
|
Context,
|
||||||
|
TrapFrame);
|
||||||
|
}
|
||||||
|
#endif /* not KDBG */
|
||||||
|
|
||||||
/* Bump EIP over int 3 if debugger did not already change it */
|
/* Bump EIP over int 3 if debugger did not already change it */
|
||||||
if (ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT)
|
if (ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT)
|
||||||
|
|
Loading…
Reference in a new issue