Author: hpoussin
Date: Tue Jan 8 12:51:53 2008
New Revision: 31668
URL:
http://svn.reactos.org/svn/reactos?rev=31668&view=rev
Log:
By default, display ERROR level debug output
Let KDBG change default output mask
Modified:
trunk/reactos/include/reactos/debug.h
trunk/reactos/ntoskrnl/kd/kdmain.c
trunk/reactos/ntoskrnl/kdbg/kdb_cli.c
Modified: trunk/reactos/include/reactos/debug.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/debug.h?re…
==============================================================================
--- trunk/reactos/include/reactos/debug.h (original)
+++ trunk/reactos/include/reactos/debug.h Tue Jan 8 12:51:53 2008
@@ -82,6 +82,7 @@
#endif
/* Print stuff only on Debug Builds*/
+#define DPFLTR_DEFAULT_ID -1
#ifdef DBG
/* These are always printed */
@@ -119,13 +120,13 @@
#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
Modified: trunk/reactos/ntoskrnl/kd/kdmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd/kdmain.c?rev=3…
==============================================================================
--- trunk/reactos/ntoskrnl/kd/kdmain.c (original)
+++ trunk/reactos/ntoskrnl/kd/kdmain.c Tue Jan 8 12:51:53 2008
@@ -30,6 +30,8 @@
#define MAX_KD_COMPONENT_TABLE_ENTRIES 128
KD_COMPONENT_DATA KdComponentTable[MAX_KD_COMPONENT_TABLE_ENTRIES];
ULONG KdComponentTableEntries = 0;
+
+ULONG Kd_DEFAULT_MASK = 1 << DPFLTR_ERROR_LEVEL;
/* PRIVATE FUNCTIONS *********************************************************/
@@ -295,58 +297,86 @@
NTSTATUS
-STDCALL
+NTAPI
NtQueryDebugFilterState(IN ULONG ComponentId,
IN ULONG Level)
{
- unsigned int i;
-
- /* 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;
-}
-
-NTSTATUS
-STDCALL
+ ULONG i;
+
+ /* Convert Level to mask if it isn't already one */
+ if (Level < 32)
+ Level = 1 << Level;
+
+ /* 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
+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;
- }
-
- /* Convert level to mask, if needed */
+ ULONG i;
+
+ /* 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;
}
/*
Modified: trunk/reactos/ntoskrnl/kdbg/kdb_cli.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb_cli.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/kdbg/kdb_cli.c (original)
+++ trunk/reactos/ntoskrnl/kdbg/kdb_cli.c Tue Jan 8 12:51:53 2008
@@ -173,6 +173,7 @@
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 @@
if (Argc < 2)
{
- KdbpPrint("filter: component id argument required!\n");
+ KdbpPrint("filter: component name argument required!\n");
return TRUE;
}
if (!KdbpGetComponentId(Argv[1], &ComponentId))