1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-23 01:49: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(); MayaquaMinimalMode();
} }
#ifdef DEBUG #if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG".
InitMayaqua(true, true, 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, true, 0, NULL);
#else #else
InitMayaqua(false, false, 0, NULL); InitMayaqua(false, false, 0, NULL);
#endif #endif

View File

@ -4569,8 +4569,11 @@ void CALLBACK MsServiceDispatcher(DWORD argc, LPTSTR *argv)
//// Initialization //// Initialization
// Start of the Mayaqua // Start of the Mayaqua
#ifdef DEBUG #if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG".
InitMayaqua(true, true, 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, true, 0, NULL);
#else #else
InitMayaqua(false, false, 0, NULL); InitMayaqua(false, false, 0, NULL);
#endif #endif
@ -4748,8 +4751,11 @@ UINT MsService(char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop, UINT
} }
// Start of the Mayaqua // Start of the Mayaqua
#ifdef DEBUG #if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG".
InitMayaqua(true, true, 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, true, 0, NULL);
#else #else
InitMayaqua(false, false, 0, NULL); InitMayaqua(false, false, 0, NULL);
#endif #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) else if (argc >= 3 && StrCmpi(argv[1], UNIX_SVC_ARG_START) == 0 && StrCmpi(argv[2], UNIX_SVC_ARG_FOREGROUND) == 0)
{ {
#ifdef DEBUG #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 #else
InitMayaqua(false, false, argc, argv); InitMayaqua(false, false, argc, argv);
#endif #endif
@ -2786,7 +2789,10 @@ void UnixServiceMain(int argc, char *argv[], char *name, SERVICE_FUNCTION *start
UINT mode = 0; UINT mode = 0;
// Start of the Mayaqua // Start of the Mayaqua
#ifdef DEBUG #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 #else
InitMayaqua(false, false, argc, argv); InitMayaqua(false, false, argc, argv);
#endif #endif

View File

@ -143,8 +143,11 @@ int main(int argc, char *argv[])
SetConsoleTitleA(CEDAR_PRODUCT_STR " VPN Command Line Utility"); SetConsoleTitleA(CEDAR_PRODUCT_STR " VPN Command Line Utility");
#endif // OS_WIN32 #endif // OS_WIN32
#ifdef DEBUG #if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "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 #else
InitMayaqua(false, false, argc, argv); InitMayaqua(false, false, argc, argv);
#endif #endif

View File

@ -136,8 +136,11 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow)
{ {
InitProcessCallOnce(); InitProcessCallOnce();
#ifdef DEBUG #if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG".
InitMayaqua(true, true, 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, true, 0, NULL);
#else #else
InitMayaqua(false, false, 0, NULL); InitMayaqua(false, false, 0, NULL);
#endif #endif

View File

@ -355,8 +355,11 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow)
{ {
InitProcessCallOnce(); InitProcessCallOnce();
#ifdef DEBUG #if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG".
InitMayaqua(true, true, 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, true, 0, NULL);
#else #else
InitMayaqua(false, false, 0, NULL); InitMayaqua(false, false, 0, NULL);
#endif #endif

View File

@ -1635,13 +1635,16 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow)
{ {
INSTANCE *instance; INSTANCE *instance;
InitProcessCallOnce(); InitProcessCallOnce();
#ifdef DEBUG #if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG".
is_debug = true; is_debug = true;
#else #else
is_debug = false; is_debug = false;
#endif #endif
MayaquaMinimalMode(); 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(); InitCedar();
ViSetSkip(); ViSetSkip();
ViLoadStringTables(); ViLoadStringTables();

View File

@ -134,8 +134,11 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow)
{ {
InitProcessCallOnce(); InitProcessCallOnce();
#ifdef DEBUG #if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG".
InitMayaqua(true, true, 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, true, 0, NULL);
#else #else
InitMayaqua(false, false, 0, NULL); InitMayaqua(false, false, 0, NULL);
#endif #endif