ReactOS 0.4.16-dev-197-g92996da
kdebugprint.h
Go to the documentation of this file.
1/*
2 * This file contains debug-related definitions for kernel driver
3 *
4 * Copyright (c) 2008-2017 Red Hat, Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met :
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and / or other materials provided with the distribution.
14 * 3. Neither the names of the copyright holders nor the names of their contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30/**********************************************************************
31WARNING: this file is incompatible with Logo requirements
32TODO: Optional WPP technique
33**********************************************************************/
34
35#ifndef _K_DEBUG_PRINT_H
36#define _K_DEBUG_PRINT_H
37
38extern int nDebugLevel;
39extern int bDebugPrint;
40
41
42typedef void (*DEBUGPRINTFUNC)(const char *fmt, ...);
44
45void _LogOutEntry(int level, const char *s);
46void _LogOutExitValue(int level, const char *s, ULONG value);
47void _LogOutString(int level, const char *s);
48
49#define DEBUG_ENTRY(level) _LogOutEntry(level, __FUNCTION__)
50#define DEBUG_EXIT_STATUS(level, status) _LogOutExitValue(level, __FUNCTION__, status)
51#define DPrintFunctionName(Level) _LogOutString(Level, __FUNCTION__)
52
53
54#ifndef WPP_EVENT_TRACING
55
56#define WPP_INIT_TRACING(a,b)
57#define WPP_CLEANUP(a)
58
59#define MAX_DEBUG_LEVEL 1
60
61#define DPrintf(Level, Fmt) { if ( (Level) > MAX_DEBUG_LEVEL || (Level) > nDebugLevel || !bDebugPrint ) {} else { pDebugPrint Fmt; } }
62
63#define DPrintfBypass(Level, Fmt) DPrintf(Level, Fmt)
64
65#else
66
67//#define WPP_USE_BYPASS
68
69
70#define DPrintfAnyway(Level, Fmt) \
71{ \
72 if (bDebugPrint && (Level) <= nDebugLevel) \
73 { \
74 pDebugPrint Fmt; \
75 } \
76}
77
78//{05F77115-E57E-49bf-90DF-C0E6B6478E5F}
79#define WPP_CONTROL_GUIDS \
80 WPP_DEFINE_CONTROL_GUID(NetKVM, (05F77115,E57E,49bf,90DF,C0E6B6478E5F), \
81 WPP_DEFINE_BIT(TRACE_DEBUG)\
82 )
83
84
85#define WPP_LEVEL_ENABLED(LEVEL) \
86 (nDebugLevel >= (LEVEL))
87
88#define WPP_LEVEL_LOGGER(LEVEL) (WPP_CONTROL(WPP_BIT_ ## TRACE_DEBUG).Logger),
89
90
91#if WPP_USE_BYPASS
92#define DPrintfBypass(Level, Fmt) DPrintfAnyway(Level, Fmt)
93#else
94#define DPrintfBypass(Level, Fmt)
95#endif
96
97#define WPP_PRIVATE_ENABLE_CALLBACK WppEnableCallback
98
101 __in __int64 Logger,
105
106
107#endif
108#endif
VOID WppEnableCallback(__in LPCGUID Guid, __in __int64 Logger, __in BOOLEAN Enable, __in ULONG Flags, __in UCHAR Level)
unsigned char BOOLEAN
#define __int64
Definition: basetyps.h:16
#define __in
Definition: dbghelp.h:35
void _LogOutEntry(int level, const char *s)
defined(WPP_EVENT_TRACING) || defined(WPP_USE_BYPASS)
int nDebugLevel
int bDebugPrint
void _LogOutString(int level, const char *s)
void(* DEBUGPRINTFUNC)(const char *fmt,...)
Definition: kdebugprint.h:42
DEBUGPRINTFUNC pDebugPrint
void _LogOutExitValue(int level, const char *s, ULONG value)
GLint level
Definition: gl.h:1546
GLdouble s
Definition: gl.h:2039
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
Definition: dsound.c:943
uint32_t ULONG
Definition: typedefs.h:59
Definition: pdh_main.c:94
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
Definition: wdfobject.h:762
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:56
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
unsigned char UCHAR
Definition: xmlstorage.h:181