Leaked source code of windows server 2003
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.

57 lines
1.6 KiB

  1. //
  2. // dbgid.h
  3. //
  4. // debug macros
  5. //
  6. #ifndef DBGID_H
  7. #define DBGID_H
  8. #ifdef __cplusplus // "C" files can't handle "inline"
  9. #include "ciccs.h"
  10. extern CCicCriticalSectionStatic g_cs;
  11. //extern "C" BOOL Dbg_MemSetNameID(void *pv, const TCHAR *pszName, DWORD dwID);
  12. #ifdef DEBUG
  13. #define DBG_ID_DECLARE \
  14. static DWORD _s_Dbg_dwID; \
  15. static DWORD _s_Dbg_dwIDBreak; \
  16. static BOOL _s_Dbg_fBreak; \
  17. DWORD _Dbg_dwID;
  18. #define DBG_ID_INSTANCE(_class_) \
  19. DWORD _class_::_s_Dbg_dwID = 0; \
  20. DWORD _class_::_s_Dbg_dwIDBreak = 0; \
  21. BOOL _class_::_s_Dbg_fBreak = FALSE;
  22. #define Dbg_MemSetThisNameID(pszName) \
  23. EnterCriticalSection(g_cs); \
  24. _Dbg_dwID = ++_s_Dbg_dwID; \
  25. LeaveCriticalSection(g_cs); \
  26. Dbg_MemSetNameID(this, pszName, _Dbg_dwID); \
  27. if (_s_Dbg_fBreak && (_Dbg_dwID == _s_Dbg_dwIDBreak)) DebugBreak();
  28. #define Dbg_MemSetThisNameIDCounter(pszName, iCounter) \
  29. EnterCriticalSection(g_cs); \
  30. _Dbg_dwID = ++_s_Dbg_dwID; \
  31. LeaveCriticalSection(g_cs); \
  32. Dbg_MemSetNameIDCounter(this, pszName, _Dbg_dwID, iCounter); \
  33. if (_Dbg_dwID == _s_Dbg_dwIDBreak) DebugBreak();
  34. #else
  35. #define DBG_ID_DECLARE
  36. #define DBG_ID_INSTANCE(_class_)
  37. #define Dbg_MemSetNameIDCounter(pv, pszName, dwID, iCounter)
  38. #define Dbg_MemSetThisNameIDCounter(pszName, iCounter)
  39. #define Dbg_MemSetThisNameID(pszName)
  40. #endif // DEBUG
  41. #endif // __cplusplus // "C" files can't handle "inline"
  42. #endif // DBGID_H