reactos/ntoskrnl/kdbg/debug.h
Hermès Bélusca-Maïto 9808d32f4a
[NTOS:KDBG] Use local KdbPrintf function for DPRINT1 instead of DbgPrint...
... that would otherwise cause a debugger re-entry.

Also use KdbPuts/Printf instead of KdpDprintf that won't be available
once KDBG is moved out of it.
2023-04-12 19:30:56 +02:00

52 lines
1.3 KiB
C

/*
* PROJECT: ReactOS KDBG Kernel Debugger
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Useful debugging macros
* COPYRIGHT: Copyright 2023 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
*/
/*
* NOTE: Define NDEBUG before including this header
* to disable debugging macros.
*/
#pragma once
#ifndef __RELFILE__
#define __RELFILE__ __FILE__
#endif
/* Print stuff only on Debug Builds */
#if DBG
/* These are always printed */
#define DPRINT1(fmt, ...) \
KdbPrintf("(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
/* These are printed only if NDEBUG is NOT defined */
#ifndef NDEBUG
#define DPRINT(fmt, ...) \
KdbPrintf("(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
#else
#if defined(_MSC_VER)
#define DPRINT __noop
#else
#define DPRINT(...) do { if(0) { KdbPrintf(__VA_ARGS__); } } while(0)
#endif
#endif
#else /* not DBG */
/* On non-debug builds, we never show these */
#if defined(_MSC_VER)
#define DPRINT1 __noop
#define DPRINT __noop
#else
#define DPRINT1(...) do { if(0) { KdbPrintf(__VA_ARGS__); } } while(0)
#define DPRINT(...) do { if(0) { KdbPrintf(__VA_ARGS__); } } while(0)
#endif /* _MSC_VER */
#endif /* not DBG */
/* EOF */