@@ -4925,8 +4925,6 @@ DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionPointers,
4925
4925
#endif
4926
4926
4927
4927
GCPROTECT_BEGIN (throwable);
4928
- // BOOL IsStackOverflow = (throwable->GetMethodTable() == g_pStackOverflowExceptionClass);
4929
- BOOL IsOutOfMemory = (throwable->GetMethodTable () == g_pOutOfMemoryExceptionClass);
4930
4928
4931
4929
const int buf_size = 128 ;
4932
4930
WCHAR buf[buf_size] = {0 };
@@ -4936,31 +4934,14 @@ DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionPointers,
4936
4934
{
4937
4935
EX_TRY
4938
4936
{
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 ())
4946
4938
{
4947
4939
// We have to be very careful. If we walk off the end of the stack, the process will just
4948
4940
// die. e.g. Exception.ToString both consume too much stack -- and can't
4949
4941
// 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 " );
4960
4943
}
4961
-
4962
- // Finally, should we print the message?
4963
- if (dump)
4944
+ else
4964
4945
{
4965
4946
// this is stack heavy because of the CQuickWSTRBase, so we break it out
4966
4947
// and don't have to carry the weight through our other code paths.
@@ -4969,14 +4950,22 @@ DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionPointers,
4969
4950
}
4970
4951
EX_CATCH
4971
4952
{
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 " ));
4973
4961
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 " ));
4978
4966
4979
- PrintToStdErrW (buf);
4967
+ PrintToStdErrW (buf);
4968
+ }
4980
4969
}
4981
4970
EX_END_CATCH
4982
4971
}
0 commit comments