2001-04-23 20:19:27 +02:00
|
|
|
/*
|
|
|
|
* Debug API
|
|
|
|
*
|
|
|
|
* Copyright 2001 Francois Gouget.
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2001-04-23 20:19:27 +02:00
|
|
|
*/
|
|
|
|
#ifndef __WINE_CRTDBG_H_
|
|
|
|
#define __WINE_CRTDBG_H_
|
2008-12-11 22:37:34 +01:00
|
|
|
|
2019-08-09 17:32:04 +02:00
|
|
|
#include <corecrt.h>
|
2001-04-23 20:19:27 +02:00
|
|
|
|
|
|
|
/* The debug API is not implemented in Winelib.
|
|
|
|
* Redirect everything to the regular APIs.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define _CRT_WARN 0
|
|
|
|
#define _CRT_ERROR 1
|
|
|
|
#define _CRT_ASSERT 2
|
|
|
|
#define _CRT_ERRCNT 3
|
|
|
|
|
|
|
|
#define _FREE_BLOCK 0
|
|
|
|
#define _NORMAL_BLOCK 1
|
|
|
|
#define _CRT_BLOCK 2
|
|
|
|
#define _IGNORE_BLOCK 3
|
|
|
|
#define _CLIENT_BLOCK 4
|
|
|
|
#define _MAX_BLOCKS 5
|
|
|
|
|
2005-07-21 12:34:08 +02:00
|
|
|
#define _BLOCK_TYPE(block) (block & 0xFFFF)
|
|
|
|
#define _BLOCK_SUBTYPE(block) (block >> 16 & 0xFFFF)
|
2001-04-23 20:19:27 +02:00
|
|
|
|
|
|
|
typedef struct _CrtMemState
|
|
|
|
{
|
|
|
|
struct _CrtMemBlockHeader* pBlockHeader;
|
2009-05-23 11:38:59 +02:00
|
|
|
__msvcrt_ulong lCounts[_MAX_BLOCKS];
|
|
|
|
__msvcrt_ulong lSizes[_MAX_BLOCKS];
|
|
|
|
__msvcrt_ulong lHighWaterCount;
|
|
|
|
__msvcrt_ulong lTotalCount;
|
2001-04-23 20:19:27 +02:00
|
|
|
} _CrtMemState;
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _DEBUG
|
|
|
|
|
2002-09-24 05:04:45 +02:00
|
|
|
#define _ASSERT(expr) ((void)0)
|
|
|
|
#define _ASSERTE(expr) ((void)0)
|
|
|
|
#define _CrtDbgBreak() ((void)0)
|
2001-04-23 20:19:27 +02:00
|
|
|
|
2005-07-21 12:34:08 +02:00
|
|
|
#define _CrtCheckMemory() ((int)1)
|
|
|
|
#define _CrtDbgReport(...) ((int)0)
|
|
|
|
#define _CrtDumpMemoryLeaks() ((int)0)
|
2009-05-23 11:38:59 +02:00
|
|
|
#define _CrtSetBreakAlloc(a) ((__msvcrt_long)0)
|
2005-07-21 12:34:08 +02:00
|
|
|
#define _CrtSetDbgFlag(f) ((int)0)
|
|
|
|
#define _CrtSetDumpClient(f) ((void)0)
|
|
|
|
#define _CrtSetReportMode(t,m) ((int)0)
|
|
|
|
|
2001-04-23 20:19:27 +02:00
|
|
|
#else /* _DEBUG */
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#define _ASSERT(expr) assert(expr)
|
|
|
|
#define _ASSERTE(expr) assert(expr)
|
2020-04-27 04:25:22 +02:00
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#define _CrtDbgBreak() __debugbreak()
|
|
|
|
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
2001-04-23 20:19:27 +02:00
|
|
|
#define _CrtDbgBreak() __asm__ ("\tint $0x3\n")
|
|
|
|
#else
|
2002-09-24 05:04:45 +02:00
|
|
|
#define _CrtDbgBreak() ((void)0)
|
2001-04-23 20:19:27 +02:00
|
|
|
#endif
|
|
|
|
|
2008-06-11 23:08:19 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2005-07-21 12:34:08 +02:00
|
|
|
extern int _crtAssertBusy;
|
|
|
|
extern int _crtBreakAlloc;
|
|
|
|
extern int _crtDbgFlag;
|
|
|
|
|
2008-12-17 14:45:18 +01:00
|
|
|
int __cdecl _CrtCheckMemory(void);
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV _CrtDbgReport(int reportType, const char *filename, int linenumber,
|
2008-12-17 14:45:18 +01:00
|
|
|
const char *moduleName, const char *format, ...);
|
|
|
|
int __cdecl _CrtDumpMemoryLeaks(void);
|
2010-07-08 15:59:59 +02:00
|
|
|
int __cdecl _CrtSetBreakAlloc(int);
|
|
|
|
int __cdecl _CrtSetDbgFlag(int);
|
2008-12-17 14:45:18 +01:00
|
|
|
void *__cdecl _CrtSetDumpClient(void *dumpClient);
|
|
|
|
int __cdecl _CrtSetReportMode(int reportType, int reportMode);
|
2005-07-21 12:34:08 +02:00
|
|
|
|
2008-06-11 23:08:19 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-04-23 20:19:27 +02:00
|
|
|
#endif /* _DEBUG */
|
|
|
|
|
2002-09-24 05:04:45 +02:00
|
|
|
#define _CrtDoForAllClientObjects(f,c) ((void)0)
|
|
|
|
#define _CrtIsMemoryBlock(p,s,r,f,l) ((int)1)
|
|
|
|
#define _CrtIsValidHeapPointer(p) ((int)1)
|
|
|
|
#define _CrtIsValidPointer(p,s,a) ((int)1)
|
|
|
|
#define _CrtMemCheckpoint(s) ((void)0)
|
|
|
|
#define _CrtMemDifference(s1,s2,s3) ((int)0)
|
|
|
|
#define _CrtMemDumpAllObjectsSince(s) ((void)0)
|
|
|
|
#define _CrtMemDumpStatistics(s) ((void)0)
|
|
|
|
#define _CrtSetAllocHook(f) ((void)0)
|
2001-04-23 20:19:27 +02:00
|
|
|
|
|
|
|
#define _RPT0(t,m)
|
|
|
|
#define _RPT1(t,m,p1)
|
|
|
|
#define _RPT2(t,m,p1,p2)
|
|
|
|
#define _RPT3(t,m,p1,p2,p3)
|
|
|
|
#define _RPT4(t,m,p1,p2,p3,p4)
|
|
|
|
#define _RPTF0(t,m)
|
|
|
|
#define _RPTF1(t,m,p1)
|
|
|
|
#define _RPTF2(t,m,p1,p2)
|
|
|
|
#define _RPTF3(t,m,p1,p2,p3)
|
|
|
|
#define _RPTF4(t,m,p1,p2,p3,p4)
|
|
|
|
|
|
|
|
|
|
|
|
#define _malloc_dbg(s,t,f,l) malloc(s)
|
|
|
|
#define _calloc_dbg(c,s,t,f,l) calloc(c,s)
|
|
|
|
#define _expand_dbg(p,s,t,f,l) _expand(p,s)
|
|
|
|
#define _free_dbg(p,t) free(p)
|
|
|
|
#define _realloc_dbg(p,s,t,f,l) realloc(p,s)
|
|
|
|
|
|
|
|
#endif /* __WINE_CRTDBG_H */
|