mirror of
https://github.com/reactos/reactos.git
synced 2025-07-24 22:33:44 +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
|
#endif
|
||||||
|
|
||||||
/* Print stuff only on Debug Builds*/
|
/* Print stuff only on Debug Builds*/
|
||||||
|
#define DPFLTR_DEFAULT_ID -1
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
|
|
||||||
/* These are always printed */
|
/* These are always printed */
|
||||||
|
@ -119,13 +120,13 @@ RtlAssert(
|
||||||
#define INFO_(ch, args...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, "(%s:%d) ", __FILE__, __LINE__), \
|
#define INFO_(ch, args...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, "(%s:%d) ", __FILE__, __LINE__), \
|
||||||
DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, ##args)
|
DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, ##args)
|
||||||
#elif defined(_MSC_VER)
|
#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__)
|
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__)
|
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__)
|
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__)
|
DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#error Unknown compiler
|
#error Unknown compiler
|
||||||
|
|
|
@ -31,6 +31,8 @@ typedef struct
|
||||||
KD_COMPONENT_DATA KdComponentTable[MAX_KD_COMPONENT_TABLE_ENTRIES];
|
KD_COMPONENT_DATA KdComponentTable[MAX_KD_COMPONENT_TABLE_ENTRIES];
|
||||||
ULONG KdComponentTableEntries = 0;
|
ULONG KdComponentTableEntries = 0;
|
||||||
|
|
||||||
|
ULONG Kd_DEFAULT_MASK = 1 << DPFLTR_ERROR_LEVEL;
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS *********************************************************/
|
/* PRIVATE FUNCTIONS *********************************************************/
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
|
@ -295,58 +297,86 @@ KdChangeOption(IN KD_OPTION Option,
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
NTAPI
|
||||||
NtQueryDebugFilterState(IN ULONG ComponentId,
|
NtQueryDebugFilterState(IN ULONG ComponentId,
|
||||||
IN ULONG Level)
|
IN ULONG Level)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
ULONG i;
|
||||||
|
|
||||||
/* convert Level to mask if it isn't already one */
|
/* Convert Level to mask if it isn't already one */
|
||||||
if ( Level < 32 )
|
if (Level < 32)
|
||||||
Level = 1 << Level;
|
Level = 1 << Level;
|
||||||
|
|
||||||
for ( i = 0; i < KdComponentTableEntries; i++ )
|
/* Check if it is not the default component */
|
||||||
{
|
if (ComponentId != DPFLTR_DEFAULT_ID)
|
||||||
if ( ComponentId == KdComponentTable[i].ComponentId )
|
{
|
||||||
{
|
/* No, search for an existing entry in the table */
|
||||||
if ( Level & KdComponentTable[i].Level )
|
for (i = 0; i < KdComponentTableEntries; i++)
|
||||||
return TRUE;
|
{
|
||||||
break;
|
/* Check if it is the right component */
|
||||||
}
|
if (ComponentId == KdComponentTable[i].ComponentId)
|
||||||
}
|
{
|
||||||
return FALSE;
|
/* 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
|
NTSTATUS
|
||||||
STDCALL
|
NTAPI
|
||||||
NtSetDebugFilterState(IN ULONG ComponentId,
|
NtSetDebugFilterState(IN ULONG ComponentId,
|
||||||
IN ULONG Level,
|
IN ULONG Level,
|
||||||
IN BOOLEAN State)
|
IN BOOLEAN State)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
ULONG 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 */
|
/* Convert Level to mask if it isn't already one */
|
||||||
if (Level < 32)
|
if (Level < 32)
|
||||||
Level = 1 << Level;
|
Level = 1 << Level;
|
||||||
|
|
||||||
if ( State )
|
/* Check if it is the default component */
|
||||||
KdComponentTable[i].Level |= Level;
|
if (ComponentId == DPFLTR_DEFAULT_ID)
|
||||||
else
|
{
|
||||||
KdComponentTable[i].Level &= ~Level;
|
/* Yes, modify the default mask */
|
||||||
return STATUS_SUCCESS;
|
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;
|
PCCH Name;
|
||||||
ULONG Id;
|
ULONG Id;
|
||||||
} ComponentTable[] = {
|
} ComponentTable[] = {
|
||||||
|
{ "DEFAULT", DPFLTR_DEFAULT_ID },
|
||||||
{ "SYSTEM", DPFLTR_SYSTEM_ID },
|
{ "SYSTEM", DPFLTR_SYSTEM_ID },
|
||||||
{ "SMSS", DPFLTR_SMSS_ID },
|
{ "SMSS", DPFLTR_SMSS_ID },
|
||||||
{ "SETUP", DPFLTR_SETUP_ID },
|
{ "SETUP", DPFLTR_SETUP_ID },
|
||||||
|
@ -382,7 +383,7 @@ KdbpCmdFilter(ULONG Argc, PCHAR Argv[])
|
||||||
|
|
||||||
if (Argc < 2)
|
if (Argc < 2)
|
||||||
{
|
{
|
||||||
KdbpPrint("filter: component id argument required!\n");
|
KdbpPrint("filter: component name argument required!\n");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (!KdbpGetComponentId(Argv[1], &ComponentId))
|
if (!KdbpGetComponentId(Argv[1], &ComponentId))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue