11 #ifndef _Debug_h_incl_ 12 #define _Debug_h_incl_ 48 #ifdef _MSC_VER // MSVC allows concatenation of the __FUNCTION__ value. 49 #define _F(s) _T("[") _T(__FUNCTION__) _T("] ") _T(s) 50 #else //__GNUC__ does not. 51 #if 911 // NOTE: This one only works in var-arg param list.. 54 #define _F(s) _T("[%s] ") _T(s), __func__ 73 void __cdecl
DPrint(
int Level,
CSTR Fmt, ... );
162 extern volatile ULONG nDPrintSkipped; // Nr of skipped (due to re-entry) DPrint calls. 169 #define DP_StdFailMsg( What ) \ 170 DPrint( DP_ERROR, What _T(" failed: %s\n"), SysErrorMsg() ) 172 #ifdef _DEBUG //---------------------------------------------------------------- 188 #ifdef _MSC_VER // Later on, an intrinsic came along.. 189 #define _BREAK __debugbreak() 191 #define _BREAK DebugBreak() 193 #else // Break *here*, not in DebugBreak() 196 #define _BREAK DebugBreak() 198 #define _BREAK __asm Int 3 202 #define BREAK_IF( cond ) if (cond) _BREAK 209 if (IsDebuggerPresent()) _BREAK; \ 210 else MessageBox( NULL, \ 211 _T("Debugging Breakpoint:\nNo debugger present.. You may want to attach one now."), \ 212 dbg_Name, MB_OK| MB_ICONSTOP ) 214 #define DBGBREAK( Msg ) OutputDebugString( Msg ); BREAK() 216 #define TRACE(_lvl,...) DPrint(_lvl,__VA_ARGS__) 217 #define _TRACE(_va_) DPrint##_va_ 224 #define TRACEX(_lvl,_fmt,...) DPrint(_lvl,_F(_fmt" (%s:%u)\n"),__VA_ARGS__,__FILE__,__LINE__) 227 #define TRACE_IF(cond,...) if (cond) DPrint( __VA_ARGS__ ) 228 #define TRACEX_IF(_cond,_lvl,_fmt,...) if (_cond) DPrint(_lvl,_fmt" (%s:%u)\n",__VA_ARGS__,__FILE__,__LINE__) 233 #define ERROR_TRACE(What) DP_StdFailMsg( What ) 236 #define IF_DEBUG( code ) code 239 #else // NDEBUG //-------------------------------------------------------------- 242 #define BREAK_IF(cond) 244 #define DBGBREAK(msg) 248 #define TRACE_IF(cond,...) 249 #define TRACEX_IF(...) 250 #define ERROR_TRACE(what) 254 #define IF_DEBUG( code ) 256 #endif //----------------------------------------------------------------------- 260 #endif //ndef _Debug_h_incl_
void __cdecl DPrint(int Level, CSTR Fmt,...)
HANDLE OpenLogFile(CSTR Name, bool Append)
bool SetLastErrorFromNtStatus(NTSTATUS Status)
int SetDebugLevel(int Level)
CSTR SysErrorMsg(DWORD Err=0, TSTR Buf=NULL, UINT Length=0)
CSTR NtErrorMsg(NTSTATUS Status=0, TSTR Buf=NULL, UINT Size=0)
Common include; Added types, small "ubiquitous" utilities, et c.
CSTR DefaultLogFileName(HMODULE hModule)
ACSTR GetWinMsgName(WORD msgId)
ACSTR GetExceptionName(DWORD xCode)