52 #ifndef _DEBUG_HELPER_H_INCLUDED_ 53 #define _DEBUG_HELPER_H_INCLUDED_ 100 DebugLevel_Minimal = 1,
101 DebugLevel_Light = 2,
102 DebugLevel_Medium = 3,
103 DebugLevel_Heavy = 4,
104 DebugLevel_Chatty = 5,
105 DebugLevel_Verbose = 6,
106 DebugLevel_Excessive = 7,
107 DebugLevel_MAXIMUM = 7,
112 DebugSubSystem_ALL = 0,
113 DebugSubSystem_RESTRICT = 0x80000000,
114 DebugSubSystem_BITSHIFT = 3,
115 DebugSubSystem_Init = 0x00000008,
116 DebugSubSystem_Application = 0x00000010,
117 DebugSubSystem_Window = 0x00000020,
118 DebugSubSystem_Menu = 0x00000040,
119 DebugSubSystem_Event = 0x00000080,
120 DebugSubSystem_Dialog = 0x00000100,
121 DebugSubSystem_DialogCtrl = 0x00000200,
122 DebugSubSystem_Frame = 0x00000400,
123 DebugSubSystem_Keyboard = 0x00000800,
124 DebugSubSystem_Mouse = 0x00001000,
125 DebugSubSystem_Font = 0x00002000,
126 DebugSubSystem_Settings = 0x00004000,
127 DebugSubSystem_Selection = 0x00008000,
128 DebugSubSystem_Pixmap = 0x00010000,
129 DebugSubSystem_Expose = 0x00020000,
130 DebugSubSystem_EditWindow = 0x00040000,
131 DebugSubSystem_ScrollBar = 0x00080000,
132 DebugSubSystem_DrawText = 0x00100000,
133 DebugSubSystem_Clipboard = 0x00200000,
134 DebugSubSystem_TextObject = 0x00400000,
137 DebugSubSystem_RESERVED2 = 0x00800000,
138 DebugSubSystem_RESERVED3 = 0x01000000,
139 DebugSubSystem_RESERVED4 = 0x02000000,
140 DebugSubSystem_RESERVED5 = 0x04000000,
141 DebugSubSystem_RESERVED6 = 0x08000000,
142 DebugSubSystem_RESERVED7 = 0x10000000,
143 DebugSubSystem_RESERVED8 = 0x20000000,
144 DebugSubSystem_RESERVED9 = 0x40000000,
145 DebugSubSystem_MAX = 0x40000000,
147 DebugSubSystem_MASK = ~7L
184 #if defined(__GNUC__) || defined(_MSVC_VER) 189 return iWBDebugLevel;
191 #else // !defined(__GNUC__) && !defined(_MSVC_VER) 193 #endif // defined(__GNUC__) || defined(_MSVC_VER) 212 void WBDebugPrint(
const char *pFmt, ...) __attribute__ ((format(printf, 1, 2)));
233 void WBDebugDump(
const char *szTitle,
void *pData,
int cbData);
299 #if defined(__GNUC__) || defined(_MSVC_VER) 304 if(
WB_LIKELY((iWBDebugLevel & DebugLevel_MASK) < (dwLevel & DebugLevel_MASK)))
311 if(!(dwLevel & DebugSubSystem_MASK) )
319 if(((dwLevel & DebugSubSystem_MASK) & (iWBDebugLevel & DebugSubSystem_MASK))
328 #else // !defined(__GNUC__) && !defined(_MSVC_VER) 330 #endif // defined(__GNUC__) || defined(_MSVC_VER) 337 #define WB_DEBUG_PRINT(...) 338 #define WB_DEBUG_DUMP(L,X,Y,Z) 339 #define WB_IF_DEBUG_LEVEL(L) if(0) 340 #define WB_DEFINE_PROFILE(__name) 341 #define WB_ENABLE_PROFILE(__name,__desc) 342 #define WB_START_PROFILE(__name) 343 #define WB_STOP_PROFILE(__name) 364 #define WB_DEBUG_PRINT(L, ...) \ 365 WB_IF_DEBUG_LEVEL(L) { WBDebugPrint(__VA_ARGS__); } 385 #define WB_DEBUG_DUMP(L,X,Y,Z) \ 386 WB_IF_DEBUG_LEVEL(L) { WBDebugDump(X,Y,Z); } 404 #define WB_IF_DEBUG_LEVEL(L) if(WBCheckDebugLevel((L))) 414 #define WB_DEFINE_PROFILE(__name) static int __wb_profile_##__name = -1 426 #define WB_ENABLE_PROFILE(__name,__desc) { if(__wb_profile_##__name < 0) \ 427 __wb_profile_##__name = WBRegisterProfileVar(__FILE__, __LINE__, __FUNCTION__, \ 428 WB_STRINGIZE(__name), __desc); } 439 #define WB_START_PROFILE(__name) WBStartProfile(__wb_profile_##__name) 450 #define WB_STOP_PROFILE(__name) WBStopProfile(__wb_profile_##__name) 454 int WBRegisterProfileVar(
const char *szFile,
WB_INT32 nLine,
const char *szFunction,
const char *szName,
const char *szDesc);
455 void WBStartProfile(
int nProfileID);
456 void WBStopProfile(
int nProfileID);
457 void WBDumpProfileData(
void);
467 #define WB_WARN_PRINT(...) WB_DEBUG_PRINT(DebugLevel_WARN, __VA_ARGS__) 474 #define WB_ERROR_PRINT(...) WB_DEBUG_PRINT(DebugLevel_ERROR, __VA_ARGS__) 485 #define WB_WARN_DUMP(X,Y,Z) WB_DEBUG_DUMP(DebugLevel_WARN, X,Y,Z) 496 #define WB_ERROR_DUMP(X,Y,Z) WB_DEBUG_DUMP(DebugLevel_ERROR, X,Y,Z) 503 #endif // __cplusplus 505 #endif // _DEBUG_HELPER_H_INCLUDED_
DebugLevel
Debug level enumeration.
static __inline__ int WBCheckDebugLevel(WB_UINT64 dwLevel)
Check specified debug level against the value returned by WBGetDebugLevel() and return non-zero for a...
void void WBDebugDump(const char *szTitle, void *pData, int cbData)
conditionally dumps binary data to debug message output
void WBSetDebugLevel(unsigned int iLevel)
set debug level
void WBDebugDumpEvent(XEvent *pEvent)
dumps the contents of an XEvent
void WBDebugDumpGC(Display *pDisplay, WBGC hGC)
dumps a GC's settings
struct s_WBGC * WBGC
internal wrapper struct for GC with local cache
void WBDebugPrint(const char *pFmt,...) __attribute__((format(printf
conditional debug message output
internal wrapper struct for GC with local cache
void WBDebugDumpRegion(Region hRgn, int bRotate)
dumps contents of a region
static __inline__ WB_UINT64 WBGetDebugLevel(void)
Returns the current debug level assigned by WBSetDebugLevel.