Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.8 KiB

  1. /*****************************************************************************\
  2. * MODULE: debug.h
  3. *
  4. * Header file for (debug.cxx).
  5. *
  6. * Double braces are needed for output macros.
  7. *
  8. * DBGMSG(DBG_LEV_ERROR, ("Error code %d", Error));
  9. *
  10. * This is because we can't use variable parameter lists in macros.
  11. * The statement gets pre-processed to a semi-colon in non-debug mode.
  12. *
  13. * Set the global variable GLOBAL_DEBUG_FLAGS via the debugger.
  14. * Setting the flag in the low word causes that level to be printed;
  15. * setting the high word causes a break into the debugger.
  16. * E.g. setting it to 0x00040006 will print out all warning and error
  17. * messages, and break on errors.
  18. *
  19. *
  20. * Copyright (C) 1996-1998 Microsoft Corporation.
  21. * Copyright (C) 1996-1998 Hewlett Packard Company.
  22. *
  23. * History:
  24. * 07-Oct-1996 HWP-Guys Initiated port from win95 to winNT
  25. *
  26. \*****************************************************************************/
  27. #ifdef DEBUG
  28. extern DWORD gdwDbgLevel;
  29. // Maximum size of debug string
  30. //
  31. #define DBG_MAX_TEXT 256
  32. // Debug output levels. By masking in the various levels, you can receive
  33. // all levels of output.
  34. //
  35. #define DBG_LEV_INFO 0x00000001
  36. #define DBG_LEV_CALLTREE 0x00000002
  37. #define DBG_LEV_WARN 0x00000004
  38. #define DBG_LEV_ERROR 0x00000008
  39. #define DBG_LEV_FATAL 0x00000010
  40. #define DBG_LEV_ALL 0x0000001F
  41. // Function prototype for debug-routine (debug.c)
  42. //
  43. VOID CDECL DbgMsgOut(
  44. LPCTSTR lpszMsgFormat,
  45. ...);
  46. // Handy macros for use throughout the source.
  47. //
  48. #define DBG_BREAKPOINT() DebugBreak();
  49. #define DBG_MSG(Lev, MsgArgs) {if (Lev & gdwDbgLevel) {DbgMsgOut MsgArgs;}}
  50. #define DBG_ASSERT(Expr, MsgArgs) {if (!Expr) {DbgMsgOut MsgArgs; DebugBreak();}}
  51. #else
  52. #define DBG_BREAKPOINT()
  53. #define DBG_MSG(Lev, MsgArgs)
  54. #define DBG_ASSERT(Expr, MsgArgs)
  55. #endif