1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

Debug flag and test mode improvements

1. ifdef DEBUG -> defined(_DEBUG) || defined(DEBUG)
In VC++ compilers, the macro is "_DEBUG", not "DEBUG".

2. If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak.
For normal debug we set memcheck = false.
Please set memcheck = true if you want to test the cause of memory leaks.
This commit is contained in:
Daiyuu Nobori 2018-10-08 11:03:58 +09:00 committed by Davide Beatrici
parent 66b906378f
commit 8abcf3d0a9
8 changed files with 48 additions and 18 deletions

View File

@ -783,8 +783,11 @@ UINT SWExec()
MayaquaMinimalMode();
}
#ifdef DEBUG
InitMayaqua(true, true, 0, NULL);
#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG".
// If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak.
// For normal debug we set memcheck = false.
// Please set memcheck = true if you want to test the cause of memory leaks.
InitMayaqua(false, true, 0, NULL);
#else
InitMayaqua(false, false, 0, NULL);
#endif

View File

@ -4569,8 +4569,11 @@ void CALLBACK MsServiceDispatcher(DWORD argc, LPTSTR *argv)
//// Initialization
// Start of the Mayaqua
#ifdef DEBUG
InitMayaqua(true, true, 0, NULL);
#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG".
// If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak.
// For normal debug we set memcheck = false.
// Please set memcheck = true if you want to test the cause of memory leaks.
InitMayaqua(false, true, 0, NULL);
#else
InitMayaqua(false, false, 0, NULL);
#endif
@ -4748,8 +4751,11 @@ UINT MsService(char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop, UINT
}
// Start of the Mayaqua
#ifdef DEBUG
InitMayaqua(true, true, 0, NULL);
#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG".
// If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak.
// For normal debug we set memcheck = false.
// Please set memcheck = true if you want to test the cause of memory leaks.
InitMayaqua(false, true, 0, NULL);
#else
InitMayaqua(false, false, 0, NULL);
#endif

View File

@ -2766,7 +2766,10 @@ RESTART_PROCESS:
else if (argc >= 3 && StrCmpi(argv[1], UNIX_SVC_ARG_START) == 0 && StrCmpi(argv[2], UNIX_SVC_ARG_FOREGROUND) == 0)
{
#ifdef DEBUG
InitMayaqua(true, true, argc, argv);
// If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak.
// For normal debug we set memcheck = false.
// Please set memcheck = true if you want to test the cause of memory leaks.
InitMayaqua(false, true, argc, argv);
#else
InitMayaqua(false, false, argc, argv);
#endif
@ -2786,7 +2789,10 @@ void UnixServiceMain(int argc, char *argv[], char *name, SERVICE_FUNCTION *start
UINT mode = 0;
// Start of the Mayaqua
#ifdef DEBUG
InitMayaqua(true, true, argc, argv);
// If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak.
// For normal debug we set memcheck = false.
// Please set memcheck = true if you want to test the cause of memory leaks.
InitMayaqua(false, true, argc, argv);
#else
InitMayaqua(false, false, argc, argv);
#endif

View File

@ -143,8 +143,11 @@ int main(int argc, char *argv[])
SetConsoleTitleA(CEDAR_PRODUCT_STR " VPN Command Line Utility");
#endif // OS_WIN32
#ifdef DEBUG
InitMayaqua(true, true, argc, argv);
#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG".
// If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak.
// For normal debug we set memcheck = false.
// Please set memcheck = true if you want to test the cause of memory leaks.
InitMayaqua(false, true, argc, argv);
#else
InitMayaqua(false, false, argc, argv);
#endif

View File

@ -136,8 +136,11 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow)
{
InitProcessCallOnce();
#ifdef DEBUG
InitMayaqua(true, true, 0, NULL);
#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG".
// If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak.
// For normal debug we set memcheck = false.
// Please set memcheck = true if you want to test the cause of memory leaks.
InitMayaqua(false, true, 0, NULL);
#else
InitMayaqua(false, false, 0, NULL);
#endif

View File

@ -355,8 +355,11 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow)
{
InitProcessCallOnce();
#ifdef DEBUG
InitMayaqua(true, true, 0, NULL);
#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG".
// If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak.
// For normal debug we set memcheck = false.
// Please set memcheck = true if you want to test the cause of memory leaks.
InitMayaqua(false, true, 0, NULL);
#else
InitMayaqua(false, false, 0, NULL);
#endif

View File

@ -1635,13 +1635,16 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow)
{
INSTANCE *instance;
InitProcessCallOnce();
#ifdef DEBUG
#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG".
is_debug = true;
#else
is_debug = false;
#endif
MayaquaMinimalMode();
InitMayaqua(is_debug, is_debug, 0, NULL);
// If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak.
// For normal debug we set memcheck = false.
// Please set memcheck = true if you want to test the cause of memory leaks.
InitMayaqua(false, is_debug, 0, NULL);
InitCedar();
ViSetSkip();
ViLoadStringTables();

View File

@ -134,8 +134,11 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow)
{
InitProcessCallOnce();
#ifdef DEBUG
InitMayaqua(true, true, 0, NULL);
#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG".
// If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak.
// For normal debug we set memcheck = false.
// Please set memcheck = true if you want to test the cause of memory leaks.
InitMayaqua(false, true, 0, NULL);
#else
InitMayaqua(false, false, 0, NULL);
#endif