@@ -4925,8 +4925,6 @@ DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionPointers,
49254925#endif
49264926
49274927 GCPROTECT_BEGIN (throwable);
4928- // BOOL IsStackOverflow = (throwable->GetMethodTable() == g_pStackOverflowExceptionClass);
4929- BOOL IsOutOfMemory = (throwable->GetMethodTable () == g_pOutOfMemoryExceptionClass);
49304928
49314929 const int buf_size = 128 ;
49324930 WCHAR buf[buf_size] = {0 };
@@ -4936,31 +4934,14 @@ DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionPointers,
49364934 {
49374935 EX_TRY
49384936 {
4939- // If this isn't ThreadAbortException, we want to print a stack trace to indicate why this thread abruptly
4940- // terminated. Exceptions kill threads rarely enough that an uncached name check is reasonable.
4941- BOOL dump = TRUE ;
4942-
4943- if (/* IsStackOverflow ||*/
4944- !pThread->DetermineIfGuardPagePresent () ||
4945- IsOutOfMemory)
4937+ if (!pThread->DetermineIfGuardPagePresent ())
49464938 {
49474939 // We have to be very careful. If we walk off the end of the stack, the process will just
49484940 // die. e.g. Exception.ToString both consume too much stack -- and can't
49494941 // be called here.
4950- dump = FALSE ;
4951-
4952- if (IsOutOfMemory)
4953- {
4954- PrintToStdErrA (" Out of memory.\n " );
4955- }
4956- else
4957- {
4958- PrintToStdErrA (" Stack overflow.\n " );
4959- }
4942+ PrintToStdErrA (" Stack overflow.\n " );
49604943 }
4961-
4962- // Finally, should we print the message?
4963- if (dump)
4944+ else
49644945 {
49654946 // this is stack heavy because of the CQuickWSTRBase, so we break it out
49664947 // and don't have to carry the weight through our other code paths.
@@ -4969,14 +4950,22 @@ DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionPointers,
49694950 }
49704951 EX_CATCH
49714952 {
4972- LOG ((LF_EH, LL_INFO10, " Exception occurred while processing uncaught exception\n " ));
4953+ if (throwable->GetMethodTable () == g_pOutOfMemoryExceptionClass)
4954+ {
4955+ // Try to print a short message at least.
4956+ PrintToStdErrA (" Out of memory.\n " );
4957+ }
4958+ else
4959+ {
4960+ LOG ((LF_EH, LL_INFO10, " Exception occurred while processing uncaught exception\n " ));
49734961
4974- _ASSERTE (buf_size > 6 );
4975- wcscpy_s (buf, buf_size, W (" \n " ));
4976- UtilLoadStringRC (IDS_EE_EXCEPTION_TOSTRING_FAILED, buf + 4 , buf_size - 6 );
4977- wcscat_s (buf, buf_size, W (" \n " ));
4962+ _ASSERTE (buf_size > 6 );
4963+ wcscpy_s (buf, buf_size, W (" \n " ));
4964+ UtilLoadStringRC (IDS_EE_EXCEPTION_TOSTRING_FAILED, buf + 4 , buf_size - 6 );
4965+ wcscat_s (buf, buf_size, W (" \n " ));
49784966
4979- PrintToStdErrW (buf);
4967+ PrintToStdErrW (buf);
4968+ }
49804969 }
49814970 EX_END_CATCH
49824971 }
0 commit comments