ReactOS 0.4.15-dev-5669-g09dde2c
debug.h
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS TDI test driver
4 * FILE: include/debug.h
5 * PURPOSE: Debugging support macros
6 * DEFINES: DBG - Enable debug output
7 * NASSERT - Disable assertions
8 */
9#ifndef __DEBUG_H
10#define __DEBUG_H
11
12#define NORMAL_MASK 0x000000FF
13#define SPECIAL_MASK 0xFFFFFF00
14#define MIN_TRACE 0x00000001
15#define MID_TRACE 0x00000002
16#define MAX_TRACE 0x00000003
17
18#define DEBUG_ULTRA 0xFFFFFFFF
19
20#ifdef ASSERT
21#undef ASSERT
22#endif
23
24#if DBG
25
27
28#ifdef _MSC_VER
29
30#define TDI_DbgPrint(_t_, _x_) \
31 if ((_t_ > NORMAL_MASK) \
32 ? (DebugTraceLevel & _t_) > NORMAL_MASK \
33 : (DebugTraceLevel & NORMAL_MASK) >= _t_) { \
34 DbgPrint("(%s:%d) ", __FILE__, __LINE__); \
35 DbgPrint _x_ ; \
36 }
37
38#else /* _MSC_VER */
39
40#define TDI_DbgPrint(_t_, _x_) \
41 if ((_t_ > NORMAL_MASK) \
42 ? (DebugTraceLevel & _t_) > NORMAL_MASK \
43 : (DebugTraceLevel & NORMAL_MASK) >= _t_) { \
44 DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
45 DbgPrint _x_ ; \
46 }
47
48#endif /* _MSC_VER */
49
50#ifdef NASSERT
51#define ASSERT(x)
52#else /* NASSERT */
53#define ASSERT(x) if (!(x)) { TDI_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); KeBugCheck(0); }
54#endif /* NASSERT */
55#define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
56
57#else /* DBG */
58
59#define TDI_DbgPrint(_t_, _x_)
60
61#define ASSERT_IRQL(x)
62#define ASSERT(x)
63
64#endif /* DBG */
65
66
67#define assert(x) ASSERT(x)
68#define assert_irql(x) ASSERT_IRQL(x)
69
70
71#ifdef _MSC_VER
72
73#define UNIMPLEMENTED \
74 TDI_DbgPrint(MIN_TRACE, ("The function at %s:%d is unimplemented, \
75 but come back another day.\n", __FILE__, __LINE__));
76
77#else /* _MSC_VER */
78
79#define UNIMPLEMENTED \
80 TDI_DbgPrint(MIN_TRACE, ("%s at %s:%d is unimplemented, \
81 but come back another day.\n", __FUNCTION__, __FILE__, __LINE__));
82
83#endif /* _MSC_VER */
84
85
86#define CHECKPOINT \
87do { TDI_DbgPrint(MIN_TRACE, ("%s:%d\n", __FILE__, __LINE__)); } while(0);
88
89#endif /* __DEBUG_H */
90
91/* EOF */
ULONG DebugTraceLevel
Definition: ndis.c:13
uint32_t ULONG
Definition: typedefs.h:59