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.

83 lines
2.1 KiB

  1. /*****************************************************************************\
  2. * MODULE: debug.h
  3. *
  4. * Header file for (debug.c).
  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-1997 Microsoft Corporation
  21. * Copyright (C) 1996-1997 Hewlett Packard
  22. *
  23. * History:
  24. * 07-Oct-1996 HWP-Guys Initiated port from win95 to winNT
  25. *
  26. \*****************************************************************************/
  27. #ifndef _INETPP_DEBUG_H
  28. #define _INETPP_DEBUG_H
  29. #ifdef DEBUG
  30. extern DWORD gdwDbgLevel;
  31. // Maximum size of debug string
  32. //
  33. #define DBG_MAX_TEXT 256
  34. // Debug output levels. By masking in the various levels, you can receive
  35. // all levels of output.
  36. //
  37. #define DBG_LEV_INFO 0x00000001
  38. #define DBG_LEV_CALLTREE 0x00000002
  39. #define DBG_LEV_WARN 0x00000004
  40. #define DBG_LEV_ERROR 0x00000008
  41. #define DBG_LEV_FATAL 0x00000010
  42. #define DBG_CACHE_TRACE 0x00000020
  43. #define DBG_CACHE_ERROR 0x00000040
  44. #define DBG_LEV_ALL 0x0000007F
  45. // Function prototype for debug-routine (debug.c)
  46. //
  47. VOID CDECL DbgMsgOut(
  48. LPCTSTR lpszMsgFormat,
  49. ...);
  50. LPTSTR DbgGetTime (void);
  51. VOID DbgMsg (LPCTSTR pszFormat, ...);
  52. // Handy macros for use throughout the source.
  53. //
  54. #define DBG_BREAKPOINT() DebugBreak();
  55. #define DBG_MSG(Lev, MsgArgs) {if (Lev & gdwDbgLevel) {DbgMsgOut MsgArgs;}}
  56. #define DBG_ASSERT(Expr, MsgArgs) {if (!Expr) {DbgMsgOut MsgArgs; DebugBreak();}}
  57. #define DBGMSGT(dwLevel, x) {if (dwLevel & gdwDbgLevel) {DbgMsg x;}}
  58. #else
  59. #define DBG_BREAKPOINT()
  60. #define DBG_MSG(Lev, MsgArgs)
  61. #define DBG_ASSERT(Expr, MsgArgs)
  62. #define DBGMSGT(dwLevel, x)
  63. #endif
  64. #endif