mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[NTOS:KDBG] Use internal KdpDPrintf instead of DbgPrint
DbgPrint is implemented through a breakpoint, and then KD tries to recursively lock its own spinlock. Call a lower level routine instead.
This commit is contained in:
parent
813d9cd2cc
commit
66dea86d68
4 changed files with 39 additions and 38 deletions
|
@ -51,7 +51,7 @@ KdbpPrintDisasm(void* Ignored, const char* fmt, ...)
|
|||
|
||||
va_start(ap, fmt);
|
||||
ret = vsprintf(buffer, fmt, ap);
|
||||
DbgPrint("%s", buffer);
|
||||
KdpDprintf("%s", buffer);
|
||||
va_end(ap);
|
||||
return(ret);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ KdbpPrintAddressInCode(unsigned int Addr, struct disassemble_info * Ignored)
|
|||
{
|
||||
if (!KdbSymPrintAddress((void*)Addr, NULL))
|
||||
{
|
||||
DbgPrint("<%08x>", Addr);
|
||||
KdpDprintf("<%08x>", Addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2710,6 +2710,7 @@ KdbpCmdHelp(
|
|||
* \note Doesn't correctly handle \\t and terminal escape sequences when calculating the
|
||||
* number of lines required to print a single line from the Buffer in the terminal.
|
||||
* Prints maximum 4096 chars, because of its buffer size.
|
||||
* Uses KdpDPrintf internally (NOT DbgPrint!). Callers must already hold the debugger lock.
|
||||
*/
|
||||
VOID
|
||||
KdbpPrint(
|
||||
|
@ -2735,11 +2736,11 @@ KdbpPrint(
|
|||
/* Initialize the terminal */
|
||||
if (!TerminalInitialized)
|
||||
{
|
||||
DbgPrint("\x1b[7h"); /* Enable linewrap */
|
||||
KdpDprintf("\x1b[7h"); /* Enable linewrap */
|
||||
|
||||
/* Query terminal type */
|
||||
/*DbgPrint("\x1b[Z");*/
|
||||
DbgPrint("\x05");
|
||||
KdpDprintf("\x05");
|
||||
|
||||
TerminalInitialized = TRUE;
|
||||
Length = 0;
|
||||
|
@ -2770,7 +2771,7 @@ KdbpPrint(
|
|||
/* Try to query number of rows from terminal. A reply looks like "\x1b[8;24;80t" */
|
||||
TerminalReportsSize = FALSE;
|
||||
KeStallExecutionProcessor(100000);
|
||||
DbgPrint("\x1b[18t");
|
||||
KdpDprintf("\x1b[18t");
|
||||
c = KdbpTryGetCharSerial(5000);
|
||||
|
||||
if (c == KEY_ESC)
|
||||
|
@ -2855,9 +2856,9 @@ KdbpPrint(
|
|||
KdbRepeatLastCommand = FALSE;
|
||||
|
||||
if (KdbNumberOfColsPrinted > 0)
|
||||
DbgPrint("\n");
|
||||
KdpDprintf("\n");
|
||||
|
||||
DbgPrint("--- Press q to abort, any other key to continue ---");
|
||||
KdpDprintf("--- Press q to abort, any other key to continue ---");
|
||||
RowsPrintedByTerminal++; /* added by Mna. */
|
||||
|
||||
if (KdbDebugState & KD_DEBUG_KDSERIAL)
|
||||
|
@ -2876,7 +2877,7 @@ KdbpPrint(
|
|||
c = KdbpTryGetCharKeyboard(&ScanCode, 5);
|
||||
}
|
||||
|
||||
DbgPrint("\n");
|
||||
KdpDprintf("\n");
|
||||
if (c == 'q')
|
||||
{
|
||||
KdbOutputAborted = TRUE;
|
||||
|
@ -2917,7 +2918,7 @@ KdbpPrint(
|
|||
}
|
||||
}
|
||||
|
||||
DbgPrint("%s", p);
|
||||
KdpDprintf("%s", p);
|
||||
|
||||
if (c != '\0')
|
||||
p[i + 1] = c;
|
||||
|
@ -3052,11 +3053,11 @@ KdbpPager(
|
|||
/* Initialize the terminal */
|
||||
if (!TerminalInitialized)
|
||||
{
|
||||
DbgPrint("\x1b[7h"); /* Enable linewrap */
|
||||
KdpDprintf("\x1b[7h"); /* Enable linewrap */
|
||||
|
||||
/* Query terminal type */
|
||||
/*DbgPrint("\x1b[Z");*/
|
||||
DbgPrint("\x05");
|
||||
KdpDprintf("\x05");
|
||||
|
||||
TerminalInitialized = TRUE;
|
||||
Length = 0;
|
||||
|
@ -3087,7 +3088,7 @@ KdbpPager(
|
|||
/* Try to query number of rows from terminal. A reply looks like "\x1b[8;24;80t" */
|
||||
TerminalReportsSize = FALSE;
|
||||
KeStallExecutionProcessor(100000);
|
||||
DbgPrint("\x1b[18t");
|
||||
KdpDprintf("\x1b[18t");
|
||||
c = KdbpTryGetCharSerial(5000);
|
||||
|
||||
if (c == KEY_ESC)
|
||||
|
@ -3148,7 +3149,7 @@ KdbpPager(
|
|||
{
|
||||
if ( p > Buffer+BufLength)
|
||||
{
|
||||
DbgPrint("Dmesg: error, p > Buffer+BufLength,d=%d", p - (Buffer+BufLength));
|
||||
KdpDprintf("Dmesg: error, p > Buffer+BufLength,d=%d", p - (Buffer+BufLength));
|
||||
return;
|
||||
}
|
||||
i = strcspn(p, "\n");
|
||||
|
@ -3178,9 +3179,9 @@ KdbpPager(
|
|||
KdbRepeatLastCommand = FALSE;
|
||||
|
||||
if (KdbNumberOfColsPrinted > 0)
|
||||
DbgPrint("\n");
|
||||
KdpDprintf("\n");
|
||||
|
||||
DbgPrint("--- Press q to abort, e/End,h/Home,u/PgUp, other key/PgDn ---");
|
||||
KdpDprintf("--- Press q to abort, e/End,h/Home,u/PgUp, other key/PgDn ---");
|
||||
RowsPrintedByTerminal++;
|
||||
|
||||
if (KdbDebugState & KD_DEBUG_KDSERIAL)
|
||||
|
@ -3200,7 +3201,7 @@ KdbpPager(
|
|||
}
|
||||
|
||||
//DbgPrint("\n"); //Consize version: don't show pressed key
|
||||
DbgPrint(" '%c'/scan=%04x\n", c, ScanCode); // Shows pressed key
|
||||
KdpDprintf(" '%c'/scan=%04x\n", c, ScanCode); // Shows pressed key
|
||||
|
||||
if (c == 'q')
|
||||
{
|
||||
|
@ -3264,7 +3265,7 @@ KdbpPager(
|
|||
}
|
||||
|
||||
// The main printing of the current line:
|
||||
DbgPrint(p);
|
||||
KdpDprintf(p);
|
||||
|
||||
// restore not null char with saved:
|
||||
if (c != '\0')
|
||||
|
|
|
@ -253,7 +253,7 @@ RpnpDumpStack(
|
|||
ULONG ul;
|
||||
|
||||
ASSERT(Stack);
|
||||
DbgPrint("\nStack size: %ld\n", Stack->Sp);
|
||||
KdpDprintf("\nStack size: %ld\n", Stack->Sp);
|
||||
|
||||
for (ul = 0; ul < Stack->Sp; ul++)
|
||||
{
|
||||
|
@ -261,60 +261,60 @@ RpnpDumpStack(
|
|||
switch (Op->Type)
|
||||
{
|
||||
case RpnOpNop:
|
||||
DbgPrint("NOP,");
|
||||
KdpDprintf("NOP,");
|
||||
break;
|
||||
|
||||
case RpnOpImmediate:
|
||||
DbgPrint("0x%I64x,", Op->Data.Immediate);
|
||||
KdpDprintf("0x%I64x,", Op->Data.Immediate);
|
||||
break;
|
||||
|
||||
case RpnOpBinaryOperator:
|
||||
if (Op->Data.BinaryOperator == RpnBinaryOperatorAdd)
|
||||
DbgPrint("+,");
|
||||
KdpDprintf("+,");
|
||||
else if (Op->Data.BinaryOperator == RpnBinaryOperatorSub)
|
||||
DbgPrint("-,");
|
||||
KdpDprintf("-,");
|
||||
else if (Op->Data.BinaryOperator == RpnBinaryOperatorMul)
|
||||
DbgPrint("*,");
|
||||
KdpDprintf("*,");
|
||||
else if (Op->Data.BinaryOperator == RpnBinaryOperatorDiv)
|
||||
DbgPrint("/,");
|
||||
KdpDprintf("/,");
|
||||
else if (Op->Data.BinaryOperator == RpnBinaryOperatorMod)
|
||||
DbgPrint("%%,");
|
||||
KdpDprintf("%%,");
|
||||
else if (Op->Data.BinaryOperator == RpnBinaryOperatorEquals)
|
||||
DbgPrint("==,");
|
||||
KdpDprintf("==,");
|
||||
else if (Op->Data.BinaryOperator == RpnBinaryOperatorNotEquals)
|
||||
DbgPrint("!=,");
|
||||
KdpDprintf("!=,");
|
||||
else if (Op->Data.BinaryOperator == RpnBinaryOperatorLessThan)
|
||||
DbgPrint("<,");
|
||||
KdpDprintf("<,");
|
||||
else if (Op->Data.BinaryOperator == RpnBinaryOperatorLessThanOrEquals)
|
||||
DbgPrint("<=,");
|
||||
KdpDprintf("<=,");
|
||||
else if (Op->Data.BinaryOperator == RpnBinaryOperatorGreaterThan)
|
||||
DbgPrint(">,");
|
||||
KdpDprintf(">,");
|
||||
else if (Op->Data.BinaryOperator == RpnBinaryOperatorGreaterThanOrEquals)
|
||||
DbgPrint(">=,");
|
||||
KdpDprintf(">=,");
|
||||
else
|
||||
DbgPrint("UNKNOWN OP,");
|
||||
KdpDprintf("UNKNOWN OP,");
|
||||
|
||||
break;
|
||||
|
||||
case RpnOpRegister:
|
||||
DbgPrint("%s,", RegisterToTrapFrame[Op->Data.Register].Name);
|
||||
KdpDprintf("%s,", RegisterToTrapFrame[Op->Data.Register].Name);
|
||||
break;
|
||||
|
||||
case RpnOpDereference:
|
||||
DbgPrint("[%s],",
|
||||
KdpDprintf("[%s],",
|
||||
(Op->Data.DerefMemorySize == 1) ? ("byte") :
|
||||
((Op->Data.DerefMemorySize == 2) ? ("word") :
|
||||
((Op->Data.DerefMemorySize == 4) ? ("dword") : ("qword"))));
|
||||
break;
|
||||
|
||||
default:
|
||||
DbgPrint("\nUnsupported Type: %d\n", Op->Type);
|
||||
KdpDprintf("\nUnsupported Type: %d\n", Op->Type);
|
||||
ul = Stack->Sp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DbgPrint("\n");
|
||||
KdpDprintf("\n");
|
||||
}
|
||||
|
||||
/*!\brief Clears the given RPN stack.
|
||||
|
|
|
@ -180,12 +180,12 @@ KdbSymPrintAddress(
|
|||
FunctionName);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("<%s:%x (%s:%d (%s))>",
|
||||
KdpDprintf("<%s:%x (%s:%d (%s))>",
|
||||
ModuleNameAnsi, RelativeAddress, FileName, LineNumber, FunctionName);
|
||||
}
|
||||
else
|
||||
{
|
||||
DbgPrint("<%s:%x>", ModuleNameAnsi, RelativeAddress);
|
||||
KdpDprintf("<%s:%x>", ModuleNameAnsi, RelativeAddress);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in a new issue