diff options
author | George Hazan <george.hazan@gmail.com> | 2013-08-02 19:08:33 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-08-02 19:08:33 +0000 |
commit | 655324f9dab084d47263f7510288ee3938d7f2e4 (patch) | |
tree | 3e014cbd3a229d47bce0dd81ff52660f3f1ac105 | |
parent | 685797951c34c866e27b5d24e3bdb9d7867356c5 (diff) |
/debug command line option to disable built-in exception handlers
git-svn-id: http://svn.miranda-ng.org/main/trunk@5553 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | src/mir_core/cmdline.cpp | 3 | ||||
-rw-r--r-- | src/mir_core/miranda.cpp | 1 | ||||
-rw-r--r-- | src/mir_core/miranda.h | 1 | ||||
-rw-r--r-- | src/mir_core/threads.cpp | 30 |
4 files changed, 26 insertions, 9 deletions
diff --git a/src/mir_core/cmdline.cpp b/src/mir_core/cmdline.cpp index 6e112b7e14..acda692e0f 100644 --- a/src/mir_core/cmdline.cpp +++ b/src/mir_core/cmdline.cpp @@ -79,6 +79,9 @@ MIR_CORE_DLL(void) CmdLine_Parse(LPTSTR ptszCmdLine) p--; // the cycle will wipe this space automatically
}
+
+ if ( CmdLine_GetOption( _T("debug")))
+ g_bDebugMode = true;
}
MIR_CORE_DLL(LPCTSTR) CmdLine_GetOption(const TCHAR* ptszParameter)
diff --git a/src/mir_core/miranda.cpp b/src/mir_core/miranda.cpp index 73c5c9d0be..571bbb811a 100644 --- a/src/mir_core/miranda.cpp +++ b/src/mir_core/miranda.cpp @@ -34,6 +34,7 @@ HINSTANCE hInst = 0; HANDLE hStackMutex, hThreadQueueEmpty;
DWORD mir_tls = 0;
+bool g_bDebugMode = false;
/////////////////////////////////////////////////////////////////////////////////////////
// module init
diff --git a/src/mir_core/miranda.h b/src/mir_core/miranda.h index 93c7201e6a..1525c1b792 100644 --- a/src/mir_core/miranda.h +++ b/src/mir_core/miranda.h @@ -40,6 +40,7 @@ void UninitProtocols(); extern HINSTANCE hInst;
extern HWND hAPCWindow;
extern HANDLE hStackMutex, hThreadQueueEmpty;
+extern bool g_bDebugMode;
/**** modules.cpp **********************************************************************/
diff --git a/src/mir_core/threads.cpp b/src/mir_core/threads.cpp index ddce70df8b..af61aa82f9 100644 --- a/src/mir_core/threads.cpp +++ b/src/mir_core/threads.cpp @@ -110,12 +110,16 @@ void __cdecl forkthread_r(void *arg) void *cookie = fa->arg;
Thread_Push((HINSTANCE)callercode);
SetEvent(fa->hEvent);
- __try
- {
+ if (g_bDebugMode)
callercode(cookie);
- }
- __except(pMirandaExceptFilter(GetExceptionCode(), GetExceptionInformation()))
- {
+ else {
+ __try
+ {
+ callercode(cookie);
+ }
+ __except(pMirandaExceptFilter(GetExceptionCode(), GetExceptionInformation()))
+ {
+ }
}
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
@@ -150,15 +154,23 @@ unsigned __stdcall forkthreadex_r(void * arg) Thread_Push((HINSTANCE)threadcode, fa->owner);
SetEvent(fa->hEvent);
- __try
- {
+ if (g_bDebugMode) {
if (owner)
rc = threadcodeex(owner, cookie);
else
rc = threadcode(cookie);
}
- __except(pMirandaExceptFilter(GetExceptionCode(), GetExceptionInformation()))
- {
+ else {
+ __try
+ {
+ if (owner)
+ rc = threadcodeex(owner, cookie);
+ else
+ rc = threadcode(cookie);
+ }
+ __except(pMirandaExceptFilter(GetExceptionCode(), GetExceptionInformation()))
+ {
+ }
}
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|