ReactOS 0.4.15-dev-5666-gc548b97
debug.h
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Ancillary Function Driver
4 * FILE: include/debug.h
5 * PURPOSE: Debugging support macros
6 * DEFINES: DBG - Enable debug output
7 * NASSERT - Disable assertions
8 */
9
10#pragma once
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_CHECK 0x00000100
19#define DEBUG_IRP 0x00000200
20#define DEBUG_ULTRA 0xFFFFFFFF
21
22#if DBG
23
25
26#ifdef _MSC_VER
27
28#define AFD_DbgPrint(_t_, _x_) \
29 if ((_t_ > NORMAL_MASK) \
30 ? (DebugTraceLevel & _t_) > NORMAL_MASK \
31 : (DebugTraceLevel & NORMAL_MASK) >= _t_) { \
32 DbgPrint("(%s:%d) ", __FILE__, __LINE__); \
33 DbgPrint _x_ ; \
34 }
35
36#else /* _MSC_VER */
37
38#define AFD_DbgPrint(_t_, _x_) \
39 if ((_t_ > NORMAL_MASK) \
40 ? (DebugTraceLevel & _t_) > NORMAL_MASK \
41 : (DebugTraceLevel & NORMAL_MASK) >= _t_) { \
42 DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
43 DbgPrint _x_ ; \
44 }
45
46#endif /* _MSC_VER */
47
48#ifdef ASSERT
49#undef ASSERT
50#endif
51
52#ifdef NASSERT
53#define ASSERT(x)
54#else /* NASSERT */
55#define ASSERT(x) if (!(x)) { AFD_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); DbgBreakPoint(); }
56#endif /* NASSERT */
57
58#else /* DBG */
59
60#define AFD_DbgPrint(_t_, _x_)
61
62#define ASSERTKM(x)
63#ifndef ASSERT
64#define ASSERT(x)
65#endif
66
67#endif /* DBG */
68
69
70#undef assert
71#define assert(x) ASSERT(x)
72
73
74#ifdef _MSC_VER
75
76#define UNIMPLEMENTED \
77 AFD_DbgPrint(MIN_TRACE, ("The function at %s:%d is unimplemented, \
78 but come back another day.\n", __FILE__, __LINE__));
79
80#else /* _MSC_VER */
81
82#define UNIMPLEMENTED \
83 AFD_DbgPrint(MIN_TRACE, ("%s at %s:%d is unimplemented, " \
84 "but come back another day.\n", __FUNCTION__, __FILE__, __LINE__));
85
86#endif /* _MSC_VER */
87
88
89#define CHECKPOINT \
90 AFD_DbgPrint(DEBUG_CHECK, ("\n"));
91
92#define CP CHECKPOINT
93
94/* EOF */
ULONG DebugTraceLevel
Definition: ndis.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95