mirror of
https://github.com/reactos/reactos.git
synced 2025-07-23 15:43:37 +00:00
By default, display ERROR level debug output
Let KDBG change default output mask svn path=/trunk/; revision=31668
This commit is contained in:
parent
24e8a63544
commit
81ac40ae05
3 changed files with 73 additions and 41 deletions
|
@ -82,6 +82,7 @@ RtlAssert(
|
|||
#endif
|
||||
|
||||
/* Print stuff only on Debug Builds*/
|
||||
#define DPFLTR_DEFAULT_ID -1
|
||||
#ifdef DBG
|
||||
|
||||
/* These are always printed */
|
||||
|
@ -119,13 +120,13 @@ RtlAssert(
|
|||
#define INFO_(ch, args...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, "(%s:%d) ", __FILE__, __LINE__), \
|
||||
DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, ##args)
|
||||
#elif defined(_MSC_VER)
|
||||
#define ERR_(ch, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_ERROR_LEVEL, "(%s:%d) ", __FILE__, __LINE__), \
|
||||
#define ERR_(ch, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_ERROR_LEVEL, "(%s:%d) ", __FILE__, __LINE__), \
|
||||
DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_ERROR_LEVEL, __VA_ARGS__)
|
||||
#define WARN_(ch, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_WARNING_LEVEL, "(%s:%d) ", __FILE__, __LINE__), \
|
||||
#define WARN_(ch, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_WARNING_LEVEL, "(%s:%d) ", __FILE__, __LINE__), \
|
||||
DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_WARNING_LEVEL, __VA_ARGS__)
|
||||
#define TRACE_(ch, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_TRACE_LEVEL, "(%s:%d) ", __FILE__, __LINE__), \
|
||||
#define TRACE_(ch, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_TRACE_LEVEL, "(%s:%d) ", __FILE__, __LINE__), \
|
||||
DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_TRACE_LEVEL, __VA_ARGS__)
|
||||
#define INFO_(ch, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, "(%s:%d) ", __FILE__, __LINE__), \
|
||||
#define INFO_(ch, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, "(%s:%d) ", __FILE__, __LINE__), \
|
||||
DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, __VA_ARGS__)
|
||||
#else
|
||||
#error Unknown compiler
|
||||
|
|
|
@ -31,6 +31,8 @@ typedef struct
|
|||
KD_COMPONENT_DATA KdComponentTable[MAX_KD_COMPONENT_TABLE_ENTRIES];
|
||||
ULONG KdComponentTableEntries = 0;
|
||||
|
||||
ULONG Kd_DEFAULT_MASK = 1 << DPFLTR_ERROR_LEVEL;
|
||||
|
||||
/* PRIVATE FUNCTIONS *********************************************************/
|
||||
|
||||
ULONG
|
||||
|
@ -295,58 +297,86 @@ KdChangeOption(IN KD_OPTION Option,
|
|||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NTAPI
|
||||
NtQueryDebugFilterState(IN ULONG ComponentId,
|
||||
IN ULONG Level)
|
||||
{
|
||||
unsigned int i;
|
||||
ULONG i;
|
||||
|
||||
/* convert Level to mask if it isn't already one */
|
||||
if ( Level < 32 )
|
||||
Level = 1 << Level;
|
||||
/* Convert Level to mask if it isn't already one */
|
||||
if (Level < 32)
|
||||
Level = 1 << Level;
|
||||
|
||||
for ( i = 0; i < KdComponentTableEntries; i++ )
|
||||
{
|
||||
if ( ComponentId == KdComponentTable[i].ComponentId )
|
||||
{
|
||||
if ( Level & KdComponentTable[i].Level )
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
/* Check if it is not the default component */
|
||||
if (ComponentId != DPFLTR_DEFAULT_ID)
|
||||
{
|
||||
/* No, search for an existing entry in the table */
|
||||
for (i = 0; i < KdComponentTableEntries; i++)
|
||||
{
|
||||
/* Check if it is the right component */
|
||||
if (ComponentId == KdComponentTable[i].ComponentId)
|
||||
{
|
||||
/* Check if mask are matching */
|
||||
return (Level & KdComponentTable[i].Level) != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Entry not found in the table, use default mask */
|
||||
return (Level & Kd_DEFAULT_MASK) != 0;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NTAPI
|
||||
NtSetDebugFilterState(IN ULONG ComponentId,
|
||||
IN ULONG Level,
|
||||
IN BOOLEAN State)
|
||||
{
|
||||
unsigned int i;
|
||||
for ( i = 0; i < KdComponentTableEntries; i++ )
|
||||
{
|
||||
if ( ComponentId == KdComponentTable[i].ComponentId )
|
||||
break;
|
||||
}
|
||||
if ( i == KdComponentTableEntries )
|
||||
{
|
||||
if ( i == MAX_KD_COMPONENT_TABLE_ENTRIES )
|
||||
return STATUS_INVALID_PARAMETER_1;
|
||||
++KdComponentTableEntries;
|
||||
KdComponentTable[i].ComponentId = ComponentId;
|
||||
KdComponentTable[i].Level = 0;
|
||||
}
|
||||
ULONG i;
|
||||
|
||||
/* Convert level to mask, if needed */
|
||||
/* Convert Level to mask if it isn't already one */
|
||||
if (Level < 32)
|
||||
Level = 1 << Level;
|
||||
|
||||
if ( State )
|
||||
KdComponentTable[i].Level |= Level;
|
||||
else
|
||||
KdComponentTable[i].Level &= ~Level;
|
||||
return STATUS_SUCCESS;
|
||||
/* Check if it is the default component */
|
||||
if (ComponentId == DPFLTR_DEFAULT_ID)
|
||||
{
|
||||
/* Yes, modify the default mask */
|
||||
if (State)
|
||||
Kd_DEFAULT_MASK |= Level;
|
||||
else
|
||||
Kd_DEFAULT_MASK &= ~Level;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Search for an existing entry */
|
||||
for (i = 0; i < KdComponentTableEntries; i++ )
|
||||
{
|
||||
if (ComponentId == KdComponentTable[i].ComponentId)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check if we have found an existing entry */
|
||||
if (i == KdComponentTableEntries)
|
||||
{
|
||||
/* Check if we have enough space in the table */
|
||||
if (i == MAX_KD_COMPONENT_TABLE_ENTRIES)
|
||||
return STATUS_INVALID_PARAMETER_1;
|
||||
|
||||
/* Add a new entry */
|
||||
++KdComponentTableEntries;
|
||||
KdComponentTable[i].ComponentId = ComponentId;
|
||||
KdComponentTable[i].Level = Kd_DEFAULT_MASK;
|
||||
}
|
||||
|
||||
/* Update entry table */
|
||||
if (State)
|
||||
KdComponentTable[i].Level |= Level;
|
||||
else
|
||||
KdComponentTable[i].Level &= ~Level;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -173,6 +173,7 @@ KdbpGetComponentId(
|
|||
PCCH Name;
|
||||
ULONG Id;
|
||||
} ComponentTable[] = {
|
||||
{ "DEFAULT", DPFLTR_DEFAULT_ID },
|
||||
{ "SYSTEM", DPFLTR_SYSTEM_ID },
|
||||
{ "SMSS", DPFLTR_SMSS_ID },
|
||||
{ "SETUP", DPFLTR_SETUP_ID },
|
||||
|
@ -382,7 +383,7 @@ KdbpCmdFilter(ULONG Argc, PCHAR Argv[])
|
|||
|
||||
if (Argc < 2)
|
||||
{
|
||||
KdbpPrint("filter: component id argument required!\n");
|
||||
KdbpPrint("filter: component name argument required!\n");
|
||||
return TRUE;
|
||||
}
|
||||
if (!KdbpGetComponentId(Argv[1], &ComponentId))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue