📄 crtdbg.h
字号:
);
#endif /* !defined (_M_CEE_PURE) */
/* _CrtSetReportHook[[W]2]:
* For IJW, we need 2 versions: 1 for clrcall and one for cdecl.
* For pure and native, we just need clrcall and cdecl, respectively.
*/
#if !defined (_M_CEE_PURE)
_CRTIMP _CRT_REPORT_HOOK __cdecl _CrtSetReportHook(
_In_opt_ _CRT_REPORT_HOOK _PFnNewHook
);
_CRTIMP int __cdecl _CrtSetReportHook2(
_In_ int _Mode,
_In_opt_ _CRT_REPORT_HOOK _PFnNewHook
);
_CRTIMP int __cdecl _CrtSetReportHookW2(
_In_ int _Mode,
_In_opt_ _CRT_REPORT_HOOKW _PFnNewHook
);
#else /* !defined (_M_CEE_PURE) */
extern "C++"
{
_MRTIMP _CRT_REPORT_HOOK __cdecl _CrtSetReportHook(
_In_opt_ _CRT_REPORT_HOOK _PFnNewHook
);
_MRTIMP int __cdecl _CrtSetReportHook2(
_In_ int _Mode,
_In_opt_ _CRT_REPORT_HOOK _PFnNewHook
);
_MRTIMP int __cdecl _CrtSetReportHookW2(
_In_ int _Mode,
_In_opt_ _CRT_REPORT_HOOKW _PFnNewHook
);
}
#endif /* !defined (_M_CEE_PURE) */
_CRTIMP int __cdecl _CrtSetReportMode(
_In_ int _ReportType,
_In_ int _ReportMode
);
_CRTIMP _HFILE __cdecl _CrtSetReportFile(
_In_ int _ReportType,
_In_opt_ _HFILE _ReportFile
);
_CRTIMP int __cdecl _CrtDbgReport(
_In_ int _ReportType,
_In_opt_z_ const char * _Filename,
_In_ int _Linenumber,
_In_opt_z_ const char * _ModuleName,
_In_opt_z_ const char * _Format,
...);
_CRTIMP size_t __cdecl _CrtSetDebugFillThreshold(
_In_ size_t _NewDebugFillThreshold
);
#if !defined (_NATIVE_WCHAR_T_DEFINED) && defined (_M_CEE_PURE)
extern "C++"
#endif /* !defined (_NATIVE_WCHAR_T_DEFINED) && defined (_M_CEE_PURE) */
_CRTIMP int __cdecl _CrtDbgReportW(
_In_ int _ReportType,
_In_opt_z_ const wchar_t * _Filename,
_In_ int _LineNumber,
_In_opt_z_ const wchar_t * _ModuleName,
_In_opt_z_ const wchar_t * _Format,
...);
/* Asserts */
/* We use !! below to ensure that any overloaded operators used to evaluate expr do not end up at operator || */
#define _ASSERT_EXPR(expr, msg) \
(void) ((!!(expr)) || \
(1 != _CrtDbgReportW(_CRT_ASSERT, _CRT_WIDE(__FILE__), __LINE__, NULL, msg)) || \
(_CrtDbgBreak(), 0))
#ifndef _ASSERT
#define _ASSERT(expr) _ASSERT_EXPR((expr), NULL)
#endif /* _ASSERT */
#ifndef _ASSERTE
#define _ASSERTE(expr) _ASSERT_EXPR((expr), _CRT_WIDE(#expr))
#endif /* _ASSERTE */
/*
We retain _ASSERT_BASE solely for backwards compatibility with those who used it even though they
should not have done so since it was not documented.
*/
#ifndef _ASSERT_BASE
#define _ASSERT_BASE _ASSERT_EXPR
#endif /* _ASSERT_BASE */
/* Reports with no file/line info */
#define _RPT_BASE(args) \
(void) ((1 != _CrtDbgReport args) || \
(_CrtDbgBreak(), 0))
#define _RPT_BASE_W(args) \
(void) ((1 != _CrtDbgReportW args) || \
(_CrtDbgBreak(), 0))
#define _RPT0(rptno, msg) \
_RPT_BASE((rptno, NULL, 0, NULL, "%s", msg))
#define _RPTW0(rptno, msg) \
_RPT_BASE_W((rptno, NULL, 0, NULL, L"%s", msg))
#define _RPT1(rptno, msg, arg1) \
_RPT_BASE((rptno, NULL, 0, NULL, msg, arg1))
#define _RPTW1(rptno, msg, arg1) \
_RPT_BASE_W((rptno, NULL, 0, NULL, msg, arg1))
#define _RPT2(rptno, msg, arg1, arg2) \
_RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2))
#define _RPTW2(rptno, msg, arg1, arg2) \
_RPT_BASE_W((rptno, NULL, 0, NULL, msg, arg1, arg2))
#define _RPT3(rptno, msg, arg1, arg2, arg3) \
_RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3))
#define _RPTW3(rptno, msg, arg1, arg2, arg3) \
_RPT_BASE_W((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3))
#define _RPT4(rptno, msg, arg1, arg2, arg3, arg4) \
_RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4))
#define _RPTW4(rptno, msg, arg1, arg2, arg3, arg4) \
_RPT_BASE_W((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4))
#define _RPT5(rptno, msg, arg1, arg2, arg3, arg4, arg5) \
_RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4, arg5))
#define _RPTW5(rptno, msg, arg1, arg2, arg3, arg4, arg5) \
_RPT_BASE_W((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4, arg5))
/* Reports with file/line info */
#define _RPTF0(rptno, msg) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, "%s", msg))
#define _RPTFW0(rptno, msg) \
_RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, L"%s", msg))
#define _RPTF1(rptno, msg, arg1) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1))
#define _RPTFW1(rptno, msg, arg1) \
_RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, arg1))
#define _RPTF2(rptno, msg, arg1, arg2) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2))
#define _RPTFW2(rptno, msg, arg1, arg2) \
_RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, arg1, arg2))
#define _RPTF3(rptno, msg, arg1, arg2, arg3) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3))
#define _RPTFW3(rptno, msg, arg1, arg2, arg3) \
_RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, arg1, arg2, arg3))
#define _RPTF4(rptno, msg, arg1, arg2, arg3, arg4) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3, arg4))
#define _RPTFW4(rptno, msg, arg1, arg2, arg3, arg4) \
_RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, arg1, arg2, arg3, arg4))
#define _RPTF5(rptno, msg, arg1, arg2, arg3, arg4, arg5) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3, arg4, arg5))
#define _RPTFW5(rptno, msg, arg1, arg2, arg3, arg4, arg5) \
_RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, arg1, arg2, arg3, arg4, arg5))
#if !defined (_CRT_PORTABLE)
#define _CrtDbgBreak() __debugbreak()
#else /* !defined (_CRT_PORTABLE) */
_CRTIMP void __cdecl _CrtDbgBreak(
void
);
#endif /* !defined (_CRT_PORTABLE) */
/****************************************************************************
*
* Heap routines
*
***************************************************************************/
#ifdef _CRTDBG_MAP_ALLOC
#define malloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define calloc(c, s) _calloc_dbg(c, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define realloc(p, s) _realloc_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _recalloc(p, c, s) _recalloc_dbg(p, c, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _expand(p, s) _expand_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define free(p) _free_dbg(p, _NORMAL_BLOCK)
#define _msize(p) _msize_dbg(p, _NORMAL_BLOCK)
#define _aligned_msize(p, a, o) _aligned_msize_dbg(p, a, o)
#define _aligned_malloc(s, a) _aligned_malloc_dbg(s, a, __FILE__, __LINE__)
#define _aligned_realloc(p, s, a) _aligned_realloc_dbg(p, s, a, __FILE__, __LINE__)
#define _aligned_recalloc(p, c, s, a) _aligned_recalloc_dbg(p, c, s, a, __FILE__, __LINE__)
#define _aligned_offset_malloc(s, a, o) _aligned_offset_malloc_dbg(s, a, o, __FILE__, __LINE__)
#define _aligned_offset_realloc(p, s, a, o) _aligned_offset_realloc_dbg(p, s, a, o, __FILE__, __LINE__)
#define _aligned_offset_recalloc(p, c, s, a, o) _aligned_offset_recalloc_dbg(p, c, s, a, o, __FILE__, __LINE__)
#define _aligned_free(p) _aligned_free_dbg(p)
#define _malloca(s) _malloca_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _freea(p) _freea_dbg(p, _NORMAL_BLOCK)
#define _strdup(s) _strdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _wcsdup(s) _wcsdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _mbsdup(s) _strdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _tempnam(s1, s2) _tempnam_dbg(s1, s2, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _wtempnam(s1, s2) _wtempnam_dbg(s1, s2, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _fullpath(s1, s2, le) _fullpath_dbg(s1, s2, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _wfullpath(s1, s2, le) _wfullpath_dbg(s1, s2, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _getcwd(s, le) _getcwd_dbg(s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _wgetcwd(s, le) _wgetcwd_dbg(s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _getdcwd(d, s, le) _getdcwd_dbg(d, s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _wgetdcwd(d, s, le) _wgetdcwd_dbg(d, s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _getdcwd_nolock(d, s, le) _getdcwd_lk_dbg(d, s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _wgetdcwd_nolock(d, s, le) _wgetdcwd_lk_dbg(d, s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _dupenv_s(ps1, size, s2) _dupenv_s_dbg(ps1, size, s2, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _wdupenv_s(ps1, size, s2) _wdupenv_s_dbg(ps1, size, s2, _NORMAL_BLOCK, __FILE__, __LINE__)
#if !__STDC__
#define strdup(s) _strdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define wcsdup(s) _wcsdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define tempnam(s1, s2) _tempnam_dbg(s1, s2, _NORMAL_BLOCK, __FILE__, __LINE__)
#define getcwd(s, le) _getcwd_dbg(s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#endif /* !__STDC__ */
#endif /* _CRTDBG_MAP_ALLOC */
#ifndef _INTERNAL_IFSTRIP_
#if defined (_DLL) && defined (_M_IX86)
/* Retained for compatibility with VC++ 5.0 and earlier versions */
_CRTIMP long * __cdecl __p__crtBreakAlloc(void);
#endif /* defined (_DLL) && defined (_M_IX86) */
#endif /* _INTERNAL_IFSTRIP_ */
#if !defined (_M_CEE_PURE)
_CRTIMP extern long _crtBreakAlloc; /* Break on this allocation */
#endif /* !defined (_M_CEE_PURE) */
_CRTIMP long __cdecl _CrtSetBreakAlloc(
_In_ long _BreakAlloc
);
/*
* Prototypes for malloc, free, realloc, etc are in malloc.h
*/
_Check_return_ _Ret_opt_bytecap_(_Size) _CRTIMP void * __cdecl _malloc_dbg(
_In_ size_t _Size,
_In_ int _BlockType,
_In_opt_z_ const char * _Filename,
_In_ int _LineNumber
);
_Check_return_ _Ret_opt_bytecap_x_(_Count*_Size) _CRTIMP void * __cdecl _calloc_dbg(
_In_ size_t _Count,
_In_ size_t _Size,
_In_ int _BlockType,
_In_opt_z_ const char * _Filename,
_In_ int _LineNumber
);
_Success_(return!=0)
_Check_return_ _Ret_opt_bytecap_(_NewSize) _CRTIMP void * __cdecl _realloc_dbg(
_Post_ptr_invalid_ void * _Memory,
_In_ size_t _NewSize,
_In_ int _BlockType,
_In_opt_z_ const char * _Filename,
_In_ int _LineNumber
);
_Success_(return!=0)
_Check_return_ _Ret_opt_bytecap_x_(_NumOfElements*_SizeOfElements) _CRTIMP void * __cdecl _recalloc_dbg
(
_Post_ptr_invalid_ void * _Memory,
_In_ size_t _NumOfElements,
_In_ size_t _SizeOfElements,
_In_ int _BlockType,
_In_opt_z_ const char * _Filename,
_In_ int _LineNumber
);
_Check_return_ _Ret_opt_bytecap_(_NewSize) _CRTIMP void * __cdecl _expand_dbg(
_Pre_notnull_ void * _Memory,
_In_ size_t _NewSize,
_In_ int _BlockType,
_In_opt_z_ const char * _Filename,
_In_ int _LineNumber
);
_CRTIMP void __cdecl _free_dbg(
_Post_ptr_invalid_ void * _Memory,
_In_ int _BlockType
);
_CRTIMP size_t __cdecl _msize_dbg (
_Pre_notnull_ void * _Memory,
_In_ int _BlockType
);
_CRTIMP size_t __cdecl _aligned_msize_dbg (
_Pre_notnull_ void * _Memory,
_In_ size_t _Alignment,
_In_ size_t _Offset
);
_Check_return_ _Ret_opt_bytecap_(_Size) _CRTIMP void * __cdecl _aligned_malloc_dbg(
_In_ size_t _Size,
_In_ size_t _Alignment,
_In_opt_z_ const char * _Filename,
_In_ int _LineNumber
);
_Success_(return!=0)
_Check_return_ _Ret_opt_bytecap_(_NewSize) _CRTIMP void * __cdecl _aligned_realloc_dbg(
_Post_ptr_invalid_ void * _Memory,
_In_ size_t _NewSize,
_In_ size_t _Alignment,
_In_opt_z_ const char * _Filename,
_In_ int _LineNumber
);
_Success_(return!=0)
_Check_return_ _Ret_opt_bytecap_x_(_NumOfElements*_SizeOfElements) _CRTIMP void * __cdecl _aligned_recalloc_dbg
(
_Post_ptr_invalid_ void * _Memory,
_In_ size_t _NumOfElements,
_In_ size_t _SizeOfElements,
_In_ size_t _Alignment,
_In_opt_z_ const char * _Filename,
_In_ int _LineNumber
);
_Check_return_ _Ret_opt_bytecap_(_Size) _CRTIMP void * __cdecl _aligned_offset_malloc_dbg(
_In_ size_t _Size,
_In_ size_t _Alignment,
_In_ size_t _Offset,
_In_opt_z_ const char * _Filename,
_In_ int _LineNumber
);
_Success_(return!=0)
_Check_return_ _Ret_opt_bytecap_(_NewSize) _CRTIMP void * __cdecl _aligned_offset_realloc_dbg(
_Post_ptr_invalid_ void * _Memory,
_In_ size_t _NewSize,
_In_ size_t _Alignment,
_In_ size_t _Offset,
_In_opt_z_ const char * _Filename,
_In_ int _LineNumber
);
_Success_(return!=0)
_Check_return_ _Ret_opt_bytecap_x_(_NumOfElements*_SizeOfElements) _CRTIMP void * __cdecl _aligned_offset_recalloc_dbg
(
_Post_ptr_invalid_ void * _Memory,
_In_ size_t _NumOfElements,
_In_ size_t _SizeOfElements,
_In_ size_t _Alignment,
_In_ size_t _Offset,
_In_opt_z_ const char * _Filename,
_In_ int _LineNumber
);
_CRTIMP void __cdecl _aligned_free_dbg(
_Post_ptr_invalid_ void * _Memory
);
_Check_return_ _Ret_opt_z_ _CRTIMP char * __cdecl _strdup_dbg(
_In_opt_z_ const char * _Str,
_In_ int _BlockType,
_In_opt_z_ const char * _Filename,
_In_ int _LineNumber
);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -