Add debug print macro to dump debug print statements to kernel debugger output
Signed-off-by: Sameeh Jubran <sameeh@daynix.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
06ab9c9595
commit
f3f9bcbde8
@ -667,7 +667,19 @@ void DebugPrintFunc(const char *format, ...)
|
|||||||
va_start(list, format);
|
va_start(list, format);
|
||||||
vDbgPrintEx(DPFLTR_DEFAULT_ID, 9 | DPFLTR_MASK, format, list);
|
vDbgPrintEx(DPFLTR_DEFAULT_ID, 9 | DPFLTR_MASK, format, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebugPrint(int level, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
static const ULONG xlate[] = { 0, 0, 1, 2, 3 };
|
||||||
|
if (level <= 0 || level > 5)
|
||||||
|
return;
|
||||||
|
|
||||||
|
va_list list;
|
||||||
|
va_start(list, fmt);
|
||||||
|
vDbgPrintEx(DPFLTR_IHVVIDEO_ID, xlate[level - 1], fmt, list);
|
||||||
|
va_end(list);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma code_seg(pop) // End Non-Paged Code
|
#pragma code_seg(pop) // End Non-Paged Code
|
||||||
|
|
||||||
|
@ -211,14 +211,18 @@ DodSystemDisplayWrite(
|
|||||||
|
|
||||||
extern int nDebugLevel;
|
extern int nDebugLevel;
|
||||||
void DebugPrintFuncSerial(const char *format, ...);
|
void DebugPrintFuncSerial(const char *format, ...);
|
||||||
|
|
||||||
void DebugPrintFunc(const char *format, ...);
|
void DebugPrintFunc(const char *format, ...);
|
||||||
|
void DebugPrint(int level, const char *fmt, ...);
|
||||||
|
|
||||||
|
#define DbgExpandArguments(...) __VA_ARGS__
|
||||||
|
|
||||||
|
#define DbgPrint(level, line) do { \
|
||||||
|
if (level <= nDebugLevel) DebugPrintFuncSerial line; \
|
||||||
|
DebugPrint(level, DbgExpandArguments line); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
#define DbgPrint(level, line) \
|
|
||||||
if (level > nDebugLevel) {} \
|
|
||||||
else DebugPrintFuncSerial line
|
|
||||||
#else
|
#else
|
||||||
#define DbgPrint(level, line)
|
#define DbgPrint(level, line)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// else if (0) DebugPrintFuncSerial line \
|
// else if (0) DebugPrintFuncSerial line \
|
||||||
|
Loading…
Reference in New Issue
Block a user