debugutil.h
来自「概述:数据的纵向收集」· C头文件 代码 · 共 63 行
H
63 行
/**
* @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 + =
减小字号Ctrl + -
显示快捷键?