📄 debugutil.h
字号:
/**
* @file debugutil.h
*
* @brief debugutil.h, v 1.0.0 2005/9/4 1:29:09 sunwang
*
* details here.
*
*
* @author sunwang <sunwangme@hotmail.com>
*/
#ifndef DEBUGUTIL_H
#define DEBUGUTIL_H
#include <stdio.h>
//sunwangme@hotmail.com,2007.3.27
//怎么判断缓冲区益处呀,使用_vsnprintf
/**
* @fn void DebugString( char *format, ... )
* @brief use OutputDebugString to print debug information when release,null when debug.
* @param format printf format
*/
#define _DEBUG_STRING
#ifdef _DEBUG_STRING
//The DBWIN_BUFFER, when present, is organized like this structure.
//The process ID shows where the message came from,
//and string data fills out the remainder of the 4k. By convention,
//a NUL byte is always included at the end of the message.
inline void DebugString( char* prefix,char *format, ... )
{
char buf[4096]={0};
strcpy(buf,prefix);
va_list vl;
va_start(vl,format);
int nSize = _vsnprintf((char*)buf+strlen(prefix),sizeof(buf)-strlen(prefix),format,vl);
if(nSize>0)
{
OutputDebugString(buf);
OutputDebugString("\n");
}
//sunwangme,2007.3.27,fixed
va_end(vl);
}
#else
inline void DebugString( char* prefix,char *format, ... )
{
}
#endif
#define TRACE DebugString
/**
* @fn ErrorBreak()
* @brief inject int 3 to code section,so we can run to debugger eg windbg.
*/
#ifdef _DEBUG_STRING
#define ErrorBreak() __asm int 3
#else
#define ErrorBreak()
#endif
#endif //DEBUGUTIL_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -