Suppress debug exceptions when running under native (lldb/gdb) debugger.
authorMike McLaughlin <mikem@microsoft.com>
Tue, 6 Oct 2015 23:44:07 +0000 (16:44 -0700)
committerMike McLaughlin <mikem@microsoft.com>
Tue, 6 Oct 2015 23:51:57 +0000 (16:51 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/187ca0f9bce9e113f06beb34d5c5a45aa9c7c0fe

src/coreclr/src/pal/src/exception/machexception.cpp

index d51c692..6296ebd 100644 (file)
@@ -133,9 +133,20 @@ static exception_mask_t GetExceptionMask()
 
     if (exMode == MachException_Uninitialized)
     {
+        exMode = MachException_Default;
+
         const char * exceptionSettings = getenv(PAL_MACH_EXCEPTION_MODE);
-        exMode = exceptionSettings
-            ? (MachExceptionMode)atoi(exceptionSettings) : MachException_Default;
+        if (exceptionSettings)
+        {
+            exMode = (MachExceptionMode)atoi(exceptionSettings);
+        }
+        else
+        {
+            if (PAL_IsDebuggerPresent())
+            {
+                exMode = MachException_SuppressDebugging;
+            }
+        }
     }
 
     exception_mask_t machExceptionMask = 0;