ReactOS 0.4.16-dev-112-g52265ae
debug.h
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS KDBG Kernel Debugger
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Useful debugging macros
5 * COPYRIGHT: Copyright 2023 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
6 */
7
8/*
9 * NOTE: Define NDEBUG before including this header
10 * to disable debugging macros.
11 */
12
13#pragma once
14
15#ifndef __RELFILE__
16#define __RELFILE__ __FILE__
17#endif
18
19/* Print stuff only on Debug Builds */
20#if DBG
21
22 /* These are always printed */
23 #define DPRINT1(fmt, ...) \
24 KdbPrintf("(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
25
26 /* These are printed only if NDEBUG is NOT defined */
27 #ifndef NDEBUG
28 #define DPRINT(fmt, ...) \
29 KdbPrintf("(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
30 #else
31#if defined(_MSC_VER)
32 #define DPRINT __noop
33#else
34 #define DPRINT(...) do { if(0) { KdbPrintf(__VA_ARGS__); } } while(0)
35#endif
36 #endif
37
38#else /* not DBG */
39
40 /* On non-debug builds, we never show these */
41#if defined(_MSC_VER)
42 #define DPRINT1 __noop
43 #define DPRINT __noop
44#else
45 #define DPRINT1(...) do { if(0) { KdbPrintf(__VA_ARGS__); } } while(0)
46 #define DPRINT(...) do { if(0) { KdbPrintf(__VA_ARGS__); } } while(0)
47#endif /* _MSC_VER */
48
49#endif /* not DBG */
50
51/* EOF */